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( async customerRequestCancel(
@Path() requestDataId: string, @Path() requestDataId: string,
@Request() req: RequestWithLineUser, @Request() req: RequestWithLineUser,
@Body() body: { reason: string }, @Body() body: { cancel: boolean; reason?: string },
) { ) {
const result = await prisma.requestData.updateMany({ const result = await prisma.requestData.updateMany({
where: { where: {
@ -803,8 +803,8 @@ export class LineController extends Controller {
}, },
}, },
data: { data: {
customerRequestCancel: true, customerRequestCancel: body.cancel,
customerRequestCancelReason: body.reason, customerRequestCancelReason: body.reason || "",
}, },
}); });
if (result.count <= 0) throw notFoundError("Request Data"); if (result.count <= 0) throw notFoundError("Request Data");
@ -815,7 +815,7 @@ export class LineController extends Controller {
async customerRequestCancelWork( async customerRequestCancelWork(
@Path() requestWorkId: string, @Path() requestWorkId: string,
@Request() req: RequestWithLineUser, @Request() req: RequestWithLineUser,
@Body() body: { reason: string }, @Body() body: { cancel: boolean; reason?: string },
) { ) {
const result = await prisma.requestWork.updateMany({ const result = await prisma.requestWork.updateMany({
where: { where: {
@ -836,8 +836,8 @@ export class LineController extends Controller {
}, },
}, },
data: { data: {
customerRequestCancel: true, customerRequestCancel: body.cancel,
customerRequestCancelReason: body.reason, customerRequestCancelReason: body.reason || "",
}, },
}); });
if (result.count <= 0) throw notFoundError("Request Data"); if (result.count <= 0) throw notFoundError("Request Data");