34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
|
|
import { Module } from '@nestjs/common';
|
||
|
|
import { JwtModule } from '@nestjs/jwt';
|
||
|
|
import { PassportModule } from '@nestjs/passport';
|
||
|
|
import { ConfigService } from '@nestjs/config';
|
||
|
|
import { AuthService } from './auth.service';
|
||
|
|
import { AuthController } from './auth.controller';
|
||
|
|
import { AuthAdminController } from './auth-admin.controller';
|
||
|
|
import { UsersModule } from '../users/users.module';
|
||
|
|
import { MappingsModule } from '../mappings/mappings.module';
|
||
|
|
import { VendorsModule } from '../vendors/vendors.module';
|
||
|
|
import { JwtStrategy } from './strategies/jwt.strategy';
|
||
|
|
import { LocalStrategy } from './strategies/local.strategy';
|
||
|
|
import { TokenBlacklistService } from './services/token-blacklist.service';
|
||
|
|
|
||
|
|
@Module({
|
||
|
|
imports: [
|
||
|
|
PassportModule,
|
||
|
|
JwtModule.registerAsync({
|
||
|
|
useFactory: (configService: ConfigService) => ({
|
||
|
|
secret: configService.get('JWT_SECRET'),
|
||
|
|
signOptions: { expiresIn: configService.get('JWT_EXPIRES_IN', '7d') },
|
||
|
|
}),
|
||
|
|
inject: [ConfigService],
|
||
|
|
}),
|
||
|
|
UsersModule,
|
||
|
|
MappingsModule,
|
||
|
|
VendorsModule,
|
||
|
|
],
|
||
|
|
controllers: [AuthController, AuthAdminController],
|
||
|
|
providers: [AuthService, JwtStrategy, LocalStrategy, TokenBlacklistService],
|
||
|
|
exports: [AuthService],
|
||
|
|
})
|
||
|
|
export class AuthModule {}
|