Skip to content
Updated Sep 26, 2026 by Barča Dvořáková · Owner: analysisactiveentityconfluence-migration Edit on GitHub

Entity: contractItem ​

Entity: contractItem

Description: A single priced line item within a contract — e.g. "high tariff rate C02d" or "vodné" (water rate). Links a contract to a contractItemType (what is being priced) and a contractItemRate (in what unit), together with the negotiated price. A contract typically has multiple contractItem rows (one per priced component).

Entity Type: database table

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary key of the entity.UUIDGenerated in code (app layer)YesYesUUID v7-Primary Key018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
tenantIdTenant this record belongs to. Denormalised from contract.tenantId for defence-in-depth query scoping.UUID-YesNoUUID v7Foreign Key: tenant; must match the tenantId of the parent contract-018fa51f-fda1-79f4-8461-2cb8f1cabc10
contractIdThe contract this priced item belongs to.UUID-YesNoUUID v7Foreign Key: contract; must exist-018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
contractItemTypeIdWhat is being priced (e.g. a specific distribution tariff rate, vodné, stočné, paušální poplatek).UUID-YesNoUUID v7Foreign Key: contractItemType; must exist. The (contractItemTypeId, contractItemRateId) pair must exist in contractItemAllowedTypeRate-018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
contractItemRateIdThe unit this price is expressed in (e.g. Kč/MWh, Kč/m³).UUID-YesNoUUID v7Foreign Key: contractItemRate; must exist-018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
priceThe negotiated unit price.decimal-YesNo2 decimal placesMust be ≥ 0-2450.00
createdAtTimestamp of entity creation. Immutable.timestamp with time zonenow()YesNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ--2026-01-15T09:00:00Z
updatedAtTimestamp of last entity update. Mutable.timestamp with time zonenow()YesNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ--2026-01-15T09:00:00Z
deletedAtTimestamp of entity soft delete. Once set, immutable.timestamp with time zone-NoNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZImmutable once set. Active records: WHERE deletedAt IS NULL-null
createdByIdentifier of the author who created this record.string-YesNotype:actor--user:c2d3f586-1c9a-4f5f-b9ae-45f2c4f69f7e
updatedByIdentifier of the author who last updated this record.string-YesNotype:actor--system:contract-backfill-v1

Note — indexing. No secondary indexes beyond the primary key are defined. At current scale (~90 tenants, ~15,000 gauges, a contract typically has a handful of line items) a sequential scan filtered by tenantId/contractId/contractItemTypeId/contractItemRateId is not a performance concern. Revisit if data volume or query patterns change materially.

Audited fields ​

Recorded on created (in full), updated (changed only) and deleted (in full): contractId, price, contractItemTypeId, contractItemRateId.

Excluded: none.

No Zod validation map exists yet for this entity (its shape lives only as a repository-port type) — the recorded set above is hand-listed rather than formula-derived until one is created. Row ids are stable across a contract's saves (a payload item carrying an id updates that row; one without inserts a new row), so an item's entries share one id for its whole life. Every entry files with subjectEntityType = contract / subjectEntityId = contract.id — it does not self-subject.

Not registered for entityName resolution, and has no independent human-readable attribute to register — identified by its contractId/contractItemTypeId/contractItemRateId combination.