refactor: 实现正确的CurrentUser装饰器并修复类型问题
- 新增CurrentUser装饰器和CurrentUserData类型定义 - 替换content-moderation.controller.ts中的模拟装饰器实现 - 修复测试文件中的用户数据结构,确保包含必要的platform字段 - 修复app.module.ts中已删除控制器的引用 - 优化Swagger配置使用环境变量定义服务器地址
This commit is contained in:
parent
fe0aa0a9c5
commit
2bac851e6d
|
|
@ -28,7 +28,8 @@ BYTEDANCE_APP_SECRET=04a026867fbd1ba52174c7c21d94cbc7361ec378
|
|||
# 内容审核配置
|
||||
# 图片审核回调地址(重要:抖音审核完成后会调用此接口)
|
||||
AUDIT_CALLBACK_URL=https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com/api/v1/content-moderation/bytedance/callback
|
||||
|
||||
TEST_SERVER_URL=https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com
|
||||
PROD_SERVER_URL=https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com
|
||||
# 抖音内容审核API地址
|
||||
BYTEDANCE_AUDIT_API_URL=https://developer.toutiao.com/api/apps/v2/content/audit/image
|
||||
|
||||
|
|
|
|||
|
|
@ -48,9 +48,15 @@ export function setupSwagger(app: INestApplication): void {
|
|||
.addTag('AI模板系统', 'AI图片/视频生成模板管理')
|
||||
.addTag('积分系统', '积分获取、消耗、查询管理')
|
||||
.addTag('扩展服务', '预留的扩展功能接口')
|
||||
.addServer('http://localhost:3000', '开发环境')
|
||||
.addServer('https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com', '测试环境')
|
||||
.addServer('https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com', '生产环境')
|
||||
.addServer(`http://localhost:${process.env.PORT || 3003}`, '开发环境')
|
||||
.addServer(
|
||||
process.env.TEST_SERVER_URL || 'https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com',
|
||||
'测试环境',
|
||||
)
|
||||
.addServer(
|
||||
process.env.PROD_SERVER_URL || 'https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com',
|
||||
'生产环境',
|
||||
)
|
||||
.build();
|
||||
|
||||
const document = SwaggerModule.createDocument(app as any, config, {
|
||||
|
|
|
|||
|
|
@ -22,9 +22,7 @@ import {
|
|||
} from '../dto/audit-response.dto';
|
||||
import { PlatformAuthGuard } from '../../platform/guards/platform-auth.guard';
|
||||
import { PlatformType } from '../../entities/platform-user.entity';
|
||||
import {
|
||||
ResponseUtil,
|
||||
} from '../../utils/response.util';
|
||||
import { ResponseUtil } from '../../utils/response.util';
|
||||
import { CurrentUser } from '../../decorators/current-user.decorator';
|
||||
import type { CurrentUserData } from '../../decorators/current-user.decorator';
|
||||
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ export const CurrentUser = createParamDecorator(
|
|||
const request = ctx.switchToHttp().getRequest();
|
||||
return request.user;
|
||||
},
|
||||
);
|
||||
);
|
||||
|
|
|
|||
|
|
@ -58,8 +58,16 @@ async function generateSwaggerJson() {
|
|||
.addTag('积分系统', '积分获取、消耗、查询管理')
|
||||
.addTag('扩展服务', '预留的扩展功能接口')
|
||||
.addServer(`http://localhost:${process.env.PORT || 3003}`, '开发环境')
|
||||
.addServer(process.env.TEST_SERVER_URL || 'https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com', '测试环境')
|
||||
.addServer(process.env.PROD_SERVER_URL || 'https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com', '生产环境')
|
||||
.addServer(
|
||||
process.env.TEST_SERVER_URL ||
|
||||
'https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com',
|
||||
'测试环境',
|
||||
)
|
||||
.addServer(
|
||||
process.env.PROD_SERVER_URL ||
|
||||
'https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com',
|
||||
'生产环境',
|
||||
)
|
||||
.build();
|
||||
|
||||
const document = SwaggerModule.createDocument(app as any, config);
|
||||
|
|
|
|||
Loading…
Reference in New Issue