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:
7
packages/core-consent/src/entities/errors/consent.ts
Normal file
7
packages/core-consent/src/entities/errors/consent.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export class UnauthenticatedError extends Error {
|
||||
constructor(message = "Not authenticated") {
|
||||
super(message);
|
||||
this.name = "UnauthenticatedError";
|
||||
Object.setPrototypeOf(this, UnauthenticatedError.prototype);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user