Class SubjectController
java.lang.Object
org.example.crmedu.application.controller.SubjectController
REST controller for managing subjects. Provides endpoints to create, retrieve, update and delete subjects.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<CreateSubjectResponse> createSubject
(@Valid CreateSubjectRequest request) Creates a new subject based on the provided request data.org.springframework.http.ResponseEntity
<Void> deleteSubject
(Long id) Deletes a subject by its unique identifier.org.springframework.http.ResponseEntity
<GetSubjectResponse> getSubject
(Long id) Retrieves a subject by its unique identifier.org.springframework.http.ResponseEntity
<PageDTO<GetSubjectResponse>> getSubjects
(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list of subjects.org.springframework.http.ResponseEntity
<Void> updateSubject
(Long id, @Valid UpdateSubjectRequest request) Updates an existing subject by its unique identifier.
-
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 inPageDTO
ofGetSubjectResponse
-
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 inGetSubjectResponse
-
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 inCreateSubjectResponse
-
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 updaterequest
- 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
-