fix: error update on empty productGroupId

This commit is contained in:
Methapon2001 2024-08-01 15:40:36 +07:00
parent 8cd393151e
commit e6315a0687

View file

@ -202,8 +202,8 @@ export class ProductType extends Controller {
where: { id: typeId }, where: { id: typeId },
}); });
if (productGroup?.status === "CREATED") { if (body.productGroupId && productGroup?.status === "CREATED") {
await prisma.productGroup.update({ await prisma.productGroup.updateMany({
where: { id: body.productGroupId, status: Status.CREATED }, where: { id: body.productGroupId, status: Status.CREATED },
data: { status: Status.ACTIVE }, data: { status: Status.ACTIVE },
}); });