segments implementation and migration update. update getRequestFilters to include filter groups.

This commit is contained in:
Francis Cao 2025-06-13 07:34:54 -07:00
parent 1ccc8a1a86
commit f61421b742
16 changed files with 188 additions and 23 deletions

View file

@ -13,6 +13,18 @@ export async function getSegment(segmentId: string): Promise<Segment> {
});
}
export async function getWebsiteSegment(websiteId: string, name: string): Promise<Segment> {
return prisma.client.segment.findFirst({
where: { websiteId, name },
});
}
export async function getWebsiteSegments(websiteId: string, type: string): Promise<Segment[]> {
return prisma.client.Segment.findMany({
where: { websiteId, type },
});
}
export async function createSegment(data: Prisma.SegmentUncheckedCreateInput): Promise<Segment> {
return prisma.client.Segment.create({ data });
}