mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 08:37:13 +01:00
Clean up teams on user delete.
This commit is contained in:
parent
82f0bc3d2b
commit
8684781624
8 changed files with 90 additions and 14 deletions
|
|
@ -67,10 +67,26 @@ export async function updateTeam(
|
|||
});
|
||||
}
|
||||
|
||||
export async function deleteTeam(teamId: string): Promise<Team> {
|
||||
return prisma.client.team.delete({
|
||||
where: {
|
||||
id: teamId,
|
||||
},
|
||||
});
|
||||
export async function deleteTeam(
|
||||
teamId: string,
|
||||
): Promise<Promise<[Prisma.BatchPayload, Prisma.BatchPayload, Team]>> {
|
||||
const { client } = prisma;
|
||||
|
||||
return prisma.transaction([
|
||||
client.teamWebsite.deleteMany({
|
||||
where: {
|
||||
id: teamId,
|
||||
},
|
||||
}),
|
||||
client.teamUser.deleteMany({
|
||||
where: {
|
||||
id: teamId,
|
||||
},
|
||||
}),
|
||||
client.team.delete({
|
||||
where: {
|
||||
id: teamId,
|
||||
},
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue