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.

22 lines
767 B

5 years ago
5 years ago
5 years ago
5 years ago
  1. package org.ros.chatto.repository;
  2. import java.util.List;
  3. import java.util.Optional;
  4. import org.ros.chatto.dto.AdminUserDTO;
  5. import org.ros.chatto.model.ChatUser;
  6. import org.springframework.data.jpa.repository.JpaRepository;
  7. import org.springframework.data.jpa.repository.Query;
  8. import org.springframework.stereotype.Repository;
  9. @Repository
  10. public interface UserRepository extends JpaRepository<ChatUser, Long> {
  11. @Query("select cu from ChatUser cu join fetch cu.userRoles where cu.userName = ?1")
  12. public Optional<ChatUser> findByUserName(String userName);
  13. @Query("select cu.userName from ChatUser cu where cu.userName != ?1")
  14. public List<String> findAllOtherUserNames(String userName);
  15. @Query("select count(u) from ChatUser u")
  16. public Long totalUsers();
  17. }