Carte T Verification by Admin
Summary
Admins can manually mark a Pro’s carte professionnelle (carte T / CPI number) as verified or unverified. This is a simple toggle with no automated checks — the admin is responsible for validating the CPI number against the official registry. The action is recorded in the audit log.
State Diagram
stateDiagram-v2 state "Carte T non vérifiée" as Unverified state "Carte T vérifiée" as Verified [*] --> Unverified: Pro registered, carteTVerifiedAt = null Unverified --> Verified: admin marks carte T as verified Verified --> Unverified: admin revokes carte T verification Verified --> [*] Unverified --> [*]
Steps
1. Toggle Carte T Status (Actor: admin)
PATCH /admin/pros/:id/carte-t-verified with body { verified: boolean }.
The system fetches the Pro record. If not found → 404 NOT_FOUND.
Triggers: Admin reviews the Pro’s CPI number against the official registry Outcome: Request reaches the update step
2. Update DB + Audit Log (Actor: admin)
In a single prisma.$transaction:
- Sets
carteTVerifiedAt = now()ifverified: true, orcarteTVerifiedAt = nullifverified: false. - Inserts an
AuditLogentry withaction: "pro.carte_t_verified",targetType: "pro",targetId,actorId, andmetadata: { verified }.
Triggers: Pro found
Outcome: carteTVerifiedAt updated; action logged
Error States
- Pro not found → 404
NOT_FOUND
Notes
- Carte T format is validated at registration time (
isValidCarteT) — the CPI format check (CPI XXXX YYYY 000 ZZZ ZZZ) passes syntactically, but official registry verification is manual. - There is no email notification triggered by this action.
- This flag is independent of CNI verification — both can be true, false, or in any combination.
Related Processes
- registration — carteT field is collected and format-validated at signup
- cni-verification — separate identity document verification process