feat(core-consent): add handlers and consentRouter tRPC router

Protocol-agnostic handlers (grant, withdraw, isGranted, getCategories)
in core-consent/handlers/ call IConsent methods and return typed results.

consentRouter uses a consent-specific tRPC context (userId + consentFactory)
so each procedure can resolve the per-user IConsent instance at call time.
Auth middleware guards all four procedures and maps UnauthenticatedError →
UNAUTHORIZED via defineErrorMiddleware from core-shared (no local duplicate).

76 tests passing; new handler and router code at 100% branch coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 13:22:33 +00:00
parent ae4e0f2680
commit e53f35a0c5
17 changed files with 518 additions and 24 deletions

View File

@@ -1,18 +1,18 @@
{
"generatedAt": "2026-05-19T12:59:06.953Z",
"commit": "c346f85",
"generatedAt": "2026-05-19T13:18:49.389Z",
"commit": "ae4e0f2",
"repo": {
"statements": 96.65,
"branches": 91.95,
"functions": 96.77,
"lines": 96.65,
"statements": 96.72,
"branches": 92.06,
"functions": 96.83,
"lines": 96.72,
"counts": {
"lf": 4511,
"lh": 4360,
"brf": 894,
"brh": 822,
"fnf": 279,
"fnh": 270
"lf": 4607,
"lh": 4456,
"brf": 907,
"brh": 835,
"fnf": 284,
"fnh": 275
}
},
"byPackage": {
@@ -59,17 +59,17 @@
}
},
"@repo/core-consent": {
"statements": 99.57,
"branches": 93.67,
"functions": 96.15,
"lines": 99.57,
"statements": 99.69,
"branches": 94.57,
"functions": 96.77,
"lines": 99.69,
"counts": {
"lf": 230,
"lh": 229,
"brf": 79,
"brh": 74,
"fnf": 26,
"fnh": 25
"lf": 326,
"lh": 325,
"brf": 92,
"brh": 87,
"fnf": 31,
"fnh": 30
}
},
"@repo/core-shared": {