x
This commit is contained in:
1 parent
f258e3e176
commit
3631f59bba
7 files changed
+524
-57
No files matched your search
@@ -118,6 +118,7 @@ async function createSingleProductTx(tx: any, payload: any, validateVariants: an
|
||||
categoryId,
|
||||
brandId,
|
||||
name: pName,
|
||||
titleGraphicUrl: payload.titleGraphicUrl || null,
|
||||
description: pDesc,
|
||||
details: pDetails,
|
||||
options,
|
||||
@@ -149,6 +150,7 @@ async function createSingleProductTx(tx: any, payload: any, validateVariants: an
|
||||
option2: v.option2 || "",
|
||||
option3: v.option3 || "",
|
||||
price: v.price != null ? Number(v.price) : 0,
|
||||
imageUrl: v.imageUrl || null,
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -676,6 +678,7 @@ export const productsRoute = new Elysia({ prefix: "/products" })
|
||||
updateData.categoryId = categoryId;
|
||||
}
|
||||
if (body.options !== undefined) updateData.options = body.options;
|
||||
if (body.titleGraphicUrl !== undefined) updateData.titleGraphicUrl = body.titleGraphicUrl || null;
|
||||
|
||||
const prod = await tx.product.update({
|
||||
where: { id },
|
||||
@@ -711,6 +714,7 @@ export const productsRoute = new Elysia({ prefix: "/products" })
|
||||
option2: v.option2 || "",
|
||||
option3: v.option3 || "",
|
||||
price: v.price || 0,
|
||||
imageUrl: v.imageUrl !== undefined ? (v.imageUrl || null) : undefined,
|
||||
bomItems: v.bomItems ? {
|
||||
deleteMany: {},
|
||||
create: v.bomItems.map((b: any) => ({
|
||||
@@ -732,6 +736,7 @@ export const productsRoute = new Elysia({ prefix: "/products" })
|
||||
option2: v.option2 || "",
|
||||
option3: v.option3 || "",
|
||||
price: v.price || 0,
|
||||
imageUrl: v.imageUrl || null,
|
||||
bomItems: v.bomItems && v.bomItems.length > 0 ? {
|
||||
create: v.bomItems.map((b: any) => ({
|
||||
rawMaterialId: b.rawMaterialId,
|
||||
|
||||
Reference in new issue
Block a user