From ea34801709c389cf9fdc37d4576d44b4078254c7 Mon Sep 17 00:00:00 2001 From: Jan Lesage Date: Mon, 15 Jan 2024 16:35:37 +0100 Subject: [PATCH] fix: or-1217 change validation message for association deleted --- .../ValidationMessages.Designer.cs | 92 ++++++------------- .../ValidationMessages.resx | 3 + .../Detail/DetailVerenigingenController.cs | 6 ++ .../Given_A_Vereniging_Has_Been_Removed.cs | 2 +- 4 files changed, 40 insertions(+), 63 deletions(-) diff --git a/src/AssociationRegistry.Admin.Api/ValidationMessages.Designer.cs b/src/AssociationRegistry.Admin.Api/ValidationMessages.Designer.cs index ef6f5c6ac..0fe8e1ca4 100644 --- a/src/AssociationRegistry.Admin.Api/ValidationMessages.Designer.cs +++ b/src/AssociationRegistry.Admin.Api/ValidationMessages.Designer.cs @@ -11,46 +11,32 @@ namespace AssociationRegistry.Admin.Api { using System; - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [System.Diagnostics.DebuggerNonUserCodeAttribute()] + [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class ValidationMessages { - private static global::System.Resources.ResourceManager resourceMan; + private static System.Resources.ResourceManager resourceMan; - private static global::System.Globalization.CultureInfo resourceCulture; + private static System.Globalization.CultureInfo resourceCulture; - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal ValidationMessages() { } - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Resources.ResourceManager ResourceManager { get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AssociationRegistry.Admin.Api.ValidationMessages", typeof(ValidationMessages).Assembly); + if (object.Equals(null, resourceMan)) { + System.Resources.ResourceManager temp = new System.Resources.ResourceManager("AssociationRegistry.Admin.Api.ValidationMessages", typeof(ValidationMessages).Assembly); resourceMan = temp; } return resourceMan; } } - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)] + public static System.Globalization.CultureInfo Culture { get { return resourceCulture; } @@ -59,75 +45,57 @@ internal ValidationMessages() { } } - /// - /// Looks up a localized string similar to De gevraagde vereniging werd niet gevonden.. - /// - public static string Status404Detail { + public static string VeldIsVerplicht { get { - return ResourceManager.GetString("Status404Detail", resourceCulture); + return ResourceManager.GetString("VeldIsVerplicht", resourceCulture); } } - /// - /// Looks up a localized string similar to De historiek van de gevraagde vereniging is niet gevonden.. - /// - public static string Status404Historiek { + public static string Status404Detail { get { - return ResourceManager.GetString("Status404Historiek", resourceCulture); + return ResourceManager.GetString("Status404Detail", resourceCulture); } } - /// - /// Looks up a localized string similar to De gevraagde vereniging werd niet gevonden.. - /// - public static string Status404NotFound { + public static string Status404Deleted { get { - return ResourceManager.GetString("Status404NotFound", resourceCulture); + return ResourceManager.GetString("Status404Deleted", resourceCulture); } } - /// - /// Looks up a localized string similar to Er zijn één of meerdere mogelijke duplicaten van deze vereniging gevonden.. - /// - public static string Status409RegistratieFeitelijkeVereniging { + public static string Status412Detail { get { - return ResourceManager.GetString("Status409RegistratieFeitelijkeVereniging", resourceCulture); + return ResourceManager.GetString("Status412Detail", resourceCulture); } } - /// - /// Looks up a localized string similar to Het detail van de gevraagde vereniging heeft niet de verwachte sequentiewaarde.. - /// - public static string Status412Detail { + public static string Status404Historiek { get { - return ResourceManager.GetString("Status412Detail", resourceCulture); + return ResourceManager.GetString("Status404Historiek", resourceCulture); } } - /// - /// Looks up a localized string similar to De historiek van de gevraagde vereniging heeft niet de verwachte sequentiewaarde.. - /// public static string Status412Historiek { get { return ResourceManager.GetString("Status412Historiek", resourceCulture); } } - /// - /// Looks up a localized string similar to De gevraagde vereniging heeft niet de verwachte sequentiewaarde.. - /// + public static string Status409RegistratieFeitelijkeVereniging { + get { + return ResourceManager.GetString("Status409RegistratieFeitelijkeVereniging", resourceCulture); + } + } + public static string Status412PreconditionFailed { get { return ResourceManager.GetString("Status412PreconditionFailed", resourceCulture); } } - /// - /// Looks up a localized string similar to '{0}' is verplicht.. - /// - public static string VeldIsVerplicht { + public static string Status404NotFound { get { - return ResourceManager.GetString("VeldIsVerplicht", resourceCulture); + return ResourceManager.GetString("Status404NotFound", resourceCulture); } } } diff --git a/src/AssociationRegistry.Admin.Api/ValidationMessages.resx b/src/AssociationRegistry.Admin.Api/ValidationMessages.resx index fb055bbac..39b3684cc 100644 --- a/src/AssociationRegistry.Admin.Api/ValidationMessages.resx +++ b/src/AssociationRegistry.Admin.Api/ValidationMessages.resx @@ -23,6 +23,9 @@ De gevraagde vereniging werd niet gevonden. + + Deze vereniging werd verwijderd. + Het detail van de gevraagde vereniging heeft niet de verwachte sequentiewaarde. diff --git a/src/AssociationRegistry.Admin.Api/Verenigingen/Detail/DetailVerenigingenController.cs b/src/AssociationRegistry.Admin.Api/Verenigingen/Detail/DetailVerenigingenController.cs index 706c2a4b4..303fb4f0f 100644 --- a/src/AssociationRegistry.Admin.Api/Verenigingen/Detail/DetailVerenigingenController.cs +++ b/src/AssociationRegistry.Admin.Api/Verenigingen/Detail/DetailVerenigingenController.cs @@ -9,11 +9,13 @@ namespace AssociationRegistry.Admin.Api.Verenigingen.Detail; using Infrastructure.Swagger.Annotations; using Infrastructure.Swagger.Examples; using Marten; +using Marten.Linq.SoftDeletes; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using ResponseModels; using Schema.Detail; using Swashbuckle.AspNetCore.Filters; +using System.Linq; using System.Threading.Tasks; using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails; @@ -67,12 +69,16 @@ public async Task Detail( throw new UnexpectedAggregateVersionException(ValidationMessages.Status412Detail); var maybeVereniging = await session.Query() + .Where(x => x.MaybeDeleted()) .WithVCode(vCode) .SingleOrDefaultAsync(); if (maybeVereniging is not { } vereniging) return await Response.WriteNotFoundProblemDetailsAsync(problemDetailsHelper, ValidationMessages.Status404Detail); + if (maybeVereniging.Deleted) + return await Response.WriteNotFoundProblemDetailsAsync(problemDetailsHelper, ValidationMessages.Status404Deleted); + Response.AddETagHeader(vereniging.Metadata.Version); return Ok(_mapper.Map(vereniging)); diff --git a/test/AssociationRegistry.Test.Admin.Api/When_Retrieving_Detail/Given_A_Vereniging_Has_Been_Removed.cs b/test/AssociationRegistry.Test.Admin.Api/When_Retrieving_Detail/Given_A_Vereniging_Has_Been_Removed.cs index 25fe73c55..e3228796e 100644 --- a/test/AssociationRegistry.Test.Admin.Api/When_Retrieving_Detail/Given_A_Vereniging_Has_Been_Removed.cs +++ b/test/AssociationRegistry.Test.Admin.Api/When_Retrieving_Detail/Given_A_Vereniging_Has_Been_Removed.cs @@ -37,6 +37,6 @@ public async Task Then_we_get_a_detail() var problemDetails = JsonConvert.DeserializeObject(content); problemDetails.Detail.Should().NotBeEmpty(); - problemDetails.Detail.Should().Be(ValidationMessages.Status404Detail); + problemDetails.Detail.Should().Be(ValidationMessages.Status404Deleted); } }