refactor(tasks): enhance PATCH /api/tasks with improved validation and access control
Merged
PR
6mo ago+342+342+012345678901234567890123456789-111-111-012345678901234567890123456789
- Updated the PATCH endpoint to require authentication and validate the task ID as a UUID.
- Enhanced the request body to support merging optional fields while rejecting unknown keys.
- Improved error handling to return 403 for unauthorized access and 404 for missing tasks.
- Refactored the updateTask function to enforce ownership checks against the resolved account ID.
- Removed the outdated validateUpdateTaskBody function in favor of a new validation approach.
- Updated documentation to reflect changes in request and response structures.
Summary by CodeRabbit
-
Bug Fixes
- Added ownership validation for task updates—users can no longer modify tasks they don't own (returns 403 error).
- Improved error handling with clearer validation messages for update requests.
-
Documentation
- Enhanced API documentation for the task update endpoint with authentication and validation requirements.