- Introduced `BootstrapService` to handle admin creation when no admins exist. - Added `/auth/bootstrap-admin` endpoint to consume bootstrap tokens. - Updated `RbacRepository` to support counting admins and assigning roles. - Included unit tests for `BootstrapService` to ensure token behavior and admin assignment.
35 lines
977 B
TypeScript
35 lines
977 B
TypeScript
import { forwardRef, Module } from "@nestjs/common";
|
|
import { SessionsModule } from "../sessions/sessions.module";
|
|
import { UsersModule } from "../users/users.module";
|
|
import { AuthController } from "./auth.controller";
|
|
import { AuthService } from "./auth.service";
|
|
import { BootstrapService } from "./bootstrap.service";
|
|
import { AuthGuard } from "./guards/auth.guard";
|
|
import { OptionalAuthGuard } from "./guards/optional-auth.guard";
|
|
import { RolesGuard } from "./guards/roles.guard";
|
|
import { RbacService } from "./rbac.service";
|
|
import { RbacRepository } from "./repositories/rbac.repository";
|
|
|
|
@Module({
|
|
imports: [forwardRef(() => UsersModule), SessionsModule],
|
|
controllers: [AuthController],
|
|
providers: [
|
|
AuthService,
|
|
RbacService,
|
|
BootstrapService,
|
|
RbacRepository,
|
|
AuthGuard,
|
|
OptionalAuthGuard,
|
|
RolesGuard,
|
|
],
|
|
exports: [
|
|
AuthService,
|
|
RbacService,
|
|
RbacRepository,
|
|
AuthGuard,
|
|
OptionalAuthGuard,
|
|
RolesGuard,
|
|
],
|
|
})
|
|
export class AuthModule {}
|