API · v1 · stable
CODEMETA OSDeveloper Center
EN
Open console
Concept

Entity system

Reading time · 6 minUpdated · 1 May 2026

Codemeta OS has a generic entity layer through which every CRUD mutation passes. This gives you uniform behavior – whether you create a ticket, a contract or a knowledge article.

Three components per entity

  1. Schema defines fields, types and required fields.
  2. Configuration links schema, permissions, protected fields and supported data scopes.
  3. Relationship model describes who may see which record — relationship-based (owner, team, tenant).

A uniform service layer reads the configuration and gives all entities the same behavior.

What happens on a mutation?

In a single database transaction:

  1. Generate a UUIDv7, set version, take tenantId from the header.
  2. Draw a sequence number if the entity has one (T-2026-00042 etc.).
  3. Write the data.
  4. Record the audit entry with a JSON patch.

If any of these steps fails, the entire transaction is rolled back. You will never see a record without an audit entry.

Protected fields

Some fields are controlled by the service and cannot be set directly by the caller – for example id, tenantId, version, createdAt, createdBy, deletedAt, deletedBy. If you send them in the body, they are ignored or the API responds with 422 Unprocessable Entity.

Search