Package com.example.seraphine.controller
Class DoctorController
java.lang.Object
com.example.seraphine.controller.DoctorController
@RestController
@RequestMapping("api/v1/doctor")
@CrossOrigin(origins="http://localhost:3000/search")
public class DoctorController
extends Object
The controller for the doctor operations.
- Author:
- Vinh Truong Canh Thanh
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDoctor
(Doctor doctor) Add a doctor to databaseorg.springframework.http.ResponseEntity<Void>
deleteDoctor
(Long doctor_id) Delete a doctor based on iddisplayAllAppointments
(Long doctor_id) Show all available appointment for doctor based on iddisplayAllDoctorsWithQuery
(String issue_covered, String address, int distance_to_user) Search query doctor in databaseGet a doctor based on idList all doctorsupdateDoctor
(Long doctor_id, Doctor newDoctor) Edit doctor information
-
Constructor Details
-
DoctorController
public DoctorController()
-
-
Method Details
-
createDoctor
Add a doctor to database- Parameters:
doctor
- Doctor- Returns:
- String
-
showAllDoctors
List all doctors- Returns:
- list of all doctor
-
getDoctor
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<Optional<Doctor>> getDoctor(@PathVariable("id") Long doctor_id) Get a doctor based on id- Parameters:
doctor_id
- Long- Returns:
- doctor JSON data based on id
-
updateDoctor
@PutMapping("/{id}") public String updateDoctor(@PathVariable("id") Long doctor_id, @RequestBody Doctor newDoctor) Edit doctor information- Parameters:
doctor_id
- LongnewDoctor
- Doctor- Returns:
- String
-
deleteDoctor
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> deleteDoctor(@PathVariable("id") Long doctor_id) Delete a doctor based on id- Parameters:
doctor_id
- long- Returns:
- status for empty doctor
-
displayAllDoctorsWithQuery
@GetMapping(path="/search/query") public List<Doctor> displayAllDoctorsWithQuery(@RequestParam String issue_covered, @RequestParam String address, @RequestParam int distance_to_user) Search query doctor in database- Parameters:
issue_covered
- Stringaddress
- Stringdistance_to_user
- int- Returns:
- list of doctor satisfied the condition
-
displayAllAppointments
@GetMapping("/appointment/{id}/all") public List<Appointment> displayAllAppointments(@PathVariable("id") Long doctor_id) Show all available appointment for doctor based on id- Parameters:
doctor_id
- Long- Returns:
- List of appointment
-