pub async fn attach(
pool: &PgPool,
actor: &Actor,
revision_id: Uuid,
uploads: &[Upload],
comment: &str,
) -> AppResult<Vec<Stored>>Expand description
Adds files / new versions to a revision that is checked out by the actor.
§Invariants
- Permission: the revision is checked out by the actor (409 otherwise)
and editable (
revisions::ensure_editable: in work, CAD editor of its group); an empty upload list is a 400. - Locks: the revision row (
revisions::lock) and the existing file rows of the uploaded names (FOR UPDATE); an upload with a base version is checked against the current file (409 if it moved on). - Audit:
file.upload/file.versionper changed file,file.folderper moved file; identical content stores nothing new. For a simulation revision, result values read from an exchange file or the group’s templates addsimulation.result.exchange/simulation.result.template. - Notifications: none.
- Webhooks:
simulation.result_added, only when such result values were added or updated. - Atomic: one transaction, together with those result values (a malformed exchange file refuses the whole upload).