-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: OR-1217 allow vereniging to be removed and block further updates
- Loading branch information
Showing
64 changed files
with
1,941 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
src/AssociationRegistry.Acm.Schema/VerenigingenPerInsz/VerenigingDocument.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
namespace AssociationRegistry.Acm.Schema.VerenigingenPerInsz; | ||
|
||
using Marten.Metadata; | ||
using Marten.Schema; | ||
|
||
public class VerenigingDocument | ||
public class VerenigingDocument: ISoftDeleted | ||
{ | ||
[Identity] | ||
public string VCode { get; set; } = null!; | ||
|
||
public string Naam { get; set; } = null!; | ||
public string Status { get; set; } = null!; | ||
public string KboNummer { get; set; } = null!; | ||
public bool Deleted { get; set; } | ||
public DateTimeOffset? DeletedAt { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...nfrastructure/ProjectionHostController.cs → ...ojectieBeheer/ProjectionHostController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...tionRegistry.Admin.Api/Verenigingen/Verwijder/RequestModels/VerwijderVerenigingRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace AssociationRegistry.Admin.Api.Verenigingen.Verwijderen.RequestModels; | ||
|
||
using System.ComponentModel.DataAnnotations; | ||
using System.Runtime.Serialization; | ||
|
||
[DataContract] | ||
public class VerwijderVerenigingRequest | ||
{ | ||
/// <summary> | ||
/// De reden waarom de vereniging verwijderd werd. | ||
/// </summary> | ||
[DataMember] | ||
[Required] | ||
public string Reden { get; set; } | ||
} |
56 changes: 56 additions & 0 deletions
56
src/AssociationRegistry.Admin.Api/Verenigingen/Verwijder/VerwijderVerenigingController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
namespace AssociationRegistry.Admin.Api.Verenigingen.Verwijder; | ||
|
||
using Acties.VerwijderVereniging; | ||
using Infrastructure.ConfigurationBindings; | ||
using Infrastructure.Extensions; | ||
using Infrastructure.Middleware; | ||
using Framework; | ||
using Vereniging; | ||
using Be.Vlaanderen.Basisregisters.Api; | ||
using FluentValidation; | ||
using Infrastructure.Swagger.Annotations; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using System.Threading.Tasks; | ||
using Verwijderen.RequestModels; | ||
using Wolverine; | ||
|
||
[ApiVersion("1.0")] | ||
[AdvertiseApiVersions("1.0")] | ||
[ApiRoute("verenigingen")] | ||
[ApiExplorerSettings(IgnoreApi = true)] | ||
[Authorize(Policy = Program.SuperAdminPolicyName)] | ||
public class VerwijderVerenigingController : ApiController | ||
{ | ||
private readonly IMessageBus _bus; | ||
private readonly AppSettings _appsettings; | ||
private readonly IValidator<VerwijderVerenigingRequest> _validator; | ||
|
||
public VerwijderVerenigingController(IMessageBus bus, AppSettings appsettings, IValidator<VerwijderVerenigingRequest> validator) | ||
{ | ||
_bus = bus; | ||
_appsettings = appsettings; | ||
_validator = validator; | ||
} | ||
|
||
[HttpDelete("{vCode}")] | ||
[ConsumesJson] | ||
[ProducesJson] | ||
public async Task<IActionResult> Delete( | ||
[FromBody] VerwijderVerenigingRequest? request, | ||
[FromRoute] string vCode, | ||
[FromServices] ICommandMetadataProvider metadataProvider) | ||
{ | ||
await _validator.NullValidateAndThrowAsync(request); | ||
|
||
var command = new VerwijderVerenigingCommand(VCode.Create(vCode), request.Reden); | ||
|
||
var metaData = metadataProvider.GetMetadata(); | ||
var envelope = new CommandEnvelope<VerwijderVerenigingCommand>(command, metaData); | ||
var stopResult = await _bus.InvokeAsync<CommandResult>(envelope); | ||
|
||
if (!stopResult.HasChanges()) return Ok(); | ||
|
||
return this.AcceptedCommand(_appsettings, stopResult); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...sociationRegistry.Admin.Api/Verenigingen/Verwijder/VerwijderVerenigingRequestValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
namespace AssociationRegistry.Admin.Api.Verenigingen.Verwijderen; | ||
|
||
using FluentValidation; | ||
using Infrastructure.Validation; | ||
using RequestModels; | ||
|
||
public class VerwijderVerenigingRequestValidator : AbstractValidator<VerwijderVerenigingRequest> | ||
{ | ||
public VerwijderVerenigingRequestValidator() | ||
{ | ||
this.RequireNotNullOrEmpty(request => request.Reden); | ||
|
||
RuleFor(request => request.Reden).MustNotContainHtml(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.