Initial Typescript models.

This commit is contained in:
Brian Cao 2022-11-15 13:21:14 -08:00
parent 04e9f06e93
commit 0aaba8cbd1
74 changed files with 1144 additions and 768 deletions

View file

@ -1,25 +0,0 @@
import prisma from 'lib/prisma';
import { getWebsite } from 'queries';
import cache from 'lib/cache';
export async function resetWebsite(id) {
const { client, transaction } = prisma;
const { revId } = await getWebsite({ id });
return transaction([
client.websiteEvent.deleteMany({
where: { websiteId: id },
}),
client.session.deleteMany({
where: { websiteId: id },
}),
client.website.update({ where: { id }, data: { revId: revId + 1 } }),
]).then(async data => {
if (cache.enabled) {
await cache.storeWebsite(data[2]);
}
return data;
});
}