Package org.cswteams.ms3.rest
Class PreferencesRestEndpoint
java.lang.Object
org.cswteams.ms3.rest.PreferencesRestEndpoint
@RestController
@RequestMapping("/preferences/")
public class PreferencesRestEndpoint
extends Object
REST endpoint for api/preferences
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?> addPreferences(List<PreferenceDTOIn> preferenceDTOInList, Long doctorId) Adds preferences to a doctor
Reached from POST api/preferences/doctor_id={doctorId}org.springframework.http.ResponseEntity<?> deleteDoctorPreference(Long preferenceId, Long doctorId) Deletes a doctor's preference
Reached from DELETE api/preferences/preference_id={preferenceId}/doctor_id={doctorId}org.springframework.http.ResponseEntity<?> Edits the preferences of a doctor, eventually adding new ones and deleting unwanted ones
Reached from POST api/preferences/editorg.springframework.http.ResponseEntity<?> readDoctorPreferences(Long doctorId) Retrieves a doctor's preferences
Reached from GET api/preferences/doctor_id={doctorId}
-
Constructor Details
-
PreferencesRestEndpoint
public PreferencesRestEndpoint()
-
-
Method Details
-
readDoctorPreferences
@RequestMapping(method=GET, path="/doctor_id={doctorId}") public org.springframework.http.ResponseEntity<?> readDoctorPreferences(@PathVariable Long doctorId) Retrieves a doctor's preferences
Reached from GET api/preferences/doctor_id={doctorId}- Parameters:
doctorId- The id of the interested doctor- Returns:
- the doctor's preferences as
PreferenceDTOOutin the response body
-
deleteDoctorPreference
@RequestMapping(method=DELETE, path="/preference_id={preferenceId}/doctor_id={doctorId}") public org.springframework.http.ResponseEntity<?> deleteDoctorPreference(@PathVariable Long preferenceId, @PathVariable Long doctorId) Deletes a doctor's preference
Reached from DELETE api/preferences/preference_id={preferenceId}/doctor_id={doctorId}- Parameters:
preferenceId- the id of the preference to deletedoctorId- the id of the doctor to delete- Returns:
- A positive response in case of success, a negative one otherwise
-
addPreferences
@RequestMapping(method=POST, path="/doctor_id={doctorId}") public org.springframework.http.ResponseEntity<?> addPreferences(@RequestBody List<PreferenceDTOIn> preferenceDTOInList, @PathVariable Long doctorId) Adds preferences to a doctor
Reached from POST api/preferences/doctor_id={doctorId}- Parameters:
preferenceDTOInList- A List of DTOs containing the preferencesdoctorId- the id representing the doctor to whom the preferences shall be added- Returns:
- A List of
PreferenceDTOOutof the newly added preferences, with their own id, in the body of the response
-
editPreferences
@RequestMapping(method=POST, path="/edit") public org.springframework.http.ResponseEntity<?> editPreferences(@RequestBody EditedPreferencesDTOIn dto) Edits the preferences of a doctor, eventually adding new ones and deleting unwanted ones
Reached from POST api/preferences/edit- Returns:
- A response containing the list of
PreferenceDTOOutrepresenting the edited (and remaining) preferences, giving the newly added ones their own id, too
-