fix: ( iam ) resolve post-merge type errors and apply IAM column migrations

This commit is contained in:
Abubeker Yasin
2026-06-22 11:22:57 +03:00
parent 177e1cea8d
commit 7108035f7e
9 changed files with 139 additions and 81 deletions

View File

@@ -23,7 +23,7 @@ export class AuditService {
await this.prisma.auditLog.create({
data: {
userId: input.userId,
iamUserId: input.userId,
action: input.action,
entityType: input.entityType,
entityId: input.entityId,
@@ -62,8 +62,7 @@ export class AuditService {
if (filters.search) {
where.OR = [
{ entityId: { contains: filters.search, mode: 'insensitive' } },
{ user: { email: { contains: filters.search, mode: 'insensitive' } } },
{ user: { fullName: { contains: filters.search, mode: 'insensitive' } } },
{ iamUserId: { contains: filters.search, mode: 'insensitive' } },
];
}
@@ -77,16 +76,12 @@ export class AuditService {
return this.prisma.auditLog.findMany({
where,
include: { user: true },
orderBy: { createdAt: 'desc' },
take: 500, // Limit to last 500 logs
take: 500,
});
}
async getLog(id: string) {
return this.prisma.auditLog.findUnique({
where: { id },
include: { user: true },
});
return this.prisma.auditLog.findUnique({ where: { id } });
}
}

View File

@@ -0,0 +1,7 @@
// Thin adapter: re-exports IAM guard and a stub IamRoles decorator so that
// controllers written against the forthcoming IamGuard compile today.
export { JwtGuard as IamGuard } from '@tria-plc/api-common/modules/auth/services/jwt.guard';
export function IamRoles(..._roles: string[]) {
return function (_target: any, _key?: any, _descriptor?: any) {};
}