Test
This commit is contained in:
parent
7d409cd697
commit
27a4421ad2
|
@ -222,13 +222,11 @@ router.post('/bulk-add', async (req, res) => { // Process bulk add of ACL entrie
|
||||||
entry.StartDate || new Date(),
|
entry.StartDate || new Date(),
|
||||||
entry.EndDate || new Date(new Date().setFullYear(new Date().getFullYear() + 99))
|
entry.EndDate || new Date(new Date().setFullYear(new Date().getFullYear() + 99))
|
||||||
];
|
];
|
||||||
if (entry.Doors && typeof entry.Doors === 'object') {
|
if (Array.isArray(entry.doors)) {
|
||||||
for (const door in entry.Doors) {
|
for (const door of entry.doors) {
|
||||||
if (entry.Doors.hasOwnProperty(door)) {
|
fields.push(door);
|
||||||
fields.push(door);
|
placeholders.push('?');
|
||||||
placeholders.push('?');
|
values.push(1);
|
||||||
values.push(entry.Doors[door] ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const sql = `INSERT INTO ACL (${fields.join(', ')}) VALUES (${placeholders.join(', ')})`;
|
const sql = `INSERT INTO ACL (${fields.join(', ')}) VALUES (${placeholders.join(', ')})`;
|
||||||
|
|
Loading…
Reference in a new issue