feat: Add team deletion flow for cloud-hosted (#5717)

This commit is contained in:
Tom Moor
2023-08-21 20:24:46 -04:00
committed by GitHub
parent 5c07694f6b
commit 418d3305b2
26 changed files with 461 additions and 71 deletions

View File

@@ -0,0 +1,33 @@
import { Transaction } from "sequelize";
import { Event, User, Team } from "@server/models";
export default async function teamDestroyer({
user,
team,
ip,
transaction,
}: {
user: User;
team: Team;
ip: string;
transaction?: Transaction;
}) {
await Event.create(
{
name: "teams.delete",
actorId: user.id,
teamId: team.id,
data: {
name: team.name,
},
ip,
},
{
transaction,
}
);
return team.destroy({
transaction,
});
}