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 },
});
if (productGroup?.status === "CREATED") {
await prisma.productGroup.update({
if (body.productGroupId && productGroup?.status === "CREATED") {
await prisma.productGroup.updateMany({
where: { id: body.productGroupId, status: Status.CREATED },
data: { status: Status.ACTIVE },
});