Package web.sportflow.friendship
Interface FriendshipRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Friendship,,Long> org.springframework.data.jpa.repository.JpaRepository<Friendship,,Long> org.springframework.data.repository.ListCrudRepository<Friendship,,Long> org.springframework.data.repository.ListPagingAndSortingRepository<Friendship,,Long> org.springframework.data.repository.PagingAndSortingRepository<Friendship,,Long> org.springframework.data.repository.query.QueryByExampleExecutor<Friendship>,org.springframework.data.repository.Repository<Friendship,Long>
public interface FriendshipRepository
extends org.springframework.data.jpa.repository.JpaRepository<Friendship,Long>
-
Method Summary
Modifier and TypeMethodDescriptionfindAcceptedForUser(Long userId) findByAddresseeIdAndStatus(Long addresseeId, FriendshipStatus status) findByRequesterIdAndStatus(Long requesterId, FriendshipStatus status) findRelationshipBetween(Long userA, Long userB) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, saveMethods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlushMethods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAllMethods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAllMethods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findRelationshipBetween
@Query("select f\nfrom Friendship f\nwhere (f.requester.id = :userA and f.addressee.id = :userB)\n or (f.requester.id = :userB and f.addressee.id = :userA)\n") Optional<Friendship> findRelationshipBetween(@Param("userA") Long userA, @Param("userB") Long userB) -
findByAddresseeIdAndStatus
-
findByRequesterIdAndStatus
-
findAcceptedForUser
@Query("select f\nfrom Friendship f\nwhere f.status = web.sportflow.friendship.FriendshipStatus.ACCEPTED\n and (f.requester.id = :userId or f.addressee.id = :userId)\n") List<Friendship> findAcceptedForUser(@Param("userId") Long userId)
-