Skip to main content

update_master

Function update_master 

Source
pub async fn update_master(
    pool: &PgPool,
    actor: &Actor,
    item_id: Uuid,
    project_id: Option<Uuid>,
    unit: &str,
    classification: Option<Classification>,
) -> AppResult<Item>
Expand description

Updates item master data. The unit can only change while nothing has been released yet, because released BOMs depend on it.

§Invariants

  • Permission: editor role (403); the item is visible to the actor (“not found” otherwise) and the actor a member of its project group and of the target group (403). A missing target group is a 400. Moving out of a restricted group needs a manager of that group or an admin (403, ensure_may_take_out).
  • Locks: the item row (FOR UPDATE).
  • Audit: item.update.
  • Notifications / webhooks: none.
  • Data: the unit cannot change once a revision is in review, released or obsolete (409).
  • Atomic: one transaction.