package es.uv.saic.domain;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface LinkRepository extends JpaRepository<Link, Integer>  {

    @Query(value="SELECT * FROM links WHERE token = ?1 AND data_exp > CURRENT_DATE;", nativeQuery=true)
	Link findByToken(String token); 

    @Query(value="SELECT * FROM links WHERE ruct = ?1 AND data_exp > CURRENT_DATE;", nativeQuery=true)
	List<Link> findByRuct(Integer ruct); 
    
}
