diff --git a/PostalRegistry.sln b/PostalRegistry.sln index f6b9d772..747c21db 100755 --- a/PostalRegistry.sln +++ b/PostalRegistry.sln @@ -30,10 +30,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.Tests", "tes EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.Projections.Legacy", "src\PostalRegistry.Projections.Legacy\PostalRegistry.Projections.Legacy.csproj", "{0E08B66D-9320-47D8-980C-68753A0C0574}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.BPostReader", "src\PostalRegistry.BPostReader\PostalRegistry.BPostReader.csproj", "{13568DA1-586D-4AD0-8834-8DBADD95207C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.EventGenerator.CrabPostinfo", "src\PostalRegistry.EventGenerator.CrabPostinfo\PostalRegistry.EventGenerator.CrabPostinfo.csproj", "{8CF8A3F9-253A-40FD-BBA8-9E4FCA74BFBC}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{50D64CB2-C9C2-4786-A350-DA4239162FBA}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PostalRegistry.Structurizr", "docs\PostalRegistry.Structurizr\PostalRegistry.Structurizr.csproj", "{73D40942-1B6E-4BCF-9F4F-332DEAC48A67}" @@ -87,14 +83,6 @@ Global {0E08B66D-9320-47D8-980C-68753A0C0574}.Debug|Any CPU.Build.0 = Debug|Any CPU {0E08B66D-9320-47D8-980C-68753A0C0574}.Release|Any CPU.ActiveCfg = Release|Any CPU {0E08B66D-9320-47D8-980C-68753A0C0574}.Release|Any CPU.Build.0 = Release|Any CPU - {13568DA1-586D-4AD0-8834-8DBADD95207C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {13568DA1-586D-4AD0-8834-8DBADD95207C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {13568DA1-586D-4AD0-8834-8DBADD95207C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {13568DA1-586D-4AD0-8834-8DBADD95207C}.Release|Any CPU.Build.0 = Release|Any CPU - {8CF8A3F9-253A-40FD-BBA8-9E4FCA74BFBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8CF8A3F9-253A-40FD-BBA8-9E4FCA74BFBC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8CF8A3F9-253A-40FD-BBA8-9E4FCA74BFBC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8CF8A3F9-253A-40FD-BBA8-9E4FCA74BFBC}.Release|Any CPU.Build.0 = Release|Any CPU {73D40942-1B6E-4BCF-9F4F-332DEAC48A67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73D40942-1B6E-4BCF-9F4F-332DEAC48A67}.Debug|Any CPU.Build.0 = Debug|Any CPU {73D40942-1B6E-4BCF-9F4F-332DEAC48A67}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -145,8 +133,6 @@ Global {488B07C6-FEDE-4F8D-A6E2-A7DFED79BBA1} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} {8F656DE8-12B1-4FFB-8404-16C17558E448} = {A82FA45A-B77F-48AA-8E30-C2928DCAF7EF} {0E08B66D-9320-47D8-980C-68753A0C0574} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} - {13568DA1-586D-4AD0-8834-8DBADD95207C} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} - {8CF8A3F9-253A-40FD-BBA8-9E4FCA74BFBC} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} {73D40942-1B6E-4BCF-9F4F-332DEAC48A67} = {50D64CB2-C9C2-4786-A350-DA4239162FBA} {1A0113BC-1F80-4213-B85D-DC97B85A2BA9} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} {A2902925-92FC-47D3-A040-CD06FCFC34CF} = {81BE6CDF-434E-42AB-9CB1-B5E7A26DC317} diff --git a/src/PostalRegistry.Api.Import/BPostImport/BPostImportController.cs b/src/PostalRegistry.Api.Import/BPostImport/BPostImportController.cs deleted file mode 100644 index ece026ee..00000000 --- a/src/PostalRegistry.Api.Import/BPostImport/BPostImportController.cs +++ /dev/null @@ -1,67 +0,0 @@ -namespace PostalRegistry.Api.Import.BPostImport -{ - using System; - using System.Threading; - using System.Threading.Tasks; - using Asp.Versioning; - using Be.Vlaanderen.Basisregisters.Api; - using Be.Vlaanderen.Basisregisters.Api.Exceptions; - using Be.Vlaanderen.Basisregisters.CommandHandling; - using Be.Vlaanderen.Basisregisters.CommandHandling.Idempotency; - using Infrastructure; - using Microsoft.AspNetCore.Http; - using Microsoft.AspNetCore.Mvc; - using Newtonsoft.Json.Converters; - using Requests; - using Swashbuckle.AspNetCore.Filters; - using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; - - [ApiVersion("1.0")] - [AdvertiseApiVersions("1.0")] - [ApiRoute("bpostimport")] - [ApiExplorerSettings(GroupName = "BPost Import")] - public class BPostImportController : ApiBusController - { - public BPostImportController(ICommandHandlerResolver bus) : base(bus) { } - - /// - /// Import een bpost item. - /// - /// - /// Optionele unieke id voor het verzoek. - /// - /// - /// Als het verzoek aanvaard is. - /// Als het verzoek ongeldige data bevat. - /// Als er een interne fout is opgetreden. - /// - [HttpPost] - [ProducesResponseType(typeof(void), StatusCodes.Status202Accepted)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] - [SwaggerRequestExample(typeof(RegisterBPostImportRequestExample), typeof(RegisterBPostImportRequestExample))] - [SwaggerResponseExample(StatusCodes.Status202Accepted, typeof(RegisterBPostImportResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status400BadRequest, typeof(BadRequestResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamples))] - public async Task Post( - [FromServices] IdempotencyContext context, - [FromCommandId] Guid commandId, - [FromBody] RegisterBPostImportRequest registerBPostImport, - CancellationToken cancellationToken) - { - if (!ModelState.IsValid) - return BadRequest(ModelState); // TODO: Check what this returns in the response - - return await IdempotentCommandHandlerDispatch( - context, - commandId, - () => RegisterBPostImportRequestMapping.Map(registerBPostImport), - cancellationToken); - } - } - - public class RegisterBPostImportResponseExamples : IExamplesProvider - { - public object GetExamples() => new { }; - } -} diff --git a/src/PostalRegistry.Api.Import/BPostImport/Requests/RegisterBPostImportRequest.cs b/src/PostalRegistry.Api.Import/BPostImport/Requests/RegisterBPostImportRequest.cs deleted file mode 100644 index 6986b354..00000000 --- a/src/PostalRegistry.Api.Import/BPostImport/Requests/RegisterBPostImportRequest.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace PostalRegistry.Api.Import.BPostImport.Requests -{ - using System.ComponentModel.DataAnnotations; - using Newtonsoft.Json; - using PostalInformation; - using Swashbuckle.AspNetCore.Filters; - - public class RegisterBPostImportRequest - { - /// Type van het bpost item. - [Required] - public string Type { get; set; } - - /// Het bpost item. - [Required] - public string BPostItem { get; set; } - } - - public class RegisterBPostImportRequestExample : IExamplesProvider - { - public RegisterBPostImportRequest GetExamples() - => new RegisterBPostImportRequest - { - Type = "PostalRegistry.PostalInformation.Commands.BPost.ImportPostalInformationFromBPost", - BPostItem = "{}" - }; - } - - public static class RegisterBPostImportRequestMapping - { - public static dynamic Map(RegisterBPostImportRequest message) - { - var assembly = typeof(PostalInformation).Assembly; - var type = assembly.GetType(message.Type); - - return JsonConvert.DeserializeObject(message.BPostItem, type); - } - } -} diff --git a/src/PostalRegistry.Api.Import/CrabImport/CrabImportController.cs b/src/PostalRegistry.Api.Import/CrabImport/CrabImportController.cs deleted file mode 100644 index d3ef4852..00000000 --- a/src/PostalRegistry.Api.Import/CrabImport/CrabImportController.cs +++ /dev/null @@ -1,67 +0,0 @@ -namespace PostalRegistry.Api.Import.CrabImport -{ - using System; - using System.Threading; - using System.Threading.Tasks; - using Asp.Versioning; - using Be.Vlaanderen.Basisregisters.Api; - using Be.Vlaanderen.Basisregisters.Api.Exceptions; - using Be.Vlaanderen.Basisregisters.CommandHandling; - using Be.Vlaanderen.Basisregisters.CommandHandling.Idempotency; - using Infrastructure; - using Microsoft.AspNetCore.Http; - using Microsoft.AspNetCore.Mvc; - using Newtonsoft.Json.Converters; - using Requests; - using Swashbuckle.AspNetCore.Filters; - using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; - - [ApiVersion("1.0")] - [AdvertiseApiVersions("1.0")] - [ApiRoute("crabimport")] - [ApiExplorerSettings(GroupName = "CRAB Import")] - public class CrabImportController : ApiBusController - { - public CrabImportController(ICommandHandlerResolver bus) : base(bus) { } - - /// - /// Import een CRAB item. - /// - /// - /// Optionele unieke id voor het verzoek. - /// - /// - /// Als het verzoek aanvaard is. - /// Als het verzoek ongeldige data bevat. - /// Als er een interne fout is opgetreden. - /// - [HttpPost] - [ProducesResponseType(typeof(void), StatusCodes.Status202Accepted)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] - [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] - [SwaggerRequestExample(typeof(RegisterCrabImportRequest), typeof(RegisterCrabImportRequestExample))] - [SwaggerResponseExample(StatusCodes.Status202Accepted, typeof(RegisterCrabImportResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status400BadRequest, typeof(BadRequestResponseExamples))] - [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamples))] - public async Task Post( - [FromServices] IdempotencyContext context, - [FromCommandId] Guid commandId, - [FromBody] RegisterCrabImportRequest registerCrabImport, - CancellationToken cancellationToken = default) - { - if (!ModelState.IsValid) - return BadRequest(ModelState); // TODO: Check what this returns in the response - - return await IdempotentCommandHandlerDispatch( - context, - commandId, - () => RegisterCrabImportRequestMapping.Map(registerCrabImport), - cancellationToken); - } - } - - public class RegisterCrabImportResponseExamples : IExamplesProvider - { - public object GetExamples() => new { }; - } -} diff --git a/src/PostalRegistry.Api.Import/CrabImport/Requests/RegisterCrabImportRequest.cs b/src/PostalRegistry.Api.Import/CrabImport/Requests/RegisterCrabImportRequest.cs deleted file mode 100644 index 3e0d7a36..00000000 --- a/src/PostalRegistry.Api.Import/CrabImport/Requests/RegisterCrabImportRequest.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace PostalRegistry.Api.Import.CrabImport.Requests -{ - using System.ComponentModel.DataAnnotations; - using Newtonsoft.Json; - using PostalInformation; - using Swashbuckle.AspNetCore.Filters; - - public class RegisterCrabImportRequest - { - /// Type van het CRAB item. - [Required] - public string Type { get; set; } - - /// Het CRAB item. - [Required] - public string CrabItem { get; set; } - } - - public class RegisterCrabImportRequestExample : IExamplesProvider - { - public RegisterCrabImportRequest GetExamples() - => new RegisterCrabImportRequest - { - Type = "PostalRegistry.PostalInformation.Commands.Crab.ImportPostalInformationFromCrab", - CrabItem = "{}" - }; - } - - public static class RegisterCrabImportRequestMapping - { - public static dynamic Map(RegisterCrabImportRequest message) - { - var assembly = typeof(PostalInformation).Assembly; - var type = assembly.GetType(message.Type); - - return JsonConvert.DeserializeObject(message.CrabItem, type); - } - } -} diff --git a/src/PostalRegistry.Api.Import/PostalInformationController-UpdatePostalNames.cs b/src/PostalRegistry.Api.Import/PostalInformationController-UpdatePostalNames.cs index 3636df8c..8cec8e48 100644 --- a/src/PostalRegistry.Api.Import/PostalInformationController-UpdatePostalNames.cs +++ b/src/PostalRegistry.Api.Import/PostalInformationController-UpdatePostalNames.cs @@ -63,7 +63,7 @@ private static PostalName MapPostalName(Postnaam postnaam) case Taal.EN: return new PostalName(postnaam.GeografischeNaam.Spelling, Language.English); default: - throw new ArgumentOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(postnaam.GeografischeNaam.Taal), postnaam.GeografischeNaam.Taal, null); } } }