Add new error for project transfer

This commit is contained in:
Matej Bačo
2022-12-30 00:04:39 +01:00
parent 3261777fcd
commit 73e9668a9c
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -197,6 +197,11 @@ return [
'description' => 'Team with the requested ID could not be found.',
'code' => 404,
],
Exception::PROJECT_TEAM_ALREADY_MATCHES => [
'name' => Exception::PROJECT_TEAM_ALREADY_MATCHES,
'description' => 'Project already owned by this team.',
'code' => 400,
],
Exception::TEAM_INVITE_ALREADY_EXISTS => [
'name' => Exception::TEAM_INVITE_ALREADY_EXISTS,
'description' => 'User has already been invited or is already a member of this team',
+4
View File
@@ -678,6 +678,10 @@ App::patch('/v1/projects/:projectId/team')
throw new Exception(Exception::TEAM_NOT_FOUND);
}
if ($team->getInternalId() === $project->getAttribute('teamInternalId')) {
throw new Exception(Exception::PROJECT_TEAM_ALREADY_MATCHES);
}
$project
->setAttribute('teamId', $team->getId())
->setAttribute('teamInternalId', $team->getInternalId())
+1
View File
@@ -76,6 +76,7 @@ class Exception extends \Exception
/** Teams */
public const TEAM_NOT_FOUND = 'team_not_found';
public const PROJECT_TEAM_ALREADY_MATCHES = 'project_team_already_matches';
public const TEAM_INVITE_ALREADY_EXISTS = 'team_invite_already_exists';
public const TEAM_INVITE_NOT_FOUND = 'team_invite_not_found';
public const TEAM_INVALID_SECRET = 'team_invalid_secret';