Interface CourseRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Course,Long>, org.springframework.data.jpa.repository.JpaRepository<Course,Long>, org.springframework.data.repository.ListCrudRepository<Course,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<Course,Long>, org.springframework.data.repository.PagingAndSortingRepository<Course,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<Course>, org.springframework.data.repository.Repository<Course,Long>

public interface CourseRepository extends org.springframework.data.jpa.repository.JpaRepository<Course,Long>
Repository for persisting and querying Course records.
  • Method Summary

    Modifier and Type
    Method
    Description
    Finds all courses linked to an integration.
    Finds all courses belonging to the given user.
    Finds a course by integration and external LMS course identifier.
    Finds a course by external identifier scoped to the given user.
    Finds a course by ID scoped to the given user.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findAllByUser

      @Query("SELECT c FROM Course c JOIN c.integration i WHERE i.user = :user") List<Course> findAllByUser(@Param("user") User user)
      Finds all courses belonging to the given user.
      Parameters:
      user - the owning user
      Returns:
      courses accessible to the user
    • findByUserAndId

      @Query("SELECT c FROM Course c JOIN c.integration i WHERE c.id = :id AND i.user = :user") Optional<Course> findByUserAndId(@Param("user") User user, @Param("id") Long id)
      Finds a course by ID scoped to the given user.
      Parameters:
      user - the owning user
      id - the course ID
      Returns:
      an optional containing the course, if found and owned by the user
    • findByUserAndExternalId

      @Query("SELECT c FROM Course c JOIN c.integration i WHERE c.externalCourseId = :external_id AND i.user = :user") Optional<Course> findByUserAndExternalId(@Param("user") User user, @Param("external_id") String id)
      Finds a course by external identifier scoped to the given user.
      Parameters:
      user - the owning user
      id - the external course identifier
      Returns:
      an optional containing the course, if found
    • findAllByIntegration

      List<Course> findAllByIntegration(Integration integration)
      Finds all courses linked to an integration.
      Parameters:
      integration - the integration to search within
      Returns:
      courses associated with the integration
    • findByIntegrationAndExternalCourseId

      Optional<Course> findByIntegrationAndExternalCourseId(Integration integration, String externalCourseId)
      Finds a course by integration and external LMS course identifier.
      Parameters:
      integration - the owning integration
      externalCourseId - the external course identifier
      Returns:
      an optional containing the matching course, if found