* wip * wip * wip * refactor * refactor * refactor * refactor * refactor * fix * better * fix * fix * use notFound * refactor * wip * refactor * wip * refactor * wip * wip * finalize * wip * fix * lots of refactors * better code * clean up * fix * fix type checks * finalize * select more fields * select more fields * fix * fix * fix * fix * better * better * fix * fix * fix * fix * add back comment * fix * better * fix * refactor * fix * fix type check * add comment * fix * wip * wip * add more comment * refactor * rename * refactors * fix reschedule logic * remove hard-coded true from isCachedEnabled * better * use revalidateTeamDataCache in team profile update * fix invalidation * better comment * refactors * add better comments * add revalidations * add comments * fix * remove hard code * fix * update tags * use features package * fix type check
49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
import { getSlugOrRequestedSlug } from "@calcom/features/ee/organizations/lib/orgDomains";
|
|
import { prisma } from "@calcom/prisma";
|
|
|
|
export type TeamData = Awaited<ReturnType<typeof getTeamData>>;
|
|
|
|
export async function getTeamData(teamSlug: string, orgSlug: string | null) {
|
|
return await prisma.team.findFirst({
|
|
where: {
|
|
...getSlugOrRequestedSlug(teamSlug),
|
|
parent: orgSlug ? getSlugOrRequestedSlug(orgSlug) : null,
|
|
},
|
|
orderBy: {
|
|
slug: { sort: "asc", nulls: "last" },
|
|
},
|
|
select: {
|
|
id: true,
|
|
isPrivate: true,
|
|
hideBranding: true,
|
|
parent: {
|
|
select: {
|
|
id: true,
|
|
slug: true,
|
|
name: true,
|
|
bannerUrl: true,
|
|
logoUrl: true,
|
|
hideBranding: true,
|
|
organizationSettings: {
|
|
select: {
|
|
allowSEOIndexing: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
logoUrl: true,
|
|
name: true,
|
|
slug: true,
|
|
brandColor: true,
|
|
darkBrandColor: true,
|
|
theme: true,
|
|
isOrganization: true,
|
|
organizationSettings: {
|
|
select: {
|
|
allowSEOIndexing: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
}
|