Appearance
Entity: responsiblePersonAssignment
Entity Type: Database table
Description: Assigns a user as responsible for a building. Drives the recipient list for notifications and actions raised against a building or one of its gauges. Replaces the EM2 pattern of implicitly inferring "the responsible user" from the first ROLE_WORKER-assigned user found.
Cardinality: many-to-many — a building may have several responsible users. This intentionally supports the case observed in EM2 staging data where the majority of buildings (60%) have more than one plausible responsible user; instead of picking one implicitly, EM3 assigns explicitly and notifies all of them.
Data Attributes Table
| Attribute Name | Description | Data Type | Default Value | Required (= Nullable) | Unique | Format | Validations | Index | Example |
|---|---|---|---|---|---|---|---|---|---|
| id | Primary key of the entity. | UUID | Generated in code (app layer) | Yes | Yes | UUID v7 | - | Primary Key | 018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2 |
| tenantId | Tenant this record belongs to. | UUID | - | Yes | No | UUID v7 | Foreign Key → tenant; must exist | - | 018fa51f-fda1-79f4-8461-2cb8f1cabc10 |
| buildingId | The building this assignment applies to. | UUID | - | Yes | No | UUID v7 | Foreign Key → building; must exist | - | 018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2 |
| userId | The user assigned as responsible. Must already be assigned to the building (existing User↔Building relationship) — this entity does not itself grant building access, only marks responsibility among already-assigned users. | UUID | - | Yes | No | UUID v7 | No database foreign key exists; enforced only at the application layer via the building-access directory (a platform-scoped table outside this schema and outside RLS). | - | 018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2 |
| createdAt | Timestamp of entity creation. Is immutable. | Timestamp with time zone | now() | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | - | - | 2026-01-15T09:00:00Z |
| updatedAt | Timestamp of last entity update. Mutable. | Timestamp with time zone | now() | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | - | - | 2026-01-15T09:00:00Z |
| deletedAt | Timestamp of entity soft delete. Once set, immutable. | Timestamp with time zone | - | No | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Immutable once set. Active records: WHERE deletedAt IS NULL | - | null |
| createdBy | Identifier of the author who created this record. | String | - | Yes | No | type:actor | - | - | user:c2d3f586-1c9a-4f5f-b9ae-45f2c4f69f7e |
| updatedBy | Identifier of the author who last updated this record. | String | - | Yes | No | type:actor | - | - | user:c2d3f586-1c9a-4f5f-b9ae-45f2c4f69f7e |
Audited fields
Recorded on created (in full) and deleted (in full) — this entity has no update path, so no field of an existing assignment ever changes: buildingId, userId.
Excluded: none.
Every entry carries subjectEntityType = building / subjectEntityId = buildingId — it does not self-subject. userId (the person assigned) is never the audit actor — the actor (createdBy) is whoever performed the assign/remove call, a distinct identity that only incidentally may coincide with userId.
Correction: userId previously claimed an enforced foreign key to user; no such database constraint exists — corrected above.
Not registered for entityName resolution — a join row (buildingId × userId), not a named record of its own.