Skip to main content

Module files

Module files 

Source
Expand description

Handlers for HTTP requests to /api/v0/files.

Re-exportsยง

pub use crate::domain::models_requests::UploadClaim;

Structsยง

AnswerUploadDestination ๐Ÿ”’
Who an answer upload is bound to, and where its objects are stored.
AuthorizationToken
Proof that an authorization check passed.
CmsFilesApiDoc ๐Ÿ”’
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_files row, so an answer-upload binding would have them reaped.
DownloadClaimQuery ๐Ÿ”’
The download claim as it rides in the URL the host puts in a grading request.
ExerciseUploadBinary ๐Ÿ”’
OpenAPI-only representation of an arbitrary multipart binary part.
FilesApiDoc ๐Ÿ”’

Functionsยง

_add_routes
Add a route for each controller in this module.
redirect_claimed_file ๐Ÿ”’
GET /api/v0/files/claimed/:file_upload_id?download-claim=:jwt Redirects 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_id Used 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_slug Used to upload data from exercise service iframes.