∅:D[
3.1100] → [
4.4801:4875]
B:BD[
4.4801] → [
4.4801:4875]
B:BD[
4.4875] → [
3.1101:1160]
∅:D[
3.1160] → [
4.4934:5327]
B:BD[
4.4934] → [
4.4934:5327]
B:BD[
4.5327] → [
3.1161:1219]
// if(Array.isArray(parameters.tax) && parameters.tax.length) {
// let query = 'insert into store_tax values ';
// let params = [];
// for(let i = 0; i < parameters.tax.length; ++i) {
// query += `($${i * 3 + 1}, $${i * 3 + 2}, $${i * 3 + 3}),`;
// params.push(store.rows[0].id);
// params.push(parameters.tax[i].name);
// params.push(parameters.tax[i].tax);
// }
// await pool.query(query.slice(0, -1), params);
// } I guess we'll do the same thing with hours
if(Array.isArray(parameters.taxes) && parameters.taxes.length) {
let query = 'insert into store_tax values ';
let params = [];
for(let i = 0; i < parameters.taxes.length; ++i) {
query += `(default, $${i * 3 + 1}, $${i * 3 + 2}, $${i * 3 + 3}),`;
params.push(store.rows[0].id);
params.push(parameters.taxes[i].name);
params.push(parameters.taxes[i].rate);
}
await pool.query(query.slice(0, -1), params);
}
if(Array.isArray(parameters.times) && parameters.times.length) {
let query = 'insert into store_hours values ';
let params = [];
for(let i = 0; i < parameters.times.length; ++i) {
query += `(default, $${i * 4 + 1}, $${i * 4 + 2}, $${i * 4 + 3}, $${i * 4 + 4}),`;
params.push(store.rows[0].id);
params.push(parameters.times[i].day);
params.push(parameters.times[i].start);
params.push(parameters.times[i].end);
}
await pool.query(query.slice(0, -1), params);
}