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

Add PUT endpoint for tasks #693

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Add PUT endpoint for tasks #693

merged 1 commit into from
Oct 12, 2023

Conversation

dmtrek14
Copy link
Collaborator

@dmtrek14 dmtrek14 commented Oct 10, 2023

Closes #692

  • Add the endpoint
  • Add TemplateUpdate schema
  • Add a simple get method to tasks service so we can check for existing task
  • Small updates to endpoint docs to provide more clarity
  • Update validation.

The validation updates for update were a bit extensive. Since it should be possible for someone to send a PUT request with only the task_id and the properties they want to update, we needed several additional checks to ensure the validation would work with a partial object. Mostly, we need to ensure the required properties (user_id, project_id, end, init, date) are on the object to be validated or else the validation fails.

@dmtrek14 dmtrek14 requested a review from anarute October 10, 2023 18:09
@dmtrek14
Copy link
Collaborator Author

@anarute I put this one in draft status to get some feedback. The validate_task method got lengthier here and I think I could use another pair of eyes. Instead of a full object merge, I decided to validate an updated task only if the properties we validate (start, end, project_id, date) are different from the task in the db. If someone only wants to update the description or story, is it necessary to revalidate everything? I went with 'no' but am open to going the other way.

api/routers/v1/timelog.py Outdated Show resolved Hide resolved
- Add the endpoint
- Add TemplateUpdate schema
- Add a simple get method to tasks service so we can check for existing task
- Small updates to endpoint docs to provide more clarity
- Small update to regex for start and end time to ensure times are between 00:00 and 23:59
- Update validation for overlapping tasks
@dmtrek14 dmtrek14 marked this pull request as ready for review October 11, 2023 20:07
Copy link
Member

@anarute anarute left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's much better, thank you!

@dmtrek14 dmtrek14 merged commit 4f09b8c into main Oct 12, 2023
1 check passed
@dmtrek14 dmtrek14 deleted the task-put-endpoint branch October 12, 2023 14:56
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 this pull request may close these issues.

Add PUT endpoint for tasks
2 participants