mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 14:17:13 +01:00
segment migration and support
This commit is contained in:
parent
42be91b736
commit
1840b8b419
8 changed files with 1484 additions and 1412 deletions
29
src/queries/prisma/segment.ts
Normal file
29
src/queries/prisma/segment.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import prisma from '@/lib/prisma';
|
||||
import { Prisma, Segment } from '@prisma/client';
|
||||
|
||||
async function findSegment(criteria: Prisma.SegmentFindUniqueArgs): Promise<Segment> {
|
||||
return prisma.client.Segment.findUnique(criteria);
|
||||
}
|
||||
|
||||
export async function getSegment(segmentId: string): Promise<Segment> {
|
||||
return findSegment({
|
||||
where: {
|
||||
id: segmentId,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function createSegment(data: Prisma.SegmentUncheckedCreateInput): Promise<Segment> {
|
||||
return prisma.client.Segment.create({ data });
|
||||
}
|
||||
|
||||
export async function updateSegment(
|
||||
SegmentId: string,
|
||||
data: Prisma.SegmentUpdateInput,
|
||||
): Promise<Segment> {
|
||||
return prisma.client.Segment.update({ where: { id: SegmentId }, data });
|
||||
}
|
||||
|
||||
export async function deleteSegment(SegmentId: string): Promise<Segment> {
|
||||
return prisma.client.Segment.delete({ where: { id: SegmentId } });
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue