pub async fn create_with_files(
pool: &PgPool,
actor: &Actor,
input: NewItem,
uploads: &[Upload],
) -> AppResult<Revision>Expand description
Creates an item and stores its first files in the new revision – one transaction, so there is never an item without the files it was created with. The revision stays checked out by the creator.
§Invariants
- Permission / locks / audit / data: as
create, then the new revision is locked (revisions::lock) and the files are stored like infiles::attach(file.uploadper file). - Notifications: none; the creator only starts watching the item.
- Webhooks:
simulation.result_addedwhen the item is a simulation and result values are read from the uploaded files (seefiles::attach); otherwise none. - Atomic: one transaction; a refused upload leaves no item behind.