fix: error when workflow id is empty

This commit is contained in:
Methapon2001 2024-12-10 09:12:47 +07:00
parent 78e39ae16e
commit d58d88c0d4

View file

@ -93,7 +93,7 @@ type ServiceUpdate = {
*/
installments?: number;
status?: "ACTIVE" | "INACTIVE";
workflowId?: string;
workflowId?: string | null;
work?: {
id?: string;
name: string;
@ -309,6 +309,8 @@ export class ServiceController extends Controller {
update: { value: { increment: 1 } },
});
if (!!payload.workflowId) payload.workflowId = undefined;
return tx.service.create({
include: {
work: {
@ -402,6 +404,8 @@ export class ServiceController extends Controller {
}
const record = await prisma.$transaction(async (tx) => {
if (payload.workflowId === "") payload.workflowId = undefined;
return await tx.service.update({
include: {
createdBy: true,