import { Module } from '@nestjs/common' ; import { AuthService } from './auth.service' ; import { LocalStrategy } from './local.strategy' ; import { UsersModule } from '../users/users.module' ; import { PassportModule } from '@nestjs/passport' ; import { JwtModule } from '@nestjs/jwt' ; import { ConfigurationService } from '../../configuration/configuration.service' ; import { JwtStrategy } from './jwt.strategy' ; import { AuthController } from './auth.controller' ; import { ConfigurationModule } from '../../configuration/configuration.module' ; @ Module ( { imports : [ UsersModule , ConfigurationModule , PassportModule . register ( { defaultStrategy : 'jwt' } ) , JwtModule . registerAsync ( { imports : [ ConfigurationModule ] , inject : [ ConfigurationService ] , useFactory : ( configService ) => ( { secret : configService . get ( 'JWT_SECRET' ) , signOptions : { expiresIn : `${ configService . get ( 'JWT_EXPIRATION_TIME_SECONDS' ) }s` , } , } ) , } ) , ] , providers : [ AuthService , LocalStrategy , JwtStrategy ] , controllers : [ AuthController ] , exports : [ AuthService ] , } ) export class AuthModule { }