fix: revert AdminAuditService to PrismaService — queue not available in auth module
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 41s
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 41s
This commit is contained in:
parent
b5d5fb357f
commit
7a31bd3702
@ -1,5 +1,5 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { QueueService } from '../../infrastructure/queue/queue.service';
|
import { PrismaService } from '../../infrastructure/database/prisma.service';
|
||||||
|
|
||||||
export interface AuditLogInput {
|
export interface AuditLogInput {
|
||||||
adminUserId: string;
|
adminUserId: string;
|
||||||
@ -16,11 +16,11 @@ export interface AuditLogInput {
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AdminAuditService {
|
export class AdminAuditService {
|
||||||
constructor(private readonly queue: QueueService) {}
|
constructor(private readonly prisma: PrismaService) {}
|
||||||
|
|
||||||
/** Async audit log via BullMQ — never blocks the main operation */
|
|
||||||
async log(input: AuditLogInput) {
|
async log(input: AuditLogInput) {
|
||||||
await this.queue.add('audit-logs', {
|
await this.prisma.adminAuditLog.create({
|
||||||
|
data: {
|
||||||
adminUserId: input.adminUserId,
|
adminUserId: input.adminUserId,
|
||||||
action: input.action,
|
action: input.action,
|
||||||
resourceType: input.resourceType ?? null,
|
resourceType: input.resourceType ?? null,
|
||||||
@ -31,6 +31,7 @@ export class AdminAuditService {
|
|||||||
userAgent: input.userAgent ?? null,
|
userAgent: input.userAgent ?? null,
|
||||||
riskLevel: input.riskLevel ?? this.defaultRisk(input.action),
|
riskLevel: input.riskLevel ?? this.defaultRisk(input.action),
|
||||||
reason: input.reason ?? null,
|
reason: input.reason ?? null,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user