* Revert "Revert "chore: rename DWD to DelegationCredential (#19703)" (#19734)"
This reverts commit 340b5ab061.
* chore: fix schema and types for now
* fix: domainWideDelegationCredentialId error type
29 lines
620 B
TypeScript
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,
|
|
};
|
|
}
|
|
}
|