Class TutorController
java.lang.Object
org.example.crmedu.application.controller.TutorController
REST controller for managing tutors. Provides endpoints to create, retrieve, update and delete tutors.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<CreateTutorResponse> createTutors
(@Valid CreateTutorRequest request) Creates a new tutor based on the provided request data.org.springframework.http.ResponseEntity
<Void> deleteTutor
(Long id) Deletes a tutor by its unique identifier.org.springframework.http.ResponseEntity
<GetTutorResponse> Retrieves a tutor by its unique identifier.org.springframework.http.ResponseEntity
<PageDTO<GetTutorResponse>> getTutors
(org.springframework.data.domain.Pageable pageable) Retrieves a paginates list of tutors.org.springframework.http.ResponseEntity
<Void> updateTutor
(@Valid UpdateTutorRequest request, Long id) Updates an existing tutor by its unique identifier.
-
Constructor Details
-
TutorController
public TutorController()
-
-
Method Details
-
getTutors
@GetMapping @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<PageDTO<GetTutorResponse>> getTutors(org.springframework.data.domain.Pageable pageable) Retrieves a paginates list of tutors.- Parameters:
pageable
- an object specifying pagination parameters (page number and size)- Returns:
- a
ResponseEntity
containing a paginated list of tutors wrapped inPageDTO
ofGetTutorResponse
-
createTutors
@PostMapping @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<CreateTutorResponse> createTutors(@Valid @RequestBody @Valid CreateTutorRequest request) Creates a new tutor based on the provided request data.- Parameters:
request
- an object containing the tutor details- Returns:
- a
ResponseEntity
with the created tutor data inCreateTutorResponse
-
getTutor
@GetMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<GetTutorResponse> getTutor(@PathVariable Long id) Retrieves a tutor by its unique identifier.- Parameters:
id
- the unique identifier of the tutor- Returns:
- a
ResponseEntity
containing the tutor data inGetTutorResponse
-
updateTutor
@PutMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<Void> updateTutor(@Valid @RequestBody @Valid UpdateTutorRequest request, @PathVariable Long id) Updates an existing tutor by its unique identifier.- Parameters:
request
- an object containing the updated tutor detailsid
- the unique identifier of the tutor to update- Returns:
- a
ResponseEntity
-
deleteTutor
@DeleteMapping("/{id}") @Secured({"SUPERUSER","ORG_ADMIN","CURATOR"}) public org.springframework.http.ResponseEntity<Void> deleteTutor(@PathVariable Long id) Deletes a tutor by its unique identifier.- Parameters:
id
- the unique identifier of the tutor to delete- Returns:
- a
ResponseEntity
-