pub async fn supersede(
pool: &PgPool,
actor: &Actor,
item_id: Uuid,
successor_number: &str,
note: &str,
) -> AppResult<()>Expand description
Declares item_id superseded by successor_number (replacing an earlier
successor).
§Invariants
- Permission: both items visible to the actor (“not found” otherwise);
CAD editor and member of the group of
item_id(403). An item cannot supersede itself (400). A group withobsolete_requires_changerefuses the direct supersession (409): it goes through a change order. - Locks: the table
item_supersessions(SHARE ROW EXCLUSIVE), so two concurrent supersessions cannot close a circle unseen; a circle is a 409. - Audit:
item.supersede. - Notifications: the watchers of
item_id(also when the group does not require a change order); people who may not see the successor get a text without its number. Webhooks: none. - Data: an earlier successor of the item is replaced.
- Atomic: one transaction.