Initial commit
This commit is contained in:
18
packages/core-consent/src/handlers/withdraw.handler.ts
Normal file
18
packages/core-consent/src/handlers/withdraw.handler.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { z } from "zod";
|
||||
import type { IConsent } from "../consent.interface";
|
||||
|
||||
export const withdrawHandlerInputSchema = z
|
||||
.object({
|
||||
category: z.string().min(1),
|
||||
})
|
||||
.strict();
|
||||
|
||||
export type WithdrawHandlerInput = z.infer<typeof withdrawHandlerInputSchema>;
|
||||
|
||||
export async function withdrawHandler(
|
||||
consent: IConsent,
|
||||
input: WithdrawHandlerInput,
|
||||
): Promise<{ success: true }> {
|
||||
await consent.withdraw(input.category);
|
||||
return { success: true };
|
||||
}
|
||||
Reference in New Issue
Block a user