As a developer I want to add a PATCH endpoint to update a file's role so that a user can correct a wrongly assigned role on a file without deleting and re-uploading it.
Assumptions & Constraints
- Role can only be changed to one of the existing
FileRole values, GENERIC, PROBLEM, REFERENCE, or SOLUTION.
- Only the user who uploaded the file, or an ADMIN, can change its role.
- The role can be changed only for ATTACHED files.
- Changing a file's role doesn't touch its storage, filename, or any other metadata.
Preconditions
FileAsset, FileRole, FileService and FileController already exist.
Business rules
- A file's role can be set to GENERIC, PROBLEM, REFERENCE, or SOLUTION.
- Only the file's uploader or an ADMIN can change its role.
- Changing the role doesn't affect the file's status or any other field.
- A request for a file id that doesn't exist results in a 404.
Acceptance Criteria
- A PATCH endpoint accepts a file id and a new role, and updates it.
- A request from the file's uploader succeeds.
- A request from an ADMIN who didn't upload the file succeeds.
- A request from anyone else is rejected with a 403.
- A request for a file id that doesn't exist returns a 404.
Out of scope
- Validating a role change against any requirements set on a related tour or task assignment.
- Any change to file upload, attach, detach, or delete.
- Bulk role updates across multiple files at once.
Epic link
Epic #115 - EPIC: File Management
Tasks
As a developer I want to add a PATCH endpoint to update a file's role so that a user can correct a wrongly assigned role on a file without deleting and re-uploading it.
Assumptions & Constraints
FileRolevalues, GENERIC, PROBLEM, REFERENCE, or SOLUTION.Preconditions
FileAsset,FileRole,FileServiceandFileControlleralready exist.Business rules
Acceptance Criteria
Out of scope
Epic link
Epic #115 - EPIC: File Management
Tasks