Class PreferencesRestEndpoint

java.lang.Object
org.cswteams.ms3.rest.PreferencesRestEndpoint

@RestController @RequestMapping("/preferences/") public class PreferencesRestEndpoint extends Object
REST endpoint for api/preferences
  • 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 PreferenceDTOOut in 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 delete
      doctorId - 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 preferences
      doctorId - the id representing the doctor to whom the preferences shall be added
      Returns:
      A List of PreferenceDTOOut of 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 PreferenceDTOOut representing the edited (and remaining) preferences, giving the newly added ones their own id, too