2025-09-04 21:04:15 -04:00
|
|
|
import { Module } from '@nestjs/common';
|
|
|
|
|
import { UserService } from './user.service';
|
|
|
|
|
import { UserController } from './user.controller';
|
2025-09-09 21:19:17 -04:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2025-09-24 11:00:56 -06:00
|
|
|
import { Perfil, User } from './entities/user.entity';
|
2025-09-12 13:18:11 -04:00
|
|
|
import { ConfigService } from '@nestjs/config';
|
2025-09-10 21:03:33 -04:00
|
|
|
import { JwtModule } from '@nestjs/jwt';
|
2025-09-12 13:18:11 -04:00
|
|
|
import { PassportModule } from '@nestjs/passport';
|
|
|
|
|
import { JwtStrategy } from './jwt.strategy';
|
2025-09-04 21:04:15 -04:00
|
|
|
|
|
|
|
|
@Module({
|
2025-09-10 21:03:33 -04:00
|
|
|
imports: [
|
2025-09-24 11:00:56 -06:00
|
|
|
TypeOrmModule.forFeature([User, Perfil]),
|
2025-09-12 13:18:11 -04:00
|
|
|
PassportModule.register({ defaultStrategy: 'jwt' }),
|
2025-09-10 21:03:33 -04:00
|
|
|
JwtModule.registerAsync({
|
|
|
|
|
inject: [ConfigService],
|
|
|
|
|
useFactory: async (configService: ConfigService) => {
|
|
|
|
|
return {
|
|
|
|
|
global: true,
|
|
|
|
|
secret: configService.get('JWT_SECRET'),
|
|
|
|
|
signOptions: { expiresIn: '1h' },
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
}),
|
2025-09-09 21:19:17 -04:00
|
|
|
],
|
2025-09-04 21:04:15 -04:00
|
|
|
controllers: [UserController],
|
2025-09-19 17:15:05 -06:00
|
|
|
providers: [UserService, JwtStrategy],
|
2025-09-24 11:00:56 -06:00
|
|
|
exports: [UserService, PassportModule, JwtModule],
|
2025-09-04 21:04:15 -04:00
|
|
|
})
|
2025-09-19 17:15:05 -06:00
|
|
|
export class UserModule {}
|