From e76abd787cd145660fd1989d864b7b21af975d8f Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Wed, 12 Mar 2025 16:16:14 +0700 Subject: [PATCH] feat: allow user to specify true or false cancel --- src/controllers/09-line-controller.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controllers/09-line-controller.ts b/src/controllers/09-line-controller.ts index 4e4910d..019d942 100644 --- a/src/controllers/09-line-controller.ts +++ b/src/controllers/09-line-controller.ts @@ -784,7 +784,7 @@ export class LineController extends Controller { async customerRequestCancel( @Path() requestDataId: string, @Request() req: RequestWithLineUser, - @Body() body: { reason: string }, + @Body() body: { cancel: boolean; reason?: string }, ) { const result = await prisma.requestData.updateMany({ where: { @@ -803,8 +803,8 @@ export class LineController extends Controller { }, }, data: { - customerRequestCancel: true, - customerRequestCancelReason: body.reason, + customerRequestCancel: body.cancel, + customerRequestCancelReason: body.reason || "", }, }); if (result.count <= 0) throw notFoundError("Request Data"); @@ -815,7 +815,7 @@ export class LineController extends Controller { async customerRequestCancelWork( @Path() requestWorkId: string, @Request() req: RequestWithLineUser, - @Body() body: { reason: string }, + @Body() body: { cancel: boolean; reason?: string }, ) { const result = await prisma.requestWork.updateMany({ where: { @@ -836,8 +836,8 @@ export class LineController extends Controller { }, }, data: { - customerRequestCancel: true, - customerRequestCancelReason: body.reason, + customerRequestCancel: body.cancel, + customerRequestCancelReason: body.reason || "", }, }); if (result.count <= 0) throw notFoundError("Request Data");