Return created from invite (#14158)

This commit is contained in:
Mole
2023-04-25 14:19:31 +02:00
committed by GitHub
parent dfa7eff7c2
commit d96346313e
2 changed files with 14 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ public class InviteUserController : UserControllerBase
[HttpPost("invite")]
[MapToApiVersion("1.0")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status201Created)]
public async Task<IActionResult> Invite(InviteUserRequestModel model)
{
UserInviteModel userInvite = await _userPresentationFactory.CreateInviteModelAsync(model);
@@ -37,7 +37,7 @@ public class InviteUserController : UserControllerBase
Attempt<UserInvitationResult, UserOperationStatus> result = await _userService.InviteAsync(CurrentUserKey(_backOfficeSecurityAccessor), userInvite);
return result.Success
? Ok()
? CreatedAtAction<ByKeyUserController>(controller => nameof(controller.ByKey), result.Result.InvitedUser!.Key)
: UserOperationStatusResult(result.Status, result.Result);
}
}

View File

@@ -7778,8 +7778,18 @@
}
},
"responses": {
"200": {
"description": "Success"
"201": {
"description": "Created",
"headers": {
"Location": {
"description": "Location of the newly created resource",
"schema": {
"type": "string",
"description": "Location of the newly created resource",
"format": "uri"
}
}
}
}
}
}