add reset feature for admins/orgs
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 28s

This commit is contained in:
2026-02-28 03:17:40 -05:00
parent ab3a88dbc0
commit d8fc014e6b
3 changed files with 27 additions and 0 deletions

View File

@@ -222,6 +222,16 @@ const Hunts = {
.run(name, description, expiryDate || null, id);
},
resetScans(id) {
const doReset = db.transaction(() => {
// Delete all scans for packages in this hunt
db.prepare('DELETE FROM scans WHERE package_id IN (SELECT id FROM packages WHERE hunt_id = ?)').run(id);
// Reset package scan counters and scanner references
db.prepare('UPDATE packages SET scan_count = 0, first_scanned_by = NULL, last_scanned_by = NULL, hint_text = NULL, hint_image = NULL WHERE hunt_id = ?').run(id);
});
doReset();
},
delete(id) {
const doDelete = db.transaction(() => {
// Delete scans for all packages in this hunt