Files
api-AT/src/user/user.module.ts
T

31 lines
1003 B
TypeScript
Raw Normal View History

2025-09-04 21:04:15 -04:00
import { Module } from '@nestjs/common';
import { UserService } from './user.service';
import { UserController } from './user.controller';
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'),
2026-02-23 12:47:57 -06:00
signOptions: { expiresIn: '7h' },
2025-09-10 21:03:33 -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 {}