B:BD[
5.523] → [
6.252:265]
∅:D[
3.4780] → [
6.265:348]
B:BD[
6.265] → [
6.265:348]
B:BD[
6.348] → [
2.616:748]
∅:D[
3.4930] → [
6.402:493]
B:BD[
6.402] → [
6.402:493]
B:BD[
6.493] → [
7.2897:3035]
∅:D[
7.3035] → [
6.661:758]
B:BD[
6.661] → [
6.661:758]
B:BD[
6.758] → [
7.3036:3212]
∅:D[
7.3212] → [
6.938:1102]
B:BD[
6.938] → [
6.938:1102]
B:BD[
6.1102] → [
8.662:768]
B:BD[
8.768] → [
7.3213:3273]
∅:D[
7.3273] → [
8.920:954]
B:BD[
8.920] → [
8.920:954]
B:BD[
8.954] → [
2.749:783]
B:BD[
8.954] → [
8.954:993]
B:BD[
8.993] → [
2.784:990]
∅:D[
2.990] → [
8.993:1023]
∅:D[
7.3447] → [
8.993:1023]
∅:D[
9.263] → [
8.993:1023]
B:BD[
8.993] → [
8.993:1023]
try {
if(Array.isArray(parameters.menu_items) && parameters.menu_items.length) {
let query = 'insert into menu_item values ';//since we're god, trusting parameters.store is fine. otherwise, need to check
let params = [];
for(let i = 0; i < parameters.menu_items.length; ++i) {
query += `(default, $${i * 7 + 1}, $${i * 7 + 2}, $${i * 7 + 3}, $${i * 7 + 4}, $${i * 7 + 5}, $${i * 7 + 6}, $${i * 7 + 7}),`;
params.push(
parameters.menu_items[i].variant,
parameters.store,
`[${parameters.menu_items[i].min_cbd},${parameters.menu_items[i].max_cbd}]`,
`[${parameters.menu_items[i].min_thc},${parameters.menu_items[i].max_thc}]`,
parameters.menu_items[i].price,
parameters.menu_items[i].stock,
Boolean(parameters.menu_items[i].featured)
);
}
await pool.query(query.slice(0, -1) + ` on conflict on constraint unique_menu_item do update set
cbd = excluded.cbd,
thc = excluded.thc,
price = excluded.price,
stock = excluded.stock,
featured = excluded.featured
where (menu_item.cbd, menu_item.thc, menu_item.price, menu_item.stock, menu_item.featured) is distinct from
(excluded.cbd, excluded.thc, excluded.price, excluded.stock, excluded.featured)
`,
params
if(Array.isArray(parameters.fresh) && parameters.fresh.length) {
let query = 'insert into menu_item values ';//since we're god, trusting parameters.store is fine. otherwise, need to check
let params = [];
for(let i = 0; i < parameters.fresh.length; ++i) {
query += `(default, $${i * 7 + 1}, $${i * 7 + 2}, $${i * 7 + 3}, $${i * 7 + 4}, $${i * 7 + 5}, $${i * 7 + 6}, $${i * 7 + 7}),`;
params.push(
parameters.fresh[i].variant,
parameters.store,
`[${parameters.fresh[i].min_cbd},${parameters.fresh[i].max_cbd}]`,
`[${parameters.fresh[i].min_thc},${parameters.fresh[i].max_thc}]`,
parameters.fresh[i].price,
parameters.fresh[i].stock,
Boolean(parameters.fresh[i].featured)