pub async fn revise(
pool: &PgPool,
actor: &Actor,
id: Uuid,
) -> AppResult<Revision>Expand description
Creates the next revision of an item, copying attributes, files and BOM
lines from revision id. Only possible when the item has no open revision.
§Invariants
- Permission: CAD editor; the source revision is visible (“not found” otherwise) and in a group the actor may edit (403); the item has no revision in work or in review (409).
- Locks: the source revision row (
revisions::lock), then the item row (FOR UPDATE), which serialises concurrent revisions of the same item. - Audit:
revision.revise. - Notifications: the watchers of the item.
- Webhooks: none.
- Data: the new revision is checked out by the actor and takes over attributes, files (as version 1), references, simulations and BOM lines.
- Atomic: one transaction.