Files
calendar/packages/lib/server/buildCredentialPayloadForCalendar.ts
T
MorganandGitHub 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

29 lines
620 B
TypeScript

import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
export function buildCredentialPayloadForPrisma({
credentialId,
delegationCredentialId,
}: {
credentialId: number | null | undefined;
delegationCredentialId: string | null | undefined;
}) {
if (credentialId === undefined) {
return {
credentialId,
delegationCredentialId,
};
}
if (isDelegationCredential({ credentialId })) {
return {
credentialId: null,
delegationCredentialId,
};
} else {
return {
credentialId,
delegationCredentialId: null,
};
}
}