251206:1710 specs: frontend plan P1,P3 wait Verification
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// File: src/common/auth/auth.module.ts
|
||||
// บันทึกการแก้ไข: แก้ไข Type Mismatch ของ expiresIn (Fix TS2322)
|
||||
// [P0-1] เพิ่ม CASL RBAC Integration
|
||||
// [P2-2] Register RefreshToken Entity
|
||||
|
||||
import { Module } from '@nestjs/common';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
@@ -13,18 +14,19 @@ import { UserModule } from '../../modules/user/user.module.js';
|
||||
import { JwtStrategy } from './strategies/jwt.strategy.js';
|
||||
import { JwtRefreshStrategy } from './strategies/jwt-refresh.strategy.js';
|
||||
import { User } from '../../modules/user/entities/user.entity';
|
||||
import { CaslModule } from './casl/casl.module'; // [P0-1] Import CASL
|
||||
import { PermissionsGuard } from './guards/permissions.guard'; // [P0-1] Import Guard
|
||||
import { RefreshToken } from './entities/refresh-token.entity'; // [P2-2]
|
||||
import { CaslModule } from './casl/casl.module';
|
||||
import { PermissionsGuard } from './guards/permissions.guard';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([User]),
|
||||
TypeOrmModule.forFeature([User, RefreshToken]), // [P2-2] Added RefreshToken
|
||||
UserModule,
|
||||
PassportModule,
|
||||
JwtModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
inject: [ConfigService],
|
||||
useFactory: async (configService: ConfigService) => ({
|
||||
useFactory: (configService: ConfigService) => ({
|
||||
secret: configService.get<string>('JWT_SECRET'),
|
||||
signOptions: {
|
||||
expiresIn: (configService.get<string>('JWT_EXPIRATION') ||
|
||||
@@ -32,18 +34,10 @@ import { PermissionsGuard } from './guards/permissions.guard'; // [P0-1] Import
|
||||
},
|
||||
}),
|
||||
}),
|
||||
CaslModule, // [P0-1] Import CASL module
|
||||
],
|
||||
providers: [
|
||||
AuthService,
|
||||
JwtStrategy,
|
||||
JwtRefreshStrategy,
|
||||
PermissionsGuard, // [P0-1] Register PermissionsGuard
|
||||
CaslModule,
|
||||
],
|
||||
providers: [AuthService, JwtStrategy, JwtRefreshStrategy, PermissionsGuard],
|
||||
controllers: [AuthController],
|
||||
exports: [
|
||||
AuthService,
|
||||
PermissionsGuard, // [P0-1] Export for use in other modules
|
||||
],
|
||||
exports: [AuthService, PermissionsGuard],
|
||||
})
|
||||
export class AuthModule {}
|
||||
|
||||
Reference in New Issue
Block a user