Interface AssignmentRepository

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

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

    Modifier and Type
    Method
    Description
    Finds all assignments associated with a course.
    Finds an assignment by course and external LMS identifier.
    Finds a single assignment by ID scoped to the given user.
    Finds all assignments belonging to courses owned by 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

    • findByUser

      @Query("SELECT a FROM Assignment a JOIN a.course c JOIN c.integration i WHERE i.user = :user") List<Assignment> findByUser(@Param("user") User user)
      Finds all assignments belonging to courses owned by the given user.
      Parameters:
      user - the owning user
      Returns:
      assignments accessible to the user
    • findByIdAndUser

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

      List<Assignment> findAllByCourse(Course course)
      Finds all assignments associated with a course.
      Parameters:
      course - the course to search within
      Returns:
      assignments belonging to the course
    • findByCourseAndExternalId

      Optional<Assignment> findByCourseAndExternalId(Course course, String externalId)
      Finds an assignment by course and external LMS identifier.
      Parameters:
      course - the owning course
      externalId - the external assignment identifier
      Returns:
      an optional containing the matching assignment, if found