feat: notify product change
This commit is contained in:
parent
9ffbed7cb8
commit
afb4a83efa
2 changed files with 24 additions and 0 deletions
|
|
@ -374,6 +374,7 @@ export class ProductController extends Controller {
|
||||||
|
|
||||||
const record = await prisma.product.update({
|
const record = await prisma.product.update({
|
||||||
include: {
|
include: {
|
||||||
|
productGroup: true,
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
},
|
},
|
||||||
|
|
@ -398,6 +399,17 @@ export class ProductController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await prisma.notification.create({
|
||||||
|
data: {
|
||||||
|
title: "สินค้ามีการเปลี่ยนแปลง / Product Updated",
|
||||||
|
detail: "รหัส / code : " + record.code,
|
||||||
|
groupReceiver: {
|
||||||
|
create: [{ name: "sale" }, { name: "head_of_sale" }],
|
||||||
|
},
|
||||||
|
registeredBranchId: record.productGroup.registeredBranchId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -473,6 +473,7 @@ export class ServiceController extends Controller {
|
||||||
|
|
||||||
return await tx.service.update({
|
return await tx.service.update({
|
||||||
include: {
|
include: {
|
||||||
|
productGroup: true,
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
},
|
},
|
||||||
|
|
@ -523,6 +524,17 @@ export class ServiceController extends Controller {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await prisma.notification.create({
|
||||||
|
data: {
|
||||||
|
title: "แพคเกจมีการเปลี่ยนแปลง / Package Updated",
|
||||||
|
detail: "รหัส / code : " + record.code,
|
||||||
|
groupReceiver: {
|
||||||
|
create: [{ name: "sale" }, { name: "head_of_sale" }],
|
||||||
|
},
|
||||||
|
registeredBranchId: record.productGroup.registeredBranchId,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue