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:
@@ -21,3 +21,22 @@ export {
|
||||
extractAnonymousConsent,
|
||||
migrateAnonymousConsent,
|
||||
} from "./migration";
|
||||
export { UnauthenticatedError } from "./entities/errors/consent";
|
||||
export {
|
||||
grantHandler,
|
||||
grantHandlerInputSchema,
|
||||
} from "./handlers/grant.handler";
|
||||
export type { GrantHandlerInput } from "./handlers/grant.handler";
|
||||
export {
|
||||
withdrawHandler,
|
||||
withdrawHandlerInputSchema,
|
||||
} from "./handlers/withdraw.handler";
|
||||
export type { WithdrawHandlerInput } from "./handlers/withdraw.handler";
|
||||
export {
|
||||
isGrantedHandler,
|
||||
isGrantedHandlerInputSchema,
|
||||
} from "./handlers/is-granted.handler";
|
||||
export type { IsGrantedHandlerInput } from "./handlers/is-granted.handler";
|
||||
export { getCategoriesHandler } from "./handlers/get-categories.handler";
|
||||
export { consentRouter } from "./consent.router";
|
||||
export type { ConsentRouter, ConsentRouterContext } from "./consent.router";
|
||||
|
||||
Reference in New Issue
Block a user