package ovh.herisson.Clyde.Repositories;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import ovh.herisson.Clyde.Tables.Course;
import ovh.herisson.Clyde.Tables.Curriculum;
import ovh.herisson.Clyde.Tables.CurriculumCourse;

public interface CurriculumCourseRepository extends CrudRepository<CurriculumCourse,Long> {

    @Query("select distinct cc.course from CurriculumCourse cc where cc.curriculum = ?1")
    Iterable<Course> findCoursesByCurriculum(Curriculum curriculum);


    @Query("select distinct cc.curriculum from  CurriculumCourse cc")
    Iterable<Curriculum> findDistinctCurriculums();
}
