mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +01:00
Add queries for new schema.
This commit is contained in:
parent
b0c7980a20
commit
5aa8187e42
25 changed files with 699 additions and 306 deletions
43
queries/admin/userWebsite.ts
Normal file
43
queries/admin/userWebsite.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { Prisma, UserWebsite } from '@prisma/client';
|
||||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function createUserWebsite(data: Prisma.UserWebsiteCreateInput): Promise<UserWebsite> {
|
||||
return prisma.client.userWebsite.create({
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getUserWebsite(
|
||||
where: Prisma.UserWebsiteWhereUniqueInput,
|
||||
): Promise<UserWebsite> {
|
||||
return prisma.client.userWebsite.findUnique({
|
||||
where,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getUserWebsites(where: Prisma.UserWebsiteWhereInput): Promise<UserWebsite[]> {
|
||||
return prisma.client.userWebsite.findMany({
|
||||
where,
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateUserWebsite(
|
||||
data: Prisma.UserWebsiteUpdateInput,
|
||||
where: Prisma.UserWebsiteWhereUniqueInput,
|
||||
): Promise<UserWebsite> {
|
||||
return prisma.client.userWebsite.update({
|
||||
data,
|
||||
where,
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteUserWebsite(userWebsiteId: string): Promise<UserWebsite> {
|
||||
return prisma.client.userWebsite.update({
|
||||
data: {
|
||||
isDeleted: true,
|
||||
},
|
||||
where: {
|
||||
id: userWebsiteId,
|
||||
},
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue