Files
cal.diy/packages/trpc/server/routers/viewer/delegationCredential/delete.handler.ts
T
Morgan 524c0d81a7 chore: rename DWD to DelegationCredential (#19744)
* Revert "Revert "chore: rename DWD to DelegationCredential (#19703)" (#19734)"

This reverts commit 340b5ab061.

* chore: fix schema and types for now

* fix: domainWideDelegationCredentialId error type
2025-03-05 10:42:20 -03:00

22 lines
682 B
TypeScript

import type z from "zod";
import { DelegationCredentialRepository } from "@calcom/lib/server/repository/delegationCredential";
import { TRPCError } from "@trpc/server";
import type { DelegationCredentialDeleteSchema } from "./schema";
export default async function handler({
input,
}: {
input: z.infer<typeof DelegationCredentialDeleteSchema>;
}) {
const { id } = input;
// We might want to consider allowing this in the future. Right now, toggling off DelegationCredential achieves similar but non-destructive effect
throw new TRPCError({ code: "BAD_REQUEST", message: "Not allowed" });
await DelegationCredentialRepository.deleteById({ id });
return { id };
}