-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support passing a verified One Login user to a TRN request (#1669)
- Loading branch information
Showing
31 changed files
with
1,283 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 0 additions & 88 deletions
88
TeachingRecordSystem/src/TeachingRecordSystem.Api/TrnRequestHelper.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...ngRecordSystem/src/TeachingRecordSystem.Api/V3/VNext/Controllers/TrnRequestsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Swashbuckle.AspNetCore.Annotations; | ||
using TeachingRecordSystem.Api.Infrastructure.Security; | ||
using TeachingRecordSystem.Api.V3.Core.Operations; | ||
using TeachingRecordSystem.Api.V3.V20240606.ApiModels; | ||
using TeachingRecordSystem.Api.V3.VNext.Requests; | ||
|
||
namespace TeachingRecordSystem.Api.V3.VNext.Controllers; | ||
|
||
[Route("trn-requests")] | ||
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.CreateTrn)] | ||
public class TrnRequestsController(IMapper mapper) : ControllerBase | ||
{ | ||
[HttpPost("")] | ||
[SwaggerOperation( | ||
OperationId = "CreateTrnRequest", | ||
Summary = "Creates a TRN request", | ||
Description = """ | ||
Creates a new TRN request using the personally identifiable information in the request body. | ||
If the request can be fulfilled immediately the response's status property will be 'Completed' and a TRN will also be returned. | ||
Otherwise, the response's status property will be 'Pending' and the GET endpoint should be polled until a 'Completed' status is returned. | ||
""")] | ||
[ProducesResponseType(typeof(TrnRequestInfo), StatusCodes.Status200OK)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] | ||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status409Conflict)] | ||
[MapError(10029, statusCode: StatusCodes.Status409Conflict)] | ||
public async Task<IActionResult> CreateTrnRequest( | ||
[FromBody] CreateTrnRequestRequest request, | ||
[FromServices] CreateTrnRequestHandler handler) | ||
{ | ||
var command = new CreateTrnRequestCommand() | ||
{ | ||
RequestId = request.RequestId, | ||
FirstName = request.Person.FirstName, | ||
MiddleName = request.Person.MiddleName, | ||
LastName = request.Person.LastName, | ||
DateOfBirth = request.Person.DateOfBirth, | ||
EmailAddresses = request.Person.EmailAddresses ?? [], | ||
NationalInsuranceNumber = request.Person.NationalInsuranceNumber, | ||
VerifiedOneLoginUserSubject = request.VerifiedOneLoginUserSubject | ||
}; | ||
var result = await handler.Handle(command); | ||
|
||
var response = mapper.Map<TrnRequestInfo>(result); | ||
return Ok(response); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...ingRecordSystem/src/TeachingRecordSystem.Api/V3/VNext/Requests/CreateTrnRequestRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace TeachingRecordSystem.Api.V3.VNext.Requests; | ||
|
||
[GenerateVersionedDto(typeof(V20240606.Requests.CreateTrnRequestRequest))] | ||
public partial record CreateTrnRequestRequest | ||
{ | ||
public string? VerifiedOneLoginUserSubject { get; init; } | ||
} |
Oops, something went wrong.