package enea.lecservice.repository;

import enea.lecservice.entities.Permission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface PermissionRepository extends JpaRepository<Permission, String> {
    @Query("select distinct p.id from Permission p join p.roles r where r.id in (:roles)")
    public List<String> findPermissionsByRolesDescription(@Param("roles") List<String> roles);

}
