feat: bootstrap from Fabric monorepo

This commit is contained in:
nav
2026-05-13 07:06:02 +00:00
commit 03a3342d2a
40 changed files with 7210 additions and 0 deletions

12
src/audit/audit.module.ts Normal file
View File

@@ -0,0 +1,12 @@
import { Global, Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AuditLog } from '../entities/audit-log.entity';
import { AuditService } from './audit.service';
@Global()
@Module({
imports: [TypeOrmModule.forFeature([AuditLog])],
providers: [AuditService],
exports: [AuditService],
})
export class AuditModule {}

View File

@@ -0,0 +1,31 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { AuditLog } from '../entities/audit-log.entity';
export type AuditWriteInput = {
action: string;
actorId?: string | null;
targetType?: string | null;
targetId?: string | null;
detail?: string | null;
};
@Injectable()
export class AuditService {
constructor(
@InjectRepository(AuditLog)
private readonly auditRepo: Repository<AuditLog>,
) {}
async write(input: AuditWriteInput): Promise<void> {
const row = this.auditRepo.create({
action: input.action,
actorId: input.actorId ?? null,
targetType: input.targetType ?? null,
targetId: input.targetId ?? null,
detail: input.detail ?? null,
});
await this.auditRepo.save(row);
}
}