From 44ad3addf0b51c3a441303de1545a3f00065c14c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 2 Jul 2026 14:44:39 +0000 Subject: [PATCH] Add access groups (staff-style credential bundles) and scan logging --- migrations/0003_access_groups_and_logs.sql | 11 + public/dashboard.html | 83 +++++++ public/js/dashboard.js | 271 ++++++++++++++++++++- routes/api/v1/ingame.js | 77 ++++-- routes/dashboard.js | 188 +++++++++++++- 5 files changed, 596 insertions(+), 34 deletions(-) create mode 100644 migrations/0003_access_groups_and_logs.sql diff --git a/migrations/0003_access_groups_and_logs.sql b/migrations/0003_access_groups_and_logs.sql new file mode 100644 index 0000000..bfa021f --- /dev/null +++ b/migrations/0003_access_groups_and_logs.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS access_groups (id INTEGER PRIMARY KEY AUTOINCREMENT, placeId TEXT NOT NULL, name TEXT NOT NULL, FOREIGN KEY(placeId) REFERENCES places(id)); + +CREATE TABLE IF NOT EXISTS access_group_members (id INTEGER PRIMARY KEY AUTOINCREMENT, groupId INTEGER NOT NULL, type INTEGER NOT NULL DEFAULT 0, data TEXT NOT NULL, FOREIGN KEY(groupId) REFERENCES access_groups(id)); + +CREATE TABLE IF NOT EXISTS scan_logs (id INTEGER PRIMARY KEY AUTOINCREMENT, placeId TEXT NOT NULL, accessPoint TEXT NOT NULL, userId TEXT, cardNumbers TEXT, granted INTEGER NOT NULL DEFAULT 0, responseCode TEXT, scannedAt DATETIME DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY(placeId) REFERENCES places(id), FOREIGN KEY(accessPoint) REFERENCES access_points(id)); + +CREATE INDEX IF NOT EXISTS idx_access_group_members_groupId ON access_group_members(groupId); + +CREATE INDEX IF NOT EXISTS idx_scan_logs_accessPoint ON scan_logs(accessPoint); + +CREATE INDEX IF NOT EXISTS idx_scan_logs_placeId ON scan_logs(placeId); diff --git a/public/dashboard.html b/public/dashboard.html index 1a9e1fe..51c430e 100644 --- a/public/dashboard.html +++ b/public/dashboard.html @@ -58,6 +58,24 @@
+ +Access groups (e.g. "Staff") bundle multiple users/cards/rank rules so they can be assigned to multiple readers at once.
+ +