Add check-in audit logging + in-app history view

Every successful check-in/undo writes a row to the "2026 Ticket Audit Logs"
NocoDB table (timestamp, people, code, action, name, remaining-after).
Non-fatal: audit failures never block a gate check-in. New GET /api/audit
endpoint (global or per-code). Admin panel gains a global "Recent check-ins"
panel and per-ticket history. Audit table is optional via NOCODB_AUDIT_TABLE_ID.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Hank 2026-07-08 03:53:30 +00:00
parent 3397e3e3ec
commit b36d63a6a4
11 changed files with 342 additions and 4 deletions

View file

@ -2,6 +2,7 @@ import type { Config } from "./config.js";
import { NocoDBClient } from "./services/nocodb.js";
import { Mailer } from "./services/mailer.js";
import { RedeemQueue } from "./services/redeemQueue.js";
import { AuditLogger } from "./services/audit.js";
/** Shared services wired once at startup and hung off the Fastify instance. */
export interface AppContext {
@ -9,6 +10,7 @@ export interface AppContext {
nocodb: NocoDBClient;
mailer: Mailer;
queue: RedeemQueue;
audit: AuditLogger;
}
export function buildContext(config: Config): AppContext {
@ -17,6 +19,7 @@ export function buildContext(config: Config): AppContext {
nocodb: new NocoDBClient(config),
mailer: new Mailer(config),
queue: new RedeemQueue(),
audit: new AuditLogger(config),
};
}