first commit
This commit is contained in:
35
calcom/packages/lib/server/getBrand.ts
Normal file
35
calcom/packages/lib/server/getBrand.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { subdomainSuffix, getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
||||
export const getBrand = async (orgId: number | null) => {
|
||||
if (!orgId) {
|
||||
return null;
|
||||
}
|
||||
const org = await prisma.team.findFirst({
|
||||
where: {
|
||||
id: orgId,
|
||||
},
|
||||
select: {
|
||||
logoUrl: true,
|
||||
name: true,
|
||||
slug: true,
|
||||
metadata: true,
|
||||
},
|
||||
});
|
||||
if (!org) {
|
||||
return null;
|
||||
}
|
||||
const metadata = teamMetadataSchema.parse(org.metadata);
|
||||
const slug = (org.slug || metadata?.requestedSlug) as string;
|
||||
const fullDomain = getOrgFullOrigin(slug);
|
||||
const domainSuffix = subdomainSuffix();
|
||||
|
||||
return {
|
||||
...org,
|
||||
metadata,
|
||||
slug,
|
||||
fullDomain,
|
||||
domainSuffix,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user