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

[BE] Logging/Feeding Logic #49

Open
1 of 7 tasks
michaelhyi opened this issue Feb 18, 2025 · 0 comments
Open
1 of 7 tasks

[BE] Logging/Feeding Logic #49

michaelhyi opened this issue Feb 18, 2025 · 0 comments

Comments

@michaelhyi
Copy link
Contributor

michaelhyi commented Feb 18, 2025

Description

Backend engineers should implement the logging and feeding logic.

Acceptance Criteria

  • Create new DB tables called MedicationCheckIn and MedicationLog.
Schemas:

MedicationCheckIn: {
     _id: ObjectId
    medicationId: ObjectId
    expiration: date
}

MedicationLog: {
    _id: ObjectId
    medicationId: ObjectId
    dateTaken: date
}
  • The following endpoints are implemented:
POST /api/v1/medication/{medicationId}/check-in
No Request Body

POST /api/v1/medication/{medicationId}/log
Request Body: {
    "pin": string
}

PATCH /api/v1/pet/{petId}/feed
  • Service layer should contain business logic for when a user checks in to a medication and for actually logging it. When a user checks in, a new entity should be created, with a 15 min expiration to log the medication before they have to check in again.
    • Validate that the medicationId exists, and is not expired. If expired, delete that particular MedicationCheckIn entity. Do nothing if there's an already existing MedicationCheckIn entity for that medication and it hasn't expired.
    • If a user decides to log the medication, validate the pin by matching it with the pin set in the User's settings. Validate that the pin exists for the user. Validate that the expiration from check in has not expired. If logging is successful, delete the MedicationCheckIn entity. Add food to the pet. You may have to update the current entities / types / models to have a food attribute, that takes in some integer.
    • If a user feeds a pet, make sure the pet exists. If it does, then increase user xp by 50. (this number is tentative) Assume all xp level's threshold is 100 xp. If it overflows 100, increase the level of the pet/user.
  • DAO's should contain methods for creating MedicationCheckIn entities,MedicationLog entities, feeding pet entities, and updating user XP

Additional Notes

This is a lot. I tried my best to be thorough and clear, but whomever is working on this ticket will likely have questions. Please do not hesitate to reach out for clarifications or concerns!

@michaelhyi michaelhyi added this to the Sprint 3 - S24 milestone Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant