Class ConsultationController
java.lang.Object
com.mirna.hospitalmanagementapi.application.controllers.ConsultationController
@RestController
@RequestMapping("/api/v1.0/consultations")
public class ConsultationController
extends Object
A Spring REST controller for managing consultations.
- Version:
- 1.0
- Author:
- Mirna Gama
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Object>deleteConsultation(@Valid ConsultationCanceledDTO consultationCanceledDTO) Delete method to update a new Consultation object based on the provided DTO.org.springframework.http.ResponseEntity<Object>getConsultation(Long id) Get method to receive a Consultation record by the provided IDorg.springframework.http.ResponseEntity<Object>postConsultation(@Valid ConsultationDTO consultationDTO) Post method to create a new Consultation object based on the provided DTO.
-
Constructor Details
-
ConsultationController
public ConsultationController()
-
-
Method Details
-
postConsultation
@PostMapping public org.springframework.http.ResponseEntity<Object> postConsultation(@RequestBody @Valid @Valid ConsultationDTO consultationDTO) throws ConsultationValidationException Post method to create a new Consultation object based on the provided DTO.- Parameters:
consultationDTO- The data transfer object containing data for Consultation entity.- Returns:
- A response entity containing the saved consultation and created status if successful, or a 400-level error if there is a validation error
- Throws:
ConsultationValidationException- if there is a validation error
-
getConsultation
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<Object> getConsultation(@PathVariable Long id) Get method to receive a Consultation record by the provided ID- Parameters:
id- A long representing the consultation's unique identifier- Returns:
- A response entity containing the corresponding consultation if successful, or a 400-level error if it is non-existent
-
deleteConsultation
@DeleteMapping public org.springframework.http.ResponseEntity<Object> deleteConsultation(@RequestBody @Valid @Valid ConsultationCanceledDTO consultationCanceledDTO) Delete method to update a new Consultation object based on the provided DTO.- Parameters:
consultationCanceledDTO- The data transfer object containing data to update Consultation entity.- Returns:
- A response entity containing the canceled consultation and ok status if successful, or a 400-level error if the consultation entity is not found
-