fix: 统一执行进度查询接口响应格式

- 更新 getExecutionProgress 方法使用 ResponseUtil 统一响应格式
- 添加 Promise<ApiResponse<any>> 返回类型声明
- 保持原有功能逻辑,优化响应消息提示
- 确保与项目其他接口响应格式一致
This commit is contained in:
imeepos 2025-09-04 20:19:33 +08:00
parent 6622488a74
commit d2acf1b702
1 changed files with 21 additions and 24 deletions

View File

@ -432,7 +432,7 @@ export class TemplateController {
* @returns * @returns
*/ */
@Get('execution/:taskId/progress') @Get('execution/:taskId/progress')
async getExecutionProgress(@Param('taskId', ParseIntPipe) taskId: number) { async getExecutionProgress(@Param('taskId', ParseIntPipe) taskId: number): Promise<ApiResponse<any>> {
try { try {
const execution = await this.executionRepository.findOne({ const execution = await this.executionRepository.findOne({
where: { id: taskId }, where: { id: taskId },
@ -446,9 +446,7 @@ export class TemplateController {
); );
} }
return { return ResponseUtil.success({
success: true,
data: {
taskId: execution.id, taskId: execution.id,
templateId: execution.templateId, templateId: execution.templateId,
templateName: execution.template?.name, templateName: execution.template?.name,
@ -467,8 +465,7 @@ export class TemplateController {
executionDuration: execution.executionDuration, executionDuration: execution.executionDuration,
createdAt: execution.createdAt, createdAt: execution.createdAt,
updatedAt: execution.updatedAt, updatedAt: execution.updatedAt,
}, }, '获取执行进度成功');
};
} catch (error) { } catch (error) {
if (error instanceof HttpException) { if (error instanceof HttpException) {
throw error; throw error;