* Revert "Revert "chore: rename DWD to DelegationCredential (#19703)" (#19734)"
This reverts commit 340b5ab061.
* chore: fix schema and types for now
* fix: domainWideDelegationCredentialId error type
30 lines
885 B
TypeScript
30 lines
885 B
TypeScript
import type { Prisma } from "@prisma/client";
|
|
|
|
import { enrichUserWithDelegationCredentialsWithoutOrgId } from "@calcom/lib/delegationCredential/server";
|
|
import { availabilityUserSelect } from "@calcom/prisma";
|
|
import { prisma } from "@calcom/prisma";
|
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
|
|
|
import { withSelectedCalendars } from "./withSelectedCalendars";
|
|
|
|
export async function findUsersForAvailabilityCheck({ where }: { where: Prisma.UserWhereInput }) {
|
|
const user = await prisma.user.findFirst({
|
|
where,
|
|
select: {
|
|
...availabilityUserSelect,
|
|
selectedCalendars: true,
|
|
credentials: {
|
|
select: credentialForCalendarServiceSelect,
|
|
},
|
|
},
|
|
});
|
|
|
|
if (!user) {
|
|
return null;
|
|
}
|
|
|
|
return await enrichUserWithDelegationCredentialsWithoutOrgId({
|
|
user: withSelectedCalendars(user),
|
|
});
|
|
}
|