* Adds basic feature flag model * Create router.ts * WIP * WIP * WIP * WIP * Emails kill switch * Adds missing migrations * Type fix * Cleanup * Revert * Cleanup * Fixes migration * Update packages/features/flags/server/utils.ts Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com> --------- Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: sean-brydon <55134778+sean-brydon@users.noreply.github.com>
14 lines
387 B
TypeScript
14 lines
387 B
TypeScript
import type { PrismaClient } from "@prisma/client";
|
|
|
|
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);
|
|
}
|