Class DoctorController
java.lang.Object
com.mirna.hospitalmanagementapi.application.controllers.DoctorController
A Spring REST controller for managing doctors.
- Version:
- 1.0
- Author:
- Mirna Gama
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Object>deleteDoctor(Long id) Delete method to deactivate a existing doctor record by provided IDorg.springframework.http.ResponseEntity<Object>Get method to receive a Doctor record by the provided IDorg.springframework.http.ResponseEntity<Object>getDoctors(org.springframework.data.domain.Pageable pageable) Get method to receive a paginated sublist of objects containing data transfer objects with Doctor public informationorg.springframework.http.ResponseEntity<Object>postDoctor(@Valid DoctorDTO doctorDTO) Post method to create a new Doctor object based on the provided DTO.org.springframework.http.ResponseEntity<Object>putDoctor(@Valid DoctorUpdatedDataDTO doctorUpdatedDataDTO) Put method to update a existing doctor record by provided ID
-
Constructor Details
-
DoctorController
public DoctorController()
-
-
Method Details
-
postDoctor
@PostMapping public org.springframework.http.ResponseEntity<Object> postDoctor(@RequestBody @Valid @Valid DoctorDTO doctorDTO) Post method to create a new Doctor object based on the provided DTO.- Parameters:
doctorDTO- The data transfer object containing data for Doctor entity.- Returns:
- A response entity containing the saved doctor and created status if successful, or a 400-level error if there is a validation error
-
getDoctor
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<Object> getDoctor(@PathVariable Long id) Get method to receive a Doctor record by the provided ID- Parameters:
id- A long representing the doctor's unique identifier- Returns:
- A response entity containing the saved doctor if successful, or a 404 level error if it is non-existent
-
getDoctors
@GetMapping public org.springframework.http.ResponseEntity<Object> getDoctors(@PageableDefault(size=10,sort="name") org.springframework.data.domain.Pageable pageable) Get method to receive a paginated sublist of objects containing data transfer objects with Doctor public information- Parameters:
pageable- Pagination information, such as size and page number- Returns:
- A response entity containing the paginated sublist of doctors if successful
-
putDoctor
@PutMapping public org.springframework.http.ResponseEntity<Object> putDoctor(@RequestBody @Valid @Valid DoctorUpdatedDataDTO doctorUpdatedDataDTO) Put method to update a existing doctor record by provided ID- Parameters:
doctorUpdatedDataDTO- Data Transfer Object containing allowed data to be updated in Doctor entity- Returns:
- A response entity containing the saved doctor if successful, or a 400-level error if there is a validation error
-
deleteDoctor
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Object> deleteDoctor(@PathVariable Long id) Delete method to deactivate a existing doctor record by provided ID- Parameters:
id- Path variable that represents the doctor's unique identifier- Returns:
- A response entity containing the deactivated doctor if successful
-