Interface ChatRepository
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Chat,java.lang.String>,org.springframework.data.mongodb.repository.MongoRepository<Chat,java.lang.String>,org.springframework.data.repository.PagingAndSortingRepository<Chat,java.lang.String>,org.springframework.data.repository.query.QueryByExampleExecutor<Chat>,org.springframework.data.repository.Repository<Chat,java.lang.String>
@Repository public interface ChatRepository extends org.springframework.data.mongodb.repository.MongoRepository<Chat,java.lang.String>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.LongcountChatByUser(java.lang.String chatId, java.lang.String profileId, java.lang.String groupEntityId)java.lang.LongcountChatsByUser(java.lang.String profileId, java.lang.String groupEntityId)java.lang.LongcountChatsByUserBetweenDates(java.lang.String profileId, java.lang.String groupEntityId, java.time.LocalDate from, java.time.LocalDate to)voiddeleteById(java.lang.String s)java.util.List<Chat>findByFromId(java.lang.String profileId)java.util.List<Chat>findByGroupEntityId(java.lang.String groupEntityId)java.util.Optional<Chat>findById(java.lang.String s)java.util.List<Chat>findByToId(java.lang.String profileId)java.util.List<Chat>findChatsByUser(java.lang.String profileId, java.lang.String groupEntityId)org.springframework.data.domain.Page<Chat>findChatsByUser(java.lang.String profileId, java.lang.String groupEntityId, org.springframework.data.domain.Pageable page)org.springframework.data.domain.Page<Chat>findChatsByUserBetweenDates(java.lang.String profileId, java.lang.String groupEntityId, java.time.LocalDate from, java.time.LocalDate to, org.springframework.data.domain.Pageable page)java.util.List<Chat>findInboxChatsByUser(java.lang.String profileId, java.lang.String groupEntityId)<S extends Chat>
Sinsert(S entity)<S extends Chat>
Ssave(S entity)-
Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, existsById, findAllById
-
Methods inherited from interface org.springframework.data.mongodb.repository.MongoRepository
findAll, findAll, findAll, findAll, insert, saveAll
-
-
-
-
Method Detail
-
insert
@CacheEvict(value={"chatsFrom","chatsTo","groupChats"}, allEntries=true) <S extends Chat> S insert(S entity)- Specified by:
insertin interfaceorg.springframework.data.mongodb.repository.MongoRepository<Chat,java.lang.String>
-
save
@CacheEvict(value={"chatsFrom","chatsTo","groupChats"}, allEntries=true) <S extends Chat> S save(S entity)- Specified by:
savein interfaceorg.springframework.data.repository.CrudRepository<Chat,java.lang.String>
-
deleteById
@CacheEvict(value={"chatsFrom","chatsTo","groupChats"}, allEntries=true) void deleteById(java.lang.String s)- Specified by:
deleteByIdin interfaceorg.springframework.data.repository.CrudRepository<Chat,java.lang.String>
-
findById
@Cacheable({"chatsFrom","chatsTo","groupChats"}) java.util.Optional<Chat> findById(java.lang.String s)- Specified by:
findByIdin interfaceorg.springframework.data.repository.CrudRepository<Chat,java.lang.String>
-
findByFromId
@Cacheable("chatsFrom") java.util.List<Chat> findByFromId(java.lang.String profileId)
-
findByToId
@Cacheable("chatsTo") java.util.List<Chat> findByToId(java.lang.String profileId)
-
findByGroupEntityId
@Cacheable("groupChats") java.util.List<Chat> findByGroupEntityId(java.lang.String groupEntityId)
-
countChatsByUser
@Query(value="{ $or : [ { \'from.$id\' : ?0 },{ \'to.$id\' : ?0 },{ \'groupEntityId\': ?1 } ] }", count=true) java.lang.Long countChatsByUser(java.lang.String profileId, java.lang.String groupEntityId)
-
countChatsByUserBetweenDates
@Query(value="{ $or : [ { \'from.$id\' : ?0 },{ \'to.$id\' : ?0 },{ \'groupEntityId\': ?1 } ], \'createdDate\' : { $gte : ?2, $lte: ?3 } }", count=true) java.lang.Long countChatsByUserBetweenDates(java.lang.String profileId, java.lang.String groupEntityId, java.time.LocalDate from, java.time.LocalDate to)
-
findChatsByUser
@Query("{ $or : [ { \'from.$id\' : ?0 },{ \'to.$id\' : ?0 },{ \'groupEntityId\': ?1 } ] }") org.springframework.data.domain.Page<Chat> findChatsByUser(java.lang.String profileId, java.lang.String groupEntityId, org.springframework.data.domain.Pageable page)
-
findChatsByUser
@Query("{ $or : [ { \'from.$id\' : ?0 },{ \'to.$id\' : ?0 },{ \'groupEntityId\': ?1 } ] }") java.util.List<Chat> findChatsByUser(java.lang.String profileId, java.lang.String groupEntityId)
-
countChatByUser
@Query(value="{ id: ?0, $or : [ { \'from.$id\' : ?1 },{ \'to.$id\' : ?1 },{ \'groupEntityId\': ?2 } ] }", count=true) java.lang.Long countChatByUser(java.lang.String chatId, java.lang.String profileId, java.lang.String groupEntityId)
-
findInboxChatsByUser
@Query("{ $or : [ { \'to.$id\' : ?0 },{ \'groupEntityId\': ?1 } ] }") java.util.List<Chat> findInboxChatsByUser(java.lang.String profileId, java.lang.String groupEntityId)
-
findChatsByUserBetweenDates
@Query("{ $or : [ { \'from.$id\' : ?0 },{ \'to.$id\' : ?0 },{ \'groupEntityId\': ?1 } ], \'createdDate\' : { $gte : ?2, $lte: ?3 } }") org.springframework.data.domain.Page<Chat> findChatsByUserBetweenDates(java.lang.String profileId, java.lang.String groupEntityId, java.time.LocalDate from, java.time.LocalDate to, org.springframework.data.domain.Pageable page)
-
-