Skip to content

Commit

Permalink
fix: or-1217 change validation message for association deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Lesage authored and QuintenGreenstack committed Jan 16, 2024
1 parent 79fb5e7 commit 35f6b56
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 63 deletions.
92 changes: 30 additions & 62 deletions src/AssociationRegistry.Admin.Api/ValidationMessages.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/AssociationRegistry.Admin.Api/ValidationMessages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<data name="Status404Detail" xml:space="preserve">
<value>De gevraagde vereniging werd niet gevonden.</value>
</data>
<data name="Status404Deleted" xml:space="preserve">
<value>Deze vereniging werd verwijderd.</value>
</data>
<data name="Status412Detail" xml:space="preserve">
<value>Het detail van de gevraagde vereniging heeft niet de verwachte sequentiewaarde.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -67,12 +69,16 @@ public async Task<IActionResult> Detail(
throw new UnexpectedAggregateVersionException(ValidationMessages.Status412Detail);

var maybeVereniging = await session.Query<BeheerVerenigingDetailDocument>()
.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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public async Task Then_we_get_a_detail()
var problemDetails = JsonConvert.DeserializeObject<ProblemDetails>(content);

problemDetails.Detail.Should().NotBeEmpty();
problemDetails.Detail.Should().Be(ValidationMessages.Status404Detail);
problemDetails.Detail.Should().Be(ValidationMessages.Status404Deleted);
}
}

0 comments on commit 35f6b56

Please sign in to comment.