Extend GET /v1/stats/trend with granularity=hour (UTC buckets) and granularity=day
response envelope. Enrich GET /v1/stats/summary per-project totals and critical
counts. Add GET /v1/stats/recurrence for top incidents by occurrence volume in
a sliding window. Add index on er_incident_occurrences(occurred_at) for range
queries. Wire admin dashboard to summary, 24h/14d trends, and recurrence table.
Document contract in docs/ADMIN_STATS_API.md.
Paperclip-Agent: Pedro Alves (urlKey pedro-alves; id d706f4e6-5d05-4cec-b6e8-f8fb1f203aae)
Paperclip-Issue: BIT-728
Paperclip-Run: 948904bb-20d7-4d29-9cd7-4c22544f7570
Made-with: Cursor
Document the public CRM-shaped API matrix, emit audit rows for resolve,
bulk-resolve, and purge (including dry run), apply a dedicated per-IP
rate limit on mutation routes, and return 403 when a valid session lacks
RBAC for the action. Add Vitest coverage for authorizeMutation.
Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-731
Paperclip-Run: 7d0edfac-5676-41fa-85c2-86d01a808894
Made-with: Cursor
Align LXC deploy with BIT-465: write-version-json.sh, optional
webhook-deploy.sh, verify.sh fails when ER_VERSION_JSON_PATH is set but
missing/invalid, env.example + nginx sketch + runbook updates.
Ignore deploy/lxc/runtime/ (generated on server).
- Add middleware redirecting unauthenticated users to /login unless dev+demo
- Disable demo incident data when NODE_ENV=production
- Forward __Host-access cookie on SSR fetches to admin API
- Document NPM /admin/ proxy to Fastify api (§14.2.2)
Co-Authored-By: Paperclip <[email protected]>
Replace Postgres with MariaDB 11 in docker-compose; convert all
database/error_reporting and db/migrations SQL to InnoDB-friendly syntax
(DATETIME(6), AUTO_INCREMENT, ON DUPLICATE KEY). Run admin portal DDL in the
same migrate one-shot as error_reporting.
Switch ingest-api, collector-worker, and api from pg to mysql2 (pools,
parameterized queries, transactions). Align ingest writes with
er_incident_occurrences and include project_id on idempotency inserts.
Add scripts/run-mysql-migrations.sh for host-side applies; update LXC
run-migrate/verify, deployment docs, and .env.example (mysql://, ER_MYSQL_*).
Verified: npm run build + npm test in ingest-api and collector-worker;
npm run build in api. Full docker compose not run here (no local daemon).
Co-Authored-By: Paperclip <[email protected]>