Expand description
Handlers for HTTP requests to /api/v0/files.
Re-exportsΒ§
pub use crate::domain::models_requests::UploadClaim;
StructsΒ§
- Authorization
Token - Proof that an authorization check passed.
- CmsFiles
ApiDoc π - The upload routes the CMS may call. Only the unbound slug route belongs here: files a teacher
attaches in the exercise editor are referenced from a spec, which never produces an
exercise_task_submission_filesrow, so an answer-upload binding would have them reaped. - Download
Claim πQuery - The download claim as it rides in the URL the host puts in a grading request.
- Exercise
Upload πBinary - OpenAPI-only representation of an arbitrary multipart binary part.
- File
Query π - Files
ApiDoc π
FunctionsΒ§
- _add_
routes - Add a route for each controller in this module.
- download_
file_ πname requested_name, else the uploaded fileβs original name, always ending in the fileβs extension so the saved file still opens in the right program. The extension comes from the storage path, or fromstored_namefor paths stored without one.- redirect_
claimed_ πfile - GET
/api/v0/files/claimed/:file_upload_id?download-claim=:jwtRedirects to one host-stored file, authorized by a claim naming that file. - redirect_
to_ πstorage_ service - GET
/api/v0/files/\*Redirects the request to a file storage service. - serve_
upload π - GET
/api/v0/files/uploads/\*Serve local uploaded file, mostly for development. - store_
answer_ πuploads - Stores the multipart parts and binds them to the exercise and user, so that a failure to record the binding cannot leave uploads the reaper is unable to find.
- upload_
answer_ πfiles - POST
/api/v0/files/answer-uploads/:exercise_task_idUsed to upload the files a student is attaching to an answer for the given exercise task. - upload_
from_ πexercise_ service - POST
/api/v0/files/:exercise_service_slugUsed to upload data from exercise service iframes.