pub async fn accept(
pool: &PgPool,
actor: &Actor,
id: Uuid,
) -> AppResult<Proposal>Expand description
Makes a pending proposal a result value (same name and load case = update). The revision must be checked out to the actor, like for any change of its values.
ยงInvariants
- Permission: CAD editor in the project group, simulation revision in work and checked out by the actor (403 / 409), as for a value typed in. A proposal that is not pending gets a 409.
- Locks: the proposal row, then the simulation revision (both
FOR UPDATE), so two accepts of one proposal cannot both succeed. - Data: the value is written by
simulations::write_resultswith its source (file, version, proposer); the proposal becomesaccepted. - Audit:
simulation.proposal.accept(written bywrite_results). - Notifications: none.
- Webhooks:
simulation.result_added, in the same transaction. - Atomic: one transaction (
tests/result_proposals.rs); a second accept gets a 409.