Skip to main content

add_basis

Function add_basis 

Source
pub async fn add_basis(
    pool: &PgPool,
    actor: &Actor,
    revision_id: Uuid,
    input: NewBasis,
) -> AppResult<SimulationBasis>
Expand description

Adds a basis link to a simulation revision checked out by the actor.

ยงInvariants

  • Permission: CAD editor in the project group of the simulation, which is in work and checked out by the actor (otherwise 403 / 409); the basis item and revision must be visible to the actor (looked up before the transaction, hidden = 404). A simulation cannot be based on itself (400).
  • Locks: the simulation revision (FOR UPDATE) and the basis item (FOR SHARE), so a concurrent items::delete cannot remove it.
  • Audit: simulation.basis.add (related to the basis item). A second identical link (same basis revision and role) gets a 409.
  • Notifications / webhooks: none.
  • Atomic: one transaction.