Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ public TeachersController(IMediator mediator)
}

[HttpGet("{trn}")]
[SwaggerOperation(
OperationId = "GetTeacher",
Summary = "Get teacher",
Description = "Gets a teacher by their DOB and either TRN or NINO")]
[EndpointName("GetTeacher"),
EndpointSummary("Get teacher"),
EndpointDescription("Gets a teacher by their DOB and either TRN or NINO")]
[ProducesResponseType(typeof(GetTeacherResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(void), StatusCodes.Status404NotFound)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ public TeachersController(IMediator mediator)
}

[HttpGet("find")]
[SwaggerOperation(
OperationId = "FindTeachers",
Summary = "Find teachers",
Description = "Returns teachers matching the specified criteria")]
[EndpointName("FindTeachers"),
EndpointSummary("Find teachers"),
EndpointDescription("Returns teachers matching the specified criteria")]
[ProducesResponseType(typeof(FindTeachersResponse), StatusCodes.Status200OK)]
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.GetPerson)]
public async Task<IActionResult> FindTeachersAsync(FindTeachersRequest request)
Expand All @@ -31,10 +30,9 @@ public async Task<IActionResult> FindTeachersAsync(FindTeachersRequest request)
}

[HttpGet("{trn}")]
[SwaggerOperation(
OperationId = "GetTeacher",
Summary = "Get teacher",
Description = "Gets an individual teacher by their TRN")]
[EndpointName("GetTeacher"),
EndpointSummary("Get teacher"),
EndpointDescription("Gets an individual teacher by their TRN")]
[ProducesResponseType(typeof(GetTeacherResponse), StatusCodes.Status200OK)]
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.GetPerson)]
public async Task<IActionResult> GetTeacherAsync([FromRoute] GetTeacherRequest request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ namespace TeachingRecordSystem.Api.V2.Controllers;
public class UnlockTeacherController : ControllerBase
{
[HttpPut("{teacherId}")]
[SwaggerOperation(
OperationId = "UnlockTeacher",
Summary = "Unlock teacher",
Description = "Unlocks the teacher record allowing the teacher to sign in to the portals")]
[EndpointName("UnlockTeacher"),
EndpointSummary("Unlock teacher"),
EndpointDescription("Unlocks the teacher record allowing the teacher to sign in to the portals")]
[ProducesResponseType(typeof(UnlockTeacherResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status404NotFound)]
public IActionResult UnlockTeacher() => Ok(new UnlockTeacherResponse { HasBeenUnlocked = false });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,33 @@ public class CertificatesController : ControllerBase
{
[HttpGet]
[Route("qts")]
[SwaggerOperation(
OperationId = "GetQtsCertificate",
Summary = "Get QTS Certificate",
Description = "Returns a PDF of the QTS Certificate for the authenticated teacher.")]
[EndpointName("GetQtsCertificate"),
EndpointSummary("Get QTS Certificate"),
EndpointDescription("Returns a PDF of the QTS Certificate for the authenticated teacher.")]
[ProducesResponseType(typeof(void), StatusCodes.Status410Gone)]
public IActionResult GetQts() => StatusCode(StatusCodes.Status410Gone);

[HttpGet]
[Route("eyts")]
[SwaggerOperation(
OperationId = "GetEytsCertificate",
Summary = "Get EYTS Certificate",
Description = "Returns a PDF of the EYTS Certificate for the authenticated teacher.")]
[EndpointName("GetEytsCertificate"),
EndpointSummary("Get EYTS Certificate"),
EndpointDescription("Returns a PDF of the EYTS Certificate for the authenticated teacher.")]
[ProducesResponseType(typeof(void), StatusCodes.Status410Gone)]
public IActionResult GetEyts() => StatusCode(StatusCodes.Status410Gone);

[HttpGet]
[Route("induction")]
[SwaggerOperation(
OperationId = "GetInductionCertificate",
Summary = "Induction Certificate",
Description = "Returns a PDF of the Induction Certificate for the authenticated teacher.")]
[EndpointName("GetInductionCertificate"),
EndpointSummary("Induction Certificate"),
EndpointDescription("Returns a PDF of the Induction Certificate for the authenticated teacher.")]
[ProducesResponseType(typeof(void), StatusCodes.Status410Gone)]
public IActionResult GetInduction() => StatusCode(StatusCodes.Status410Gone);

[HttpGet]
[Route("npq/{qualificationId}")]
[SwaggerOperation(
OperationId = "GetNpqCertificate",
Summary = "NPQ Certificate",
Description = "Returns a PDF of the NPQ Certificate associated with the provided qualification ID.")]
[EndpointName("GetNpqCertificate"),
EndpointSummary("NPQ Certificate"),
EndpointDescription("Returns a PDF of the NPQ Certificate associated with the provided qualification ID.")]
[ProducesResponseType(typeof(void), StatusCodes.Status410Gone)]
public IActionResult GetNpq() => StatusCode(StatusCodes.Status410Gone);
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel;
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -14,14 +15,13 @@ public class TeacherController(ICommandDispatcher commandDispatcher, IMapper map
{
[Authorize(AuthorizationPolicies.IdentityUserWithTrn)]
[HttpGet]
[SwaggerOperation(
OperationId = "GetCurrentTeacher",
Summary = "Get the current teacher's details",
Description = "Gets the details for the authenticated teacher.")]
[EndpointName("GetCurrentTeacher"),
EndpointSummary("Get the current teacher's details"),
EndpointDescription("Gets the details for the authenticated teacher.")]
[ProducesResponseType(typeof(GetTeacherResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
public async Task<IActionResult> GetAsync(
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), SwaggerParameter("The additional properties to include in the response.")] GetTeacherRequestIncludes? include)
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), Description("The additional properties to include in the response.")] GetTeacherRequestIncludes? include)
{
var command = new GetPersonCommand(
Trn: User.FindFirstValue("trn")!,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using TeachingRecordSystem.Api.Infrastructure.ModelBinding;
Expand All @@ -12,17 +13,16 @@ namespace TeachingRecordSystem.Api.V3.V20240101.Controllers;
public class TeachersController(ICommandDispatcher commandDispatcher, IMapper mapper) : ControllerBase
{
[HttpGet("{trn}")]
[SwaggerOperation(
OperationId = "GetTeacherByTrn",
Summary = "Get teacher details by TRN",
Description = "Gets the details of the teacher corresponding to the given TRN.")]
[EndpointName("GetTeacherByTrn"),
EndpointSummary("Get teacher details by TRN"),
EndpointDescription("Gets the details of the teacher corresponding to the given TRN.")]
[ProducesResponseType(typeof(GetTeacherResponse), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.GetPerson)]
public async Task<IActionResult> GetAsync(
[FromRoute] string trn,
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), SwaggerParameter("The additional properties to include in the response.")] GetTeacherRequestIncludes? include)
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), Description("The additional properties to include in the response.")] GetTeacherRequestIncludes? include)
{
var command = new GetPersonCommand(
trn,
Expand All @@ -43,10 +43,9 @@ public async Task<IActionResult> GetAsync(
}

[HttpPost("name-changes")]
[SwaggerOperation(
OperationId = "CreateNameChange",
Summary = "Create name change request",
Description = "Creates a name change request for the teacher with the given TRN.")]
[EndpointName("CreateNameChange"),
EndpointSummary("Create name change request"),
EndpointDescription("Creates a name change request for the teacher with the given TRN.")]
[ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.UpdatePerson)]
Expand All @@ -70,10 +69,9 @@ public async Task<IActionResult> CreateNameChangeAsync(
}

[HttpPost("date-of-birth-changes")]
[SwaggerOperation(
OperationId = "CreateDobChange",
Summary = "Create DOB change request",
Description = "Creates a date of birth change request for the teacher with the given TRN.")]
[EndpointName("CreateDobChange"),
EndpointSummary("Create DOB change request"),
EndpointDescription("Creates a date of birth change request for the teacher with the given TRN.")]
[ProducesResponseType(typeof(void), StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.UpdatePerson)]
Expand All @@ -95,10 +93,9 @@ public async Task<IActionResult> CreateDateOfBirthChangeAsync(
}

[HttpGet("")]
[SwaggerOperation(
OperationId = "FindTeachers",
Summary = "Find teachers",
Description = "Finds teachers with a TRN matching the specified criteria.")]
[EndpointName("FindTeachers"),
EndpointSummary("Find teachers"),
EndpointDescription("Finds teachers with a TRN matching the specified criteria.")]
[ProducesResponseType(typeof(FindTeachersResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.GetPerson)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ namespace TeachingRecordSystem.Api.V3.V20240307.Controllers;
public class TrnRequestsController(ICommandDispatcher commandDispatcher, IMapper mapper) : ControllerBase
{
[HttpPost("")]
[SwaggerOperation(
OperationId = "CreateTrnRequest",
Summary = "Creates a TRN request",
Description = """
[EndpointName("CreateTrnRequest"),
EndpointSummary("Creates a TRN request"),
EndpointDescription("""
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.
Expand Down Expand Up @@ -47,10 +46,9 @@ public async Task<IActionResult> CreateTrnRequestAsync(
}

[HttpGet("")]
[SwaggerOperation(
OperationId = "GetTrnRequest",
Summary = "Get the TRN request's details",
Description = """
[EndpointName("GetTrnRequest"),
EndpointSummary("Get the TRN request's details"),
EndpointDescription("""
Gets the TRN request for the requestId specified in the query string.
If the request's status is 'Completed' a TRN will also be returned.
""")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System.ComponentModel;
using TeachingRecordSystem.Core.ApiSchema.V3.V20240307.Dtos;

namespace TeachingRecordSystem.Api.V3.V20240307.Requests;

public record CreateTrnRequestRequest
{
[SwaggerSchema(description:
[Description(
"A unique ID that represents this request. " +
"If a request has already been created with this ID then that existing record's result is returned.")]
public required string RequestId { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ namespace TeachingRecordSystem.Api.V3.V20240412.Controllers;
public class TeacherController(ICommandDispatcher commandDispatcher, IMapper mapper) : ControllerBase
{
[HttpPost("name-changes")]
[SwaggerOperation(
OperationId = "CreateNameChange",
Summary = "Create name change request",
Description = "Creates a name change request for the authenticated teacher.")]
[EndpointName("CreateNameChange"),
EndpointSummary("Create name change request"),
EndpointDescription("Creates a name change request for the authenticated teacher.")]
[ProducesResponseType(typeof(CreateNameChangeResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[Authorize(AuthorizationPolicies.IdentityUserWithTrn)]
Expand All @@ -38,10 +37,9 @@ public async Task<IActionResult> CreateNameChangeAsync([FromBody] CreateNameChan
}

[HttpPost("date-of-birth-changes")]
[SwaggerOperation(
OperationId = "CreateDobChange",
Summary = "Create DOB change request",
Description = "Creates a date of birth change request for the authenticated teacher.")]
[EndpointName("CreateDobChange"),
EndpointSummary("Create DOB change request"),
EndpointDescription("Creates a date of birth change request for the authenticated teacher.")]
[ProducesResponseType(typeof(CreateDateOfBirthChangeResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[Authorize(AuthorizationPolicies.IdentityUserWithTrn)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel;
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -14,14 +15,13 @@ public class TeacherController(ICommandDispatcher commandDispatcher, IMapper map
{
[Authorize(AuthorizationPolicies.IdentityUserWithTrn)]
[HttpGet]
[SwaggerOperation(
OperationId = "GetCurrentTeacher",
Summary = "Get the current teacher's details",
Description = "Gets the details for the authenticated teacher.")]
[EndpointName("GetCurrentTeacher"),
EndpointSummary("Get the current teacher's details"),
EndpointDescription("Gets the details for the authenticated teacher.")]
[ProducesResponseType(typeof(GetTeacherResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
public async Task<IActionResult> GetAsync(
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), SwaggerParameter("The additional properties to include in the response.")] GetTeacherRequestIncludes? include)
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), Description("The additional properties to include in the response.")] GetTeacherRequestIncludes? include)
{
var command = new GetPersonCommand(
Trn: User.FindFirstValue("trn")!,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using TeachingRecordSystem.Api.Infrastructure.ModelBinding;
Expand All @@ -12,18 +13,17 @@ namespace TeachingRecordSystem.Api.V3.V20240416.Controllers;
public class TeachersController(ICommandDispatcher commandDispatcher, IMapper mapper) : ControllerBase
{
[HttpGet("{trn}")]
[SwaggerOperation(
OperationId = "GetTeacherByTrn",
Summary = "Get teacher details by TRN",
Description = "Gets the details of the teacher corresponding to the given TRN.")]
[EndpointName("GetTeacherByTrn"),
EndpointSummary("Get teacher details by TRN"),
EndpointDescription("Gets the details of the teacher corresponding to the given TRN.")]
[ProducesResponseType(typeof(GetTeacherResponse), StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
[Authorize(Policy = AuthorizationPolicies.ApiKey, Roles = ApiRoles.GetPerson)]
public async Task<IActionResult> GetAsync(
[FromRoute] string trn,
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), SwaggerParameter("The additional properties to include in the response.")] GetTeacherRequestIncludes? include,
[FromQuery, SwaggerParameter("Adds an additional check that the record has the specified dateOfBirth, if provided.")] DateOnly? dateOfBirth)
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), Description("The additional properties to include in the response.")] GetTeacherRequestIncludes? include,
[FromQuery, Description("Adds an additional check that the record has the specified dateOfBirth, if provided.")] DateOnly? dateOfBirth)
{
var command = new GetPersonCommand(
trn,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.ComponentModel;
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -14,14 +15,13 @@ public class PersonController(ICommandDispatcher commandDispatcher, IMapper mapp
{
[Authorize(AuthorizationPolicies.IdentityUserWithTrn)]
[HttpGet]
[SwaggerOperation(
OperationId = "GetCurrentPerson",
Summary = "Get the authenticated person's details",
Description = "Gets the details for the authenticated person.")]
[EndpointName("GetCurrentPerson"),
EndpointSummary("Get the authenticated person's details"),
EndpointDescription("Gets the details for the authenticated person.")]
[ProducesResponseType(typeof(GetPersonResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(void), StatusCodes.Status403Forbidden)]
public async Task<IActionResult> GetAsync(
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), SwaggerParameter("The additional properties to include in the response.")] GetPersonRequestIncludes? include)
[FromQuery, ModelBinder(typeof(FlagsEnumStringListModelBinder)), Description("The additional properties to include in the response.")] GetPersonRequestIncludes? include)
{
var command = new GetPersonCommand(
Trn: User.FindFirstValue("trn")!,
Expand All @@ -40,10 +40,9 @@ public async Task<IActionResult> GetAsync(
}

[HttpPost("name-changes")]
[SwaggerOperation(
OperationId = "CreateNameChange",
Summary = "Create name change request",
Description = "Creates a name change request for the authenticated teacher.")]
[EndpointName("CreateNameChange"),
EndpointSummary("Create name change request"),
EndpointDescription("Creates a name change request for the authenticated teacher.")]
[ProducesResponseType(typeof(CreateNameChangeResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[Authorize(AuthorizationPolicies.IdentityUserWithTrn)]
Expand All @@ -67,10 +66,9 @@ public async Task<IActionResult> CreateNameChangeAsync(
}

[HttpPost("date-of-birth-changes")]
[SwaggerOperation(
OperationId = "CreateDobChange",
Summary = "Create DOB change request",
Description = "Creates a date of birth change request for the authenticated teacher.")]
[EndpointName("CreateDobChange"),
EndpointSummary("Create DOB change request"),
EndpointDescription("Creates a date of birth change request for the authenticated teacher.")]
[ProducesResponseType(typeof(CreateDateOfBirthChangeResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[Authorize(AuthorizationPolicies.IdentityUserWithTrn)]
Expand Down
Loading
Loading