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

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.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 UserRepository extends JpaRepository<ChatUser, Long> {
  10. @Query("select cu from ChatUser cu where cu.userName = ?1")
  11. public Optional<ChatUser> findByUserName(String userName);
  12. @Query("select cu from ChatUser cu join fetch cu.userRoles where cu.userName = ?1")
  13. public ChatUser findByUserNameWithRole(String userName);
  14. @Query("select cu.userName from ChatUser cu where cu.userName != ?1")
  15. public List<String> findAllOtherUserNames(String userName);
  16. }