From ed836223565fba3df191c486b8e0746e36ad570c Mon Sep 17 00:00:00 2001 From: Sunny Tyagi <107617248+Tyagi-Sunny@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:19:38 +0530 Subject: [PATCH] feat(chore): provision to get tenant wise logs (#102) Provision to get tenant wise logs BREAKING CHANGE: Provision to get tenant wise logs 101 --- src/__tests__/acceptance/fixtures/models/audit.model.ts | 7 +++++++ src/mixins/audit.mixin.ts | 1 + src/models/audit-log.model.ts | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/src/__tests__/acceptance/fixtures/models/audit.model.ts b/src/__tests__/acceptance/fixtures/models/audit.model.ts index 8317d3f..569e663 100644 --- a/src/__tests__/acceptance/fixtures/models/audit.model.ts +++ b/src/__tests__/acceptance/fixtures/models/audit.model.ts @@ -54,6 +54,13 @@ export class TestAuditLog extends Entity { }) actor: string; + @property({ + name: 'tenant_id', + type: 'string', + required: true, + }) + tenantId: string; + @property({ type: 'object', }) diff --git a/src/mixins/audit.mixin.ts b/src/mixins/audit.mixin.ts index ca607dc..df009b2 100644 --- a/src/mixins/audit.mixin.ts +++ b/src/mixins/audit.mixin.ts @@ -59,6 +59,7 @@ export function AuditRepositoryMixin< entityId: entity.getId(), actedOn: this.entityClass.modelName, actionKey: opts.actionKey, + tenantId: user.tenantId, ...extras, }); } diff --git a/src/models/audit-log.model.ts b/src/models/audit-log.model.ts index b83d720..0582a00 100644 --- a/src/models/audit-log.model.ts +++ b/src/models/audit-log.model.ts @@ -62,6 +62,13 @@ export class AuditLog extends Entity { }) actor: string; + @property({ + name: 'tenant_id', + type: 'string', + required: true, + }) + tenantId: string; + @property({ type: 'object', })