This commit is contained in:
Christopher Cookman 2025-09-01 02:58:40 -06:00
parent 7d409cd697
commit 27a4421ad2

View file

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