Skip to main content

hand_over

Function hand_over 

Source
pub async fn hand_over(
    pool: &PgPool,
    actor: &Actor,
    from: Uuid,
    to: Uuid,
) -> AppResult<HandoverReport>
Expand description

Moves the work of from to to.

ยงInvariants

  • Permission: administrator (403). from and to differ; to is an active CAD editor or administrator (400). from may be deactivated (the usual case).
  • Locks: both user rows, then every moved item, change and request (FOR UPDATE).
  • Moves: items owned by from; changes authored by from that are drafts or rejected; change requests assigned to from that are not closed; pending reviews of from on changes in draft or in review. Objects to may not own or review (cannot read them, already a reviewer, or four-eyes conflict) stay with from and are listed as skipped with the reason.
  • Audit: one entry per moved object (item.owner, change.handover, change_request.handover, change.review_handover) and one user.handover with the counts.
  • Notifications / webhooks: none.
  • Atomic: one transaction.