2022-08-26 07:20:30 +02:00
|
|
|
import { prisma, runQuery } from 'lib/relational';
|
2022-07-12 23:14:36 +02:00
|
|
|
|
|
|
|
export async function deleteWebsite(website_id) {
|
|
|
|
return runQuery(
|
2022-08-18 02:35:52 +02:00
|
|
|
prisma.$transaction([
|
|
|
|
prisma.pageview.deleteMany({
|
|
|
|
where: { session: { website: { website_id } } },
|
|
|
|
}),
|
|
|
|
prisma.event_data.deleteMany({
|
|
|
|
where: { event: { session: { website: { website_id } } } },
|
|
|
|
}),
|
|
|
|
prisma.event.deleteMany({
|
|
|
|
where: { session: { website: { website_id } } },
|
|
|
|
}),
|
|
|
|
prisma.session.deleteMany({
|
|
|
|
where: { website: { website_id } },
|
|
|
|
}),
|
|
|
|
prisma.website.delete({
|
|
|
|
where: { website_id },
|
|
|
|
}),
|
|
|
|
]),
|
2022-07-12 23:14:36 +02:00
|
|
|
);
|
|
|
|
}
|