Refactored queries.
This commit is contained in:
@@ -2,12 +2,20 @@ import { Prisma, Website } from '@prisma/client';
|
||||
import cache from 'lib/cache';
|
||||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function getWebsite(where: Prisma.WebsiteWhereUniqueInput): Promise<Website> {
|
||||
async function getWebsite(where: Prisma.WebsiteWhereUniqueInput): Promise<Website> {
|
||||
return prisma.client.website.findUnique({
|
||||
where,
|
||||
});
|
||||
}
|
||||
|
||||
export async function getWebsiteById(id: string) {
|
||||
return getWebsite({ id });
|
||||
}
|
||||
|
||||
export async function getWebsiteByShareId(shareId: string) {
|
||||
return getWebsite({ shareId });
|
||||
}
|
||||
|
||||
export async function getWebsites(): Promise<Website[]> {
|
||||
return prisma.client.website.findMany({
|
||||
orderBy: {
|
||||
|
||||
Reference in New Issue
Block a user