add auth roles and guards 050220

This commit is contained in:
2026-05-11 12:40:42 +03:30
parent 03ac02bee9
commit 3e5543a548
29 changed files with 924 additions and 30 deletions
+30
View File
@@ -0,0 +1,30 @@
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { JwtModule } from '@nestjs/jwt';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AuthOtpEntity } from '../../entities/auth-otp.entity';
import { UserEntity } from '../../entities/user.entity';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { JwtAuthGuard } from './guards/jwt-auth.guard';
import { RolesGuard } from './guards/roles.guard';
@Module({
imports: [
TypeOrmModule.forFeature([AuthOtpEntity, UserEntity]),
JwtModule.registerAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
secret: config.get<string>('JWT_SECRET') ?? 'montime-dev-secret-change-me',
signOptions: {
expiresIn: config.get<string>('JWT_EXPIRES_IN') ?? '30d',
},
}),
}),
],
controllers: [AuthController],
providers: [AuthService, JwtAuthGuard, RolesGuard],
exports: [JwtAuthGuard, RolesGuard, JwtModule],
})
export class AuthModule {}