feat: Add team deletion flow for cloud-hosted (#5717)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user