2022-08-28 04:38:35 +00:00
|
|
|
import prisma from 'lib/prisma';
|
2022-07-12 21:14:36 +00:00
|
|
|
|
2022-11-01 06:42:37 +00:00
|
|
|
export async function resetWebsite(id) {
|
2022-08-29 07:02:38 +00:00
|
|
|
const { client, transaction } = prisma;
|
2022-08-28 04:38:35 +00:00
|
|
|
|
2022-08-29 07:02:38 +00:00
|
|
|
return transaction([
|
2022-08-28 04:38:35 +00:00
|
|
|
client.pageview.deleteMany({
|
2022-11-01 06:42:37 +00:00
|
|
|
where: { session: { website: { id } } },
|
2022-08-28 04:38:35 +00:00
|
|
|
}),
|
2022-10-10 20:42:18 +00:00
|
|
|
client.eventData.deleteMany({
|
2022-11-01 06:42:37 +00:00
|
|
|
where: { event: { session: { website: { id } } } },
|
2022-08-28 04:38:35 +00:00
|
|
|
}),
|
|
|
|
|
client.event.deleteMany({
|
2022-11-01 06:42:37 +00:00
|
|
|
where: { session: { website: { id } } },
|
2022-08-28 04:38:35 +00:00
|
|
|
}),
|
|
|
|
|
client.session.deleteMany({
|
2022-11-01 06:42:37 +00:00
|
|
|
where: { website: { id } },
|
2022-08-28 04:38:35 +00:00
|
|
|
}),
|
2022-09-01 21:54:25 +00:00
|
|
|
]);
|
2022-07-12 21:14:36 +00:00
|
|
|
}
|