Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE: Cow Death - Creating CowDeathController (1/3 Routes POST /api/cowdeath) #19

Open
8 tasks
ykeung opened this issue May 26, 2023 · 0 comments
Open
8 tasks
Assignees

Comments

@ykeung
Copy link
Contributor

ykeung commented May 26, 2023

Feature Summary

We want an admin to able run the Cow Health Update Job so that cows get killed off everytime the Cow Health Update job runs according to the logic outlined in step 3.

Discussion

NEED TO UPDATE ISSUE: don't think we need all of these endpoints

Note that a backend entity called CowDeath and a new repository called CowDeathRepository exists:

  • CowDeath.java is where the basic entity is created with variables id, commonsId, userId, ZonedDateTime, cowsKilled, and avgHealth
  • CowDeathRepository.java is where the basic CRUD repo is

Step 1 (20pts)

Add a CowDeathController with three routes:

  • POST /api/cowdeath available only to admins, that allows the creation of a new CowDeath entity
  • GET /api/cowdeath/bycommons available only to admins that takes a commons id, and lists all cow casualties for that commons.
  • GET /api/cowdeath/byusercommons that takes a commonsId and a userId and lists all cow deaths for that user commons

Acceptance Criteria

Step 1

  • Test the implemented routes in the CowDeathController using Swagger UI, ensuring the proper functioning and correct response formats.
  • Perform local testing of each route with various input scenarios, confirming the expected responses and error handling.
  • Confirm unit tests and integration tests pass for the CowDeathController to confirm proper functionality and appropriate security constraints. Ensure they pass mutation testing.

Implementation Todos

Step 1

  • Implement a POST route /api/cowdeath in the CowDeathController that allows admin users to create a new CowDeath entity.
  • Implement a GET route /api/cowdeath/bycommons in the CowDeathController that allows admin users to retrieve cow casualties for a specific commons by providing a commonsId.
  • Implement a GET route /api/cowdeath/byusercommons in the CowDeathController that retrieves cow deaths for a specific user commons by providing a userId and a commonsId.
  • Add appropriate security constraints to the routes ensuring that only admin users have access to these endpoints.

Testing:

  • Back end tests pass and there is adequate coverage
@ykeung ykeung assigned ykeung and unassigned ykeung May 26, 2023
@ashleybudman ashleybudman self-assigned this May 30, 2023
@ashleybudman ashleybudman changed the title FEATURE: Cow Death - Creating CowDeathController FEATURE: Cow Death - Creating CowDeathController (1/3 Routes POST /api/cowdeath) Jun 5, 2023
@ashleybudman ashleybudman linked a pull request Jun 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants