pub async fn add_item(
pool: &PgPool,
actor: &Actor,
change_id: Uuid,
revision_id: Uuid,
) -> AppResult<()>Expand description
Adds an in-work revision to a draft change.
§Invariants
- Permission: CAD editor who is the author (or an administrator); the change is a draft (409); the revision is visible (“not found” otherwise) and in a group the actor may edit (403), in work and in no other open change (draft, in review or rejected), and every reviewer of the change can see it (409 each).
- Locks: the change row (
FOR UPDATE), then the revision row (revisions::lock). - Audit:
change.add_item, only when the revision was not yet part of the change. - Notifications / webhooks: none.
- Atomic: one transaction.