Skip to main content

add_alternate

Function add_alternate 

Source
pub async fn add_alternate(
    pool: &PgPool,
    actor: &Actor,
    item_id: Uuid,
    input: NewAlternate,
) -> AppResult<()>
Expand description

Declares input.number an alternate of item_id.

§Invariants

  • Permission: both items visible to the actor (“not found” otherwise); CAD editor and member of the group of item_id (403). A two-way link also needs membership in the alternate’s group (403). An item cannot be its own alternate (400).
  • Locks: none beyond the unique key of item_alternates (ON CONFLICT DO NOTHING); a link that exists in every requested direction is a 409.
  • Audit: item.alternate.add.
  • Notifications / webhooks: none.
  • Atomic: one transaction (both directions of a two-way link or none).