const productQuery: { productId: string }[] = await db.insert(schema.product)
.values({
id: product.id,
marketId: product.market_id,
url: product.url,
name: product.name,
brandname: product.brandname,
quantity: product.quantity,
originalprice: product.originalprice,
realprice: product.realprice,
priceperquantity: product.priceperquantity,
unit: product.unit,
urlimage: product.urlimage,
})
.onConflictDoUpdate({
target: [schema.product.name, schema.product.brandname, schema.product.quantity, schema.product.url],
set: {
originalprice: product.originalprice,
realprice: product.realprice,
priceperquantity: product.priceperquantity,
unit: product.unit,
urlimage: product.urlimage,
}
})
.returning({
productId: schema.product.id
})
const productQuery: { productId: string }[] = await db.insert(schema.product)
.values({
id: product.id,
marketId: product.market_id,
url: product.url,
name: product.name,
brandname: product.brandname,
quantity: product.quantity,
originalprice: product.originalprice,
realprice: product.realprice,
priceperquantity: product.priceperquantity,
unit: product.unit,
urlimage: product.urlimage,
})
.onConflictDoUpdate({
target: [schema.product.name, schema.product.brandname, schema.product.quantity, schema.product.url],
set: {
originalprice: product.originalprice,
realprice: product.realprice,
priceperquantity: product.priceperquantity,
unit: product.unit,
urlimage: product.urlimage,
}
})
.returning({
productId: schema.product.id
})