feat: allow user to specify true or false cancel
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 5s

This commit is contained in:
Methapon2001 2025-03-12 16:16:14 +07:00
parent cfe820b89f
commit e76abd787c

View file

@ -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");