Coflyr · Backend model field catalog
AuditLogEntry
Audit.AuditLogEntries.
26 mapped fields · 3 proposed fields7 field groupsGenerated 2026-10-06
This page records the original 26-field review and the implemented decisions. Removed rows remain visible for traceability; the current AuditLogEntry model has 22 mapped scalar fields. Current audit records are queried directly from AuditLogEntries.
Identity and naming
2 fields| # | Field | EF type | Storage | Business purpose | Review |
|---|---|---|---|---|---|
| 1 | Id | Guid | Required | Stable identifier for this record. | Keep |
| 2 | SequenceNumber | int | Required | Records sequence number for this audit log entry. | Keep |
Relationships and references
6 fields| # | Field | EF type | Storage | Business purpose | Review |
|---|---|---|---|---|---|
| 1 | CorrelationId | string | Nullable | Stores the HTTP request trace identifier that produced this audit entry. Entries written during one request can share this value for investigation; it is not a foreign key to a correlation record. | Keep |
| 2 | EntityId | Guid | Required | Identifies the record this audit entry describes. Use it with EntityType to retrieve that record’s audit history; it is not a foreign key to one fixed table. For example, all audit entries for a work order share that work order’s EntityId. | Keep |
| 3 | PreviousEntryId | Guid? | Nullable | Points to the preceding field-change audit entry for the same entity, creating an explicit change-entry chain. The writer already finds that preceding change using EntityType, EntityId, EntryKind and descending SequenceNumber. Whether the stored pointer adds enough value to keep it is under review; UpdateId separately links formal business-record revisions. | Under review |
| 4 | RecordedByUserId | Guid? | Nullable | Selects the related recorded by user record. | Reviewed |
| 5 | SentToDepartmentId | Guid? | Nullable | Selects the related sent to department record. | Reviewed |
| 6 | SentToUserId | Guid? | Nullable | Selects the related sent to user record. | Reviewed |
Status and controls
4 mapped · 1 proposed| # | Field | EF type | Storage | Business purpose | Review |
|---|---|---|---|---|---|
| 1 | RecordStatus (rename from BusinessStatus) | Status? enumCurrent EF: string NoneActiveInactiveDeletedUpdated | Nullable | Captures the record status at the time of this audit entry. Proposed stored names: None, Active, Inactive, Deleted, Updated. Use Inactive for both retired records and temporary holds; Suspended is merged into Inactive in this proposal. Use Deleted for a withdrawn record. Archived is proposed for removal from the shared RecordStatus choices; existing Archived and Suspended values need a reviewed mapping to Inactive before any migration. Null means this entry does not carry a business status. The database now stores the enum name as a string. | Applied: string-backed enum · Applied |
| 2 | ApprovalStatus (rename from DocumentStatus) | ApprovalStatus?Current enum CreatedApprovedModifiedValidatedReleasedRejectedReturnForCorrectionForwarded | Nullable | Captures the approval workflow status at the time of this audit entry. Enum values are listed under EF type; Deactivated has been removed. Source: shared/audit/viewmodels/AuditViewModel.java, approvalStatuses; the FE currently labels this dropdown “Approval Status”. Rename the current DocumentStatus field to ApprovalStatus in the proposed model. Reconcile this with the existing RelatedAuditStatus field before backend work so approval state is not duplicated. Backend and database now use ApprovalStatus as a string-backed enum. | Applied: enum · Applied |
| 3 | Hash | string | Nullable | For a field-change entry, stores the hexadecimal SHA-256 digest of SnapshotJson followed by ChangeSetJson. It can be recomputed to detect whether that stored payload changed. It is null on entries without a field-change payload. The current code writes the hash but does not verify it on read; this is not a digital signature or a hash chain. Recommendation: remove this field unless a complete verification and trusted anchoring design is introduced. | Dropped · Applied |
| 4 | PreApproved | bool | Required | Indicates whether pre approved applies to this audit log entry. | Keep |
| 5 | IsUpdated | bool | Required; default No | Flag indicating that this audit entry records an update to an existing record. Review whether it is needed separately: EntryKind = Change already identifies field-change entries, while RecordStatus = Updated is a proposed status value. The audit writer sets it for update actions and field-change entries. | Added · Applied |
Dates and timing
2 mapped · 2 proposed| # | Field | EF type | Storage | Business purpose | Review |
|---|---|---|---|---|---|
| 1 | EffectiveDate | DateTime? | Nullable | Records the effective date for this audit log entry. | Keep |
| 2 | ReceivingDate | DateTime? | Nullable | Snapshots the business record’s receiving date at this audit event, when that date applies. For example, a received maintenance document may carry the date it was received. It is separate from RecordedAt, which timestamps when the audit entry was written. The generic audit model does not enforce what “received” means for each entity type. Reviewed decision: remove this generic audit field; retain receiving dates only in the business records that need them. | Drop · Applied |
| 3 | ValidFrom | DateTime? | Nullable | Snapshot of the start of the audited record’s validity period at this event. The current audit state already has ValidFrom; this would preserve its value in the append-only history. | Added · Applied |
| 4 | ValidUpTo | DateTime? | Nullable | Snapshot of the end of the audited record’s validity period at this event. The current audit state calls this value ValidTo; the writer maps the business record’s ValidTo into this field. | Added · Applied |
Descriptions and details
2 fields| # | Field | EF type | Storage | Business purpose | Review |
|---|---|---|---|---|---|
| 1 | ChangeReason | string | Nullable | Merge any existing reason text into the common AuditText field when migrating historical entries. A separate reason column is not proposed. | Drop; merge into AuditText · Applied |
| 2 | AuditText (rename from EntryText) | string | Required | One common human-readable text field for audit, change, and remark entries. It can describe what happened and include the reason where supplied; EntryKind and structured change fields still identify the event type and exact field differences. | Keep; rename to AuditText · Applied |
Audit and revision
1 fields| # | Field | EF type | Storage | Business purpose | Review |
|---|---|---|---|---|---|
| 1 | RelatedAuditStatus | AuditEventStatus? enumCurrent EF: integer | Nullable | Snapshots the audited record’s approval/audit workflow status at the time this entry is written. Coflyr copies it from AuditableEntity.AuditStatus for audit actions and from the remark’s AuditStatus for remark entries. Example: an approval event stores Approved. Reviewed decision: remove this duplicate field. Migrate any status history needed into the proposed ApprovalStatus field before dropping the column. | Drop · Applied |
Other fields
9 fields| # | Field | EF type | Storage | Business purpose | Review |
|---|---|---|---|---|---|
| 1 | ChangeSetJson | string | Nullable | Records change set json for this audit log entry. | Keep |
| 2 | EntityType | string | Required | Identifies which mapped entity table owns the audited record, using the schema.table name. Together with EntityId it identifies the record whose history this is. | Keep |
| 3 | EntryKind | int | Required | Classifies what kind of history row this is: Audit (1), Change (2), Remark (3), or Revision (4). For example, a field edit uses Change; a user note uses Remark. It distinguishes audit, change, remark, and revision entries. | Keep |
| 4 | RecordedAt | DateTime | Required | Records the recorded at for this audit log entry. | Keep |
| 5 | RecordedBy | string | Nullable | Records recorded by for this audit log entry. | Keep |
| 6 | ReleaseState | int? | Nullable | Currently snapshots the audited record’s release state. Reviewed decision: remove this audit-log field; preserve any required release history through the remaining audit design before migration. | Drop · Applied |
| 7 | SnapshotJson | string | Nullable | Records snapshot json for this audit log entry. | Keep |
| 8 | SourceApn | int? | Nullable | Records source apn for this audit log entry. | Keep |
| 9 | SourceFormCode | string | Nullable | Records source form code for this audit log entry. | Keep |