pub async fn run(
pool: &PgPool,
actor: &Actor,
table: &BomTable,
filename: &str,
options: &ImportOptions,
source: Option<&Upload>,
) -> AppResult<ImportResult>Expand description
Runs an import in one transaction. source (the STEP file, see
step_file) is attached to a new top-level assembly.
ยงInvariants
- Permission: editor role (403). With a target revision: visible,
checked out by the actor (409 otherwise) and editable
(
revisions::ensure_editable). The project group must exist and be visible (400), not archived (400) and the actor a member (403). A table without importable rows is a 400. - Locks: the target revision (
revisions::lock), each new revision it fills, the project group row (FOR SHARE) and the number counters of the new items. - Audit:
item.createper new item,file.uploadfor the attached STEP file,bom.addper line, thenimport.bomon the root revision. - Notifications: none; the importer only starts watching new items.
- Webhooks: none.
- Atomic: one transaction (
tests/import_atomicity.rs); a refused or failing import leaves no item, line, counter step or audit entry.