Class SubjectController

java.lang.Object
org.example.crmedu.application.controller.SubjectController

@RestController @RequestMapping("api/v1/subjects") public class SubjectController extends Object
REST controller for managing subjects. Provides endpoints to create, retrieve, update and delete subjects.
  • Constructor Details

    • SubjectController

      public SubjectController()
  • Method Details

    • getSubjects

      @GetMapping @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<PageDTO<GetSubjectResponse>> getSubjects(org.springframework.data.domain.Pageable pageable)
      Retrieves a paginated list of subjects.
      Parameters:
      pageable - an object specifying pagination parameters (page number and size)
      Returns:
      a ResponseEntity containing a paginated list of subjects wrapped in PageDTO of GetSubjectResponse
    • getSubject

      @GetMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<GetSubjectResponse> getSubject(@PathVariable Long id)
      Retrieves a subject by its unique identifier.
      Parameters:
      id - the unique identifier of the subject
      Returns:
      a ResponseEntity containing the subject data in GetSubjectResponse
    • createSubject

      @PostMapping @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<CreateSubjectResponse> createSubject(@Valid @RequestBody @Valid CreateSubjectRequest request)
      Creates a new subject based on the provided request data.
      Parameters:
      request - an object containing the subject details
      Returns:
      a ResponseEntity with the created subject data in CreateSubjectResponse
    • updateSubject

      @PutMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<Void> updateSubject(@PathVariable Long id, @Valid @RequestBody @Valid UpdateSubjectRequest request)
      Updates an existing subject by its unique identifier.
      Parameters:
      id - the unique identifier of the subject to update
      request - an object containing the updated subject details
      Returns:
      a ResponseEntity
    • deleteSubject

      @DeleteMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<Void> deleteSubject(@PathVariable Long id)
      Deletes a subject by its unique identifier.
      Parameters:
      id - the unique identifier of the subject to delete
      Returns:
      a ResponseEntity