Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Omar López <[email protected]> Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Benny Joo <[email protected]> Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: Gergő Móricz <[email protected]> Co-authored-by: Keith Williams <[email protected]>
15 lines
429 B
TypeScript
15 lines
429 B
TypeScript
import type { PrismaClient } from "@calcom/prisma";
|
|
|
|
import type { AppFlags } from "../config";
|
|
|
|
export async function getFeatureFlagMap(prisma: PrismaClient) {
|
|
const flags = await prisma.feature.findMany({
|
|
orderBy: { slug: "asc" },
|
|
cacheStrategy: { swr: 300, ttl: 300 },
|
|
});
|
|
return flags.reduce((acc, flag) => {
|
|
acc[flag.slug as keyof AppFlags] = flag.enabled;
|
|
return acc;
|
|
}, {} as Partial<AppFlags>);
|
|
}
|