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.
 
 
 
 
 
 

25 lines
1.1 KiB

package org.ros.chatto.repository;
import java.util.List;
import org.ros.chatto.dto.AdminUserDTO;
import org.ros.chatto.model.ChatUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@Repository
public interface AdminUserRepository extends JpaRepository<ChatUser, Long> {
@Query("select new org.ros.chatto.dto.AdminUserDTO(u.userID, u.userName, ur.role.name, u.joinDate )"
+ " from ChatUser u join u.userRoles ur where u.userName != ?1")
public List<AdminUserDTO> getOtherUsers(String principal);
@Query("select new org.ros.chatto.dto.AdminUserDTO(u.userID, u.userName, ur.role.name, u.joinDate )"
+ " from ChatUser u join u.userRoles ur ")
public List<AdminUserDTO> getAllUsers();
@Query("select new org.ros.chatto.dto.AdminUserDTO(u.userID, u.userName, ur.role.name, u.joinDate )"
+ " from ChatUser u join u.userRoles ur where ur.role.roleID = 2")
public List<AdminUserDTO> getRegularUsers();
}