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

@@ -4,6 +4,7 @@ import {
DomainNotAllowedError,
InvalidAuthenticationError,
MaximumTeamsError,
TeamPendingDeletionError,
} from "@server/errors";
import { traceFunction } from "@server/logging/tracing";
import { Team, AuthenticationProvider } from "@server/models";
@@ -58,6 +59,7 @@ async function teamProvisioner({
model: Team,
as: "team",
required: true,
paranoid: false,
},
],
});
@@ -65,6 +67,10 @@ async function teamProvisioner({
// This authentication provider already exists which means we have a team and
// there is nothing left to do but return the existing credentials
if (authP) {
if (authP.team.deletedAt) {
throw TeamPendingDeletionError();
}
return {
authenticationProvider: authP,
team: authP.team,