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
776 B

package org.ros.chatto.repository;
import java.util.List;
import java.util.Optional;
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 UserRepository extends JpaRepository<ChatUser, Long> {
@Query("select cu from ChatUser cu where cu.userName = ?1")
public Optional<ChatUser> findByUserName(String userName);
@Query("select cu from ChatUser cu join fetch cu.userRoles where cu.userName = ?1")
public ChatUser findByUserNameWithRole(String userName);
@Query("select cu.userName from ChatUser cu where cu.userName != ?1")
public List<String> findAllOtherUserNames(String userName);
}