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.User;

public interface CourseRepository extends CrudRepository<Course,Long> {
    Course findById(long id);


    @Query("select c from Course c where c.owner = ?1")
    Iterable<Course> findAllOwnedCoures(User teacher);

}
