fix: 统一执行进度查询接口响应格式
- 更新 getExecutionProgress 方法使用 ResponseUtil 统一响应格式 - 添加 Promise<ApiResponse<any>> 返回类型声明 - 保持原有功能逻辑,优化响应消息提示 - 确保与项目其他接口响应格式一致
This commit is contained in:
parent
6622488a74
commit
d2acf1b702
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue