Skip to content
CodamAI

Files as part of the data model

Attachments, logos or contracts belong to a record – with the same permissions, the same tenant isolation and the same history as all other data.

Record and content, one object

A file model is a model with exactly one file attached. Name, size, file type and your own fields – such as title or category – are stored as a record in the database, the content sits in file storage. To clients both are one object: they read and search the record like any other and fetch the content through a dedicated action.

File models can stand alone or hang off another model, such as the attachments of a case file. One request can carry several files, including for objects created as nested children – a job with many photos is saved completely or not at all.

Permissions and tenant isolation

Downloading requires the right to read the record plus the permission to download. In storage every tenant has its own directory, and no part of the storage path comes from user input. A request therefore cannot reach other tenants’ content, neither through the database nor through storage.

Downloads also work through plain links in the browser, and neither browsers nor intermediate caches store the file. Data Management derives the file type from the file extension. Renaming only changes the record – the content stays where it is.

In step with the database

Changes to content are only prepared during the request and take effect once the database has saved. If a request fails, storage stays as it was: new content does not become current, deleted content remains. Data Management detects two simultaneous uploads to the same record and rejects the second. An aborted upload is never left half-written in storage.

Versions and deletion

For audited file models every earlier content is kept as a version, and every revision of the record knows which content belongs to it. Rolling back restores record and content together and first keeps the current content as a version. Nothing gets lost.

When a file record is deleted, its content goes with it, including all versions – whether deleted directly or as a dependent part of another object. Deletion therefore covers the stored content as well, which matters for documents containing personal data.

What this means day to day

Files follow the same rules as the data they belong to.

  • No separate document system with its own permission management for attachments.
  • Provable versions of contracts or inspection reports when the model is audited.
  • No orphaned or half-written files after an aborted request.

Does CodamAI fit your engineering setup?

The most honest way to find out is a technical conversation: about your stack, your delivery and the requirements you have to evidence.