feat(rbac): add RbacModule and RbacService with seed data and role CRUD

This commit is contained in:
2026-07-02 11:22:48 +08:00
parent cd8248ad6c
commit 23e96dcfbd
2 changed files with 286 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
import { Module, OnModuleInit, forwardRef } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Permission, Role, User } from '../entities';
import { RbacService } from './rbac.service';
import { AuthModule } from '../auth/auth.module';
@Module({
imports: [
TypeOrmModule.forFeature([Permission, Role, User]),
forwardRef(() => AuthModule),
],
controllers: [],
providers: [RbacService],
exports: [RbacService],
})
export class RbacModule implements OnModuleInit {
constructor(private rbacService: RbacService) {}
async onModuleInit() {
await this.rbacService.seedData();
}
}