2023-08-24 09:14:10 +00:00
|
|
|
import type { PrismaClient } from "@calcom/prisma";
|
2023-03-25 00:59:04 +00:00
|
|
|
|
|
|
|
import type { AppFlags } from "../config";
|
|
|
|
|
|
|
|
export async function getFeatureFlagMap(prisma: PrismaClient) {
|
|
|
|
const flags = await prisma.feature.findMany({
|
|
|
|
orderBy: { slug: "asc" },
|
|
|
|
});
|
|
|
|
return flags.reduce<AppFlags>((acc, flag) => {
|
|
|
|
acc[flag.slug as keyof AppFlags] = flag.enabled;
|
|
|
|
return acc;
|
|
|
|
}, {} as AppFlags);
|
|
|
|
}
|