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.

24 lines
1.1 KiB

  1. package org.ros.chatto.repository;
  2. import java.util.List;
  3. import org.ros.chatto.dto.AdminUserDTO;
  4. import org.ros.chatto.model.ChatUser;
  5. import org.springframework.data.jpa.repository.JpaRepository;
  6. import org.springframework.data.jpa.repository.Query;
  7. import org.springframework.stereotype.Repository;
  8. @Repository
  9. public interface AdminUserRepository extends JpaRepository<ChatUser, Long> {
  10. @Query("select new org.ros.chatto.dto.AdminUserDTO(u.userID, u.userName, ur.role.name, u.joinDate )"
  11. + " from ChatUser u join u.userRoles ur where u.userName != ?1")
  12. public List<AdminUserDTO> getOtherUsers(String principal);
  13. @Query("select new org.ros.chatto.dto.AdminUserDTO(u.userID, u.userName, ur.role.name, u.joinDate )"
  14. + " from ChatUser u join u.userRoles ur ")
  15. public List<AdminUserDTO> getAllUsers();
  16. @Query("select new org.ros.chatto.dto.AdminUserDTO(u.userID, u.userName, ur.role.name, u.joinDate )"
  17. + " from ChatUser u join u.userRoles ur where ur.role.roleID = 2")
  18. public List<AdminUserDTO> getRegularUsers();
  19. }