added filter on title and description on post
This commit is contained in:
@@ -6,10 +6,14 @@ import java.util.List;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
public interface MessageRepository extends JpaRepository<Message, Long> {
|
||||
|
||||
List<Message> findByChatIdOrderByCreatedAtAsc(Long chatId);
|
||||
long countByChatIdAndIsReadFalseAndSenderIdNot(Long chatId, Long currentUserId);
|
||||
@Modifying
|
||||
@Query("UPDATE Message m SET m.isRead = true WHERE m.chatId = :chatId AND m.senderId != :userId")
|
||||
int markAsReadByChatIdAndRecipient(@Param("chatId") Long chatId, @Param("userId") Long userId);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user