ucsb-cs156-s21 / proj-ucsb-cs-las

https://proj-ucsb-cs-las.herokuapp.com/
MIT License
2 stars 3 forks source link

Create new endpoint in OfficeHoursController for `/api/member/officeHours` that returns a list of all office hours for the current member. #296

Closed pconrad closed 3 years ago

pconrad commented 3 years ago

There is an existing endpoint:

  @GetMapping(value = "/api/public/officeHours", produces = "application/json")
    public ResponseEntity<String> getOfficeHours() throws JsonProcessingException {
        List<OnlineOfficeHours> officeHourList = officeHoursRepository.findAll();
        ObjectMapper mapper = new ObjectMapper();

        String body = mapper.writeValueAsString(officeHourList);
        return ResponseEntity.ok().body(body);
    }

In this issue, we add a new version of this with just one difference: Instead of using:

officeHoursRepository.findAll();

We:

This can be used to populate the office hours in a OfficeHoursSelector component on the TutorNotesForm for entering new office hours.