mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-16 02:05:04 +01:00
29 lines
710 B
JavaScript
29 lines
710 B
JavaScript
import { prisma, runQuery } from 'lib/relational';
|
|
|
|
export async function deleteAccount(user_id) {
|
|
return runQuery(
|
|
prisma.$transaction([
|
|
prisma.pageview.deleteMany({
|
|
where: { session: { website: { user_id } } },
|
|
}),
|
|
prisma.event_data.deleteMany({
|
|
where: { event: { session: { website: { user_id } } } },
|
|
}),
|
|
prisma.event.deleteMany({
|
|
where: { session: { website: { user_id } } },
|
|
}),
|
|
prisma.session.deleteMany({
|
|
where: { website: { user_id } },
|
|
}),
|
|
prisma.website.deleteMany({
|
|
where: { user_id },
|
|
}),
|
|
prisma.account.delete({
|
|
where: {
|
|
user_id,
|
|
},
|
|
}),
|
|
]),
|
|
);
|
|
}
|