diff --git a/src/app.controller.ts b/src/app.controller.ts index 965e111..7763001 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -9,7 +9,7 @@ export class AppController { constructor( @InjectRepository(TemplateExecutionEntity) private readonly executionRepository: Repository, - ) {} + ) { } @Post('callback') async callback(@Body() body: any): Promise> { console.log(`πŸš€ [ε›žθ°ƒ] εΌ€ε§‹ζ‰§θ‘Œε›žθ°ƒ`); @@ -19,8 +19,8 @@ export class AppController { const res = body.data; // {status: true, data: string[], task_id: string} let resultUrl = `` - if (res.status) { - const data = res.data; + if (body.status) { + const data = body.data; if (!data) throw new Error(`η»“ζžœζœ‰θ――`); if (Array.isArray(data) && data.length > 0) { resultUrl = data[0]; @@ -40,8 +40,8 @@ export class AppController { // ζ›΄ζ–°ζ‰§θ‘ŒηŠΆζ€ const updateData: Partial = { completedAt: new Date(), - executionDuration: execution.startedAt - ? Date.now() - execution.startedAt.getTime() + executionDuration: execution.startedAt + ? Date.now() - execution.startedAt.getTime() : undefined, }; @@ -59,7 +59,7 @@ export class AppController { } await this.executionRepository.update(execution.id, updateData); - + return ResponseUtil.success(resultUrl, 'ε›žθ°ƒε€„η†ζˆεŠŸ'); } }