feat: 增加全局错误捕捉及验证

This commit is contained in:
ilhamtahir committed 2024-11-17 21:14:07 +08:00
1 parent 235ca8c4aa
commit bbf5360ef7
22 files changed
+273 -40

No files matched your search

+7 -2
View File
@@ -9,9 +9,13 @@ import { AuthGuard } from './guards/auth.guard';
import { JwtModule, JwtService } from '@nestjs/jwt';
import { AuthService } from './service/auth.service';
import { JWT_EXPIRATION, JWT_SECRET } from './constants/jwt';
import { RoleController } from './controller/role.controller';
import { RoleService } from './service/role.service';
import { Role } from './entity/role.entity';
import { Permission } from './entity/permission.entity';
@Module({
controllers: [TokenController],
controllers: [TokenController, RoleController],
imports: [
ConfigModule.forRoot({
isGlobal: true,
@@ -36,7 +40,7 @@ import { JWT_EXPIRATION, JWT_SECRET } from './constants/jwt';
}),
inject: [ConfigService],
}),
TypeOrmModule.forFeature([User]),
TypeOrmModule.forFeature([User, Role, Permission]),
JwtModule.register({
global: true,
secret: JWT_SECRET,
@@ -53,6 +57,7 @@ import { JWT_EXPIRATION, JWT_SECRET } from './constants/jwt';
UserService,
JwtService,
AuthService,
RoleService,
],
exports: [UserService],
})