A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
721 B

  1. package org.ros.chatto.repository;
  2. import java.util.List;
  3. import org.ros.chatto.model.UserSession;
  4. import org.springframework.data.jpa.repository.JpaRepository;
  5. import org.springframework.data.jpa.repository.Query;
  6. import org.springframework.stereotype.Repository;
  7. @Repository
  8. public interface UserSessionRepository
  9. extends JpaRepository<UserSession, Long> {
  10. @Query("select us from UserSession us join fetch us.user where us.user.userName = ?1 ")
  11. public UserSession findByUserName(String userName);
  12. @Query("select us from UserSession us join fetch us.user")
  13. public List<UserSession> findAllUserSessions();
  14. @Query("select count(us) from UserSession us where us.online=true")
  15. public Long totalOnlineUsers();
  16. }