Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for persisting and returning a custom action’s event title in backend table audit logs (new operation_custom_action_name field), and validates it via an end-to-end test.
Changes:
- Add
operation_custom_action_namecolumn totableLogsvia TypeORM migration and entity/DTO updates. - Populate
operation_custom_action_namewhen activating CUSTOM table actions. - Add AVA e2e coverage asserting the field is present in
/logsresponses.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/test/ava-tests/saas-tests/action-rules-e2e.test.ts | Adds an e2e test that activates a CUSTOM action and asserts the log includes operation_custom_action_name. |
| backend/src/migrations/1770626855789-AddOperationCustomActionNameToTableLogsEntity.ts | Introduces DB migration adding the new log column. |
| backend/src/entities/table-logs/utils/build-table-logs-entity.ts | Maps operation_custom_action_name from log DS into the entity before save. |
| backend/src/entities/table-logs/utils/build-found-log-record-ds.ts | Exposes operation_custom_action_name in the returned log record DS. |
| backend/src/entities/table-logs/table-logs.service.ts | Minor signature formatting change in bulk logging helper. |
| backend/src/entities/table-logs/table-logs.entity.ts | Adds the new column to the TableLogsEntity. |
| backend/src/entities/table-logs/application/data-structures/found-logs.ds.ts | Adds operation_custom_action_name to the logs API contract. |
| backend/src/entities/table-logs/application/data-structures/create-log-record.ds.ts | Extends log creation DS with operation_custom_action_name. |
| backend/src/entities/table-actions/table-action-rules-module/use-cases/activate-actions-in-rule.use.case.ts | Sets operation_custom_action_name during action activation logging. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| createdAt: createdAt, | ||
| connection_id: connection_id.id, | ||
| affected_primary_key: affected_primary_key, | ||
| operation_custom_action_name: log.operation_custom_action_name || null, |
There was a problem hiding this comment.
operation_custom_action_name: log.operation_custom_action_name || null will coerce empty strings to null. If an event title can be an empty string, this will lose data; prefer using nullish coalescing (?? null) so only undefined/null become null.
| operation_custom_action_name: log.operation_custom_action_name || null, | |
| operation_custom_action_name: log.operation_custom_action_name ?? null, |
| operationStatusResult: operationResult, | ||
| row: primaryKey, | ||
| old_data: null, | ||
| table_primary_key: primaryKey, |
There was a problem hiding this comment.
This log record uses table_primary_key, but CreateLogRecordDs/TableLogsEntity persist the primary key under affected_primary_key. As written, action activation logs will have affected_primary_key unset, and the extra table_primary_key field is ignored. Pass the primary key via affected_primary_key here (and consider removing table_primary_key if it's not used anywhere).
| table_primary_key: primaryKey, | |
| affected_primary_key: primaryKey, |
| public async up(queryRunner: QueryRunner): Promise<void> { | ||
| await queryRunner.query(`ALTER TABLE "tableLogs" ADD "operation_custom_action_name" character varying`); | ||
| } |
There was a problem hiding this comment.
The new column is added without an explicit DEFAULT null, while the entity metadata uses @Column({ default: null }). Consider adding DEFAULT null in the migration to keep the schema consistent with the entity definition and avoid future schema drift/migration diffs.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.