feat: external status monitor for registratura (Primaria Cluj-Napoca)

- Add ExternalStatusTracking types + ExternalDocStatus semantic states
- Authority catalog with Primaria Cluj-Napoca (POST scraper + HTML parser)
- Status check service: batch + single entry, change detection via hash
- API routes: cron-triggered batch (/api/registratura/status-check) +
  user-triggered single (/api/registratura/status-check/single)
- Add "status-change" notification type with instant email on change
- Table badge: Radio icon color-coded by status (amber/blue/green/red)
- Detail panel: full monitoring section with status, history, manual check
- Auto-detection: prompt when recipient matches known authority
- Activation dialog: configure petitioner name + confirm registration data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-11 14:42:21 +02:00
parent 1c51236c31
commit d7bd1a7f5d
10 changed files with 1201 additions and 6 deletions
+8 -2
View File
@@ -5,7 +5,8 @@ import type { CompanyId } from "@/core/auth/types";
export type NotificationType =
| "deadline-urgent"
| "deadline-overdue"
| "document-expiry";
| "document-expiry"
| "status-change";
export interface NotificationTypeInfo {
type: NotificationType;
@@ -30,6 +31,11 @@ export const NOTIFICATION_TYPES: NotificationTypeInfo[] = [
label: "Documente care expira",
description: "CU/AC si alte documente care expira in fereastra de alerta",
},
{
type: "status-change",
label: "Schimbare status extern",
description: "Notificare imediata cand o autoritate actualizeaza statusul documentului",
},
];
// ── User preferences ──
@@ -55,7 +61,7 @@ export function defaultPreference(
email,
name,
company,
enabledTypes: ["deadline-urgent", "deadline-overdue", "document-expiry"],
enabledTypes: ["deadline-urgent", "deadline-overdue", "document-expiry", "status-change"],
globalOptOut: false,
};
}