Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: or-1217 change validation message for association deleted #600

Merged
merged 1 commit into from
Jan 16, 2024
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
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);
}
}
Loading