Skip to content

Commit

Permalink
fix: streetname sync controller
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Jul 2, 2024
1 parent 2e42f65 commit a0a8fc5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/StreetNameRegistry.Api.Oslo/StreetName/StreetNameController.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace StreetNameRegistry.Api.Oslo.StreetName
{
using System.Net.Mime;
using System.Threading;
using System.Threading.Tasks;
using Asp.Versioning;
Expand All @@ -18,6 +19,7 @@ namespace StreetNameRegistry.Api.Oslo.StreetName
using Microsoft.AspNetCore.Mvc;
using Query;
using Swashbuckle.AspNetCore.Filters;
using Sync;
using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails;

[ApiVersion("2.0")]
Expand Down Expand Up @@ -112,5 +114,34 @@ public async Task<IActionResult> Count(

return Ok(result);
}

/// <summary>
/// Vraag een lijst met wijzigingen van straatnamen op.
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[HttpGet("sync")]
[Produces("text/xml")]
[ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)]
[SwaggerResponseExample(StatusCodes.Status200OK, typeof(StreetNameSyndicationResponseExamples))]
[SwaggerResponseExample(StatusCodes.Status400BadRequest, typeof(BadRequestResponseExamples))]
[SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamples))]
public async Task<IActionResult> Sync(CancellationToken cancellationToken = default)
{
var filtering = Request.ExtractFilteringRequest<StreetNameSyndicationFilter>();
var sorting = Request.ExtractSortingRequest();
var pagination = Request.ExtractPaginationRequest();

var result = await _mediator.Send(new SyndicationRequest(filtering, sorting, pagination), cancellationToken);

return new ContentResult
{
Content = result.Content,
ContentType = MediaTypeNames.Text.Xml,
StatusCode = StatusCodes.Status200OK
};
}
}
}

0 comments on commit a0a8fc5

Please sign in to comment.