This issue should be completed after the issue with the title "Create UCSBDiningCommonsMenuItemController..."
Overview
In this issue, we add one more method from the example Controller used as a basis for our code; namely the method with the annotation shown below:
Annotation
Purpose
@PutMapping("")
Get a single record from the table; use the value passed in as a @RequestParam to do a lookup by id. If a matching row is found, update that row with the values passed in as a JSON object. If a matching row is not found, throw an EntityNotFoundException.
Note that while it isn't strictly necessary, it may be a good idea to implement GET for a single item
first; when using PUT manually, it's convenient to be able to copy/paste the JSON representation of the data from the
GET by id method, paste it into the swagger interface, then edit it to make the changes you want before clicking to
submit the request.
You'll need to copy over the code for the PUT method from the example controller,
and then paste those into UCSBDiningCommonsMenuItemController.java and edit them to match your database table.
Then, copy over the tests that pertain to the PUT method from the example controller,
paste those into UCSBDiningCommonsMenuItemControllerTests.java and edit them to match your database table.
Acceptance Criteria:
[x] In UCSBDiningCommonsMenuItemController.java there is code for an
endpoint PUT /api/UCSBDiningCommonsMenuItem?id=123 endpoint
that accepts JSON for a new set of values for the database
fields other than id, and updates the values of those fields.
[x] The Swagger-UI endpoints for this endpoint is well documented
so that any member of the team can understand how to use it.
[x] The endpoint works as expected on localhost.
[x] The endpoint works as expected when deployed to Dokku.
[x] There is full test coverage (Jacoco) for the new code in
UCSBDiningCommonsMenuItemController.java
[x] There is full mutation test coverage (Pitest) for new code in
UCSBDiningCommonsMenuItemController.java
What to do next
Do a PR, following all of the usual steps (title, description, Closes #n text,
dragging issue to "In Review", requesting reviewers).
Check to see if any fellow team members PRs need to be reviewed.
Then, assign yourself the next incomplete issue for your database table (UCSBDiningCommonsMenuItem)
Follow all the usual steps (assign to self, drag to "In Progress", start new branch.)
When you are done with all issues for UCSBDiningCommonsMenuItem, please give your full attention to
helping others on your team to complete the sprint, so that the team
is ready to submit on Canvas by the deadline.
Dependencies
This issue should be completed after the issue with the title "Create
UCSBDiningCommonsMenuItemController
..."Overview
In this issue, we add one more method from the example Controller used as a basis for our code; namely the method with the annotation shown below:
@PutMapping("")
@RequestParam
to do a lookup by id. If a matching row is found, update that row with the values passed in as a JSON object. If a matching row is not found, throw anEntityNotFoundException
.Note that while it isn't strictly necessary, it may be a good idea to implement
GET
for a single item first; when usingPUT
manually, it's convenient to be able to copy/paste the JSON representation of the data from theGET
by id method, paste it into the swagger interface, then edit it to make the changes you want before clicking to submit the request.You'll need to copy over the code for the PUT method from the example controller, and then paste those into
UCSBDiningCommonsMenuItemController.java
and edit them to match your database table.Then, copy over the tests that pertain to the PUT method from the example controller, paste those into
UCSBDiningCommonsMenuItemControllerTests.java
and edit them to match your database table.Acceptance Criteria:
UCSBDiningCommonsMenuItemController.java
there is code for an endpointPUT /api/UCSBDiningCommonsMenuItem?id=123
endpoint that accepts JSON for a new set of values for the database fields other thanid
, and updates the values of those fields.UCSBDiningCommonsMenuItemController.java
UCSBDiningCommonsMenuItemController.java
What to do next
Do a PR, following all of the usual steps (title, description,
Closes #n
text, dragging issue to "In Review", requesting reviewers).Check to see if any fellow team members PRs need to be reviewed.
Then, assign yourself the next incomplete issue for your database table (
UCSBDiningCommonsMenuItem
)Follow all the usual steps (assign to self, drag to "In Progress", start new branch.)
When you are done with all issues for
UCSBDiningCommonsMenuItem
, please give your full attention to helping others on your team to complete the sprint, so that the team is ready to submit on Canvas by the deadline.