package it.enea.cruise.repositories;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import it.enea.cruise.model.user.OldUser;
import it.enea.cruise.model.user.User;

public interface OldUserRepository extends CrudRepository<OldUser, Long>{
	
	List<User> findByUserid(Long userid);
	
	//List<User> findBySubject(String subject);
	
	List<User> findByUsername(String username);
	
	List<User> findByEmail(String email);
	
	@Query ("SELECT u FROM user as u JOIN userCommunity as uc ON u.userid = uc.id.userid WHERE uc.id.communityid = ?1")
	List<User> findAllByCommunityId(Long communityid);
	
	User findBySubject(String subject);

}
