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

EDU-4 patch progress #11

Open
TylerSchaefer4 opened this issue Sep 18, 2023 · 0 comments
Open

EDU-4 patch progress #11

TylerSchaefer4 opened this issue Sep 18, 2023 · 0 comments

Comments

@TylerSchaefer4
Copy link
Contributor

TylerSchaefer4 commented Sep 18, 2023

Request:

PATCH /api/user/{user_id}/progress

Ex:

{
"lessonId": 3
}

In this request, lessonId is the ID of the lesson the user has just completed.

Backend Logic:

When a request is received at the PATCH /api/user/{user_id}/progress endpoint:

  • Validate the user_id and lessonId.
  • Check if a Progress record already exists for the user_id and lessonId.
    • If it exists, update the date to the current date and time.
    • If it doesn’t exist, create a new Progress record with the user_id, lessonId, and current date.

Here's some pseudo-code to demonstrate the logic:

Response:

The API should respond with the updated or created Progress record.

{
"id": 456,
"lessonId": 3,
"userId": 12345,
"date": "2023-09-25T12:45:00.000Z"
}

Error Handling:

  • If the lessonId is not provided in the request body, return a 400 Bad Request error.
  • If the user_id is not found, return a 404 Not Found error.

Notes:

  • Going to be adding additional logic here to essentially "Lock" lessons that haven't been reached yet. So just keep that in mind while completing this ticket.
@TylerSchaefer4 TylerSchaefer4 changed the title EDU-4 post lesson complete EDU-4 patch progress Sep 25, 2023
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

No branches or pull requests

1 participant