pub async fn set_retention(
pool: &PgPool,
actor: &Actor,
file_id: Uuid,
retention: FileRetention,
) -> AppResult<FileRecord>Expand description
Chooses what happens to the old versions of a file: all keeps every
version, latest lets the housekeeping remove the versions a newer one
replaced (see services::retention::purge_superseded_versions).
§Invariants
- Permission: the file is visible to the actor (“not found” otherwise),
its revision is checked out by the actor (409 otherwise) and editable
(
revisions::ensure_editable: in work, CAD editor of its group). - Locks: the revision row (
revisions::lock) and the file row (FOR UPDATE). - Audit:
file.retention, only when the setting actually changes. - Data: nothing is removed here; the removal is the housekeeping’s.
- Notifications / webhooks: none.
- Atomic: one transaction.