use uuid
This commit is contained in:
@@ -1,28 +1,28 @@
|
||||
import prisma from 'lib/prisma';
|
||||
import redis, { DELETED } from 'lib/redis';
|
||||
|
||||
export async function deleteWebsite(websiteUuid) {
|
||||
export async function deleteWebsite(id) {
|
||||
const { client, transaction } = prisma;
|
||||
|
||||
return transaction([
|
||||
client.pageview.deleteMany({
|
||||
where: { session: { website: { websiteUuid } } },
|
||||
where: { session: { website: { id } } },
|
||||
}),
|
||||
client.eventData.deleteMany({
|
||||
where: { event: { session: { website: { websiteUuid } } } },
|
||||
where: { event: { session: { website: { id } } } },
|
||||
}),
|
||||
client.event.deleteMany({
|
||||
where: { session: { website: { websiteUuid } } },
|
||||
where: { session: { website: { id } } },
|
||||
}),
|
||||
client.session.deleteMany({
|
||||
where: { website: { websiteUuid } },
|
||||
where: { website: { id } },
|
||||
}),
|
||||
client.website.delete({
|
||||
where: { websiteUuid },
|
||||
where: { id },
|
||||
}),
|
||||
]).then(async res => {
|
||||
if (redis.enabled) {
|
||||
await redis.set(`website:${websiteUuid}`, DELETED);
|
||||
await redis.set(`website:${id}`, DELETED);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user