diff --git a/paket.dependencies b/paket.dependencies
index 0d887d3ce..3660f7860 100644
--- a/paket.dependencies
+++ b/paket.dependencies
@@ -25,9 +25,9 @@ nuget Be.Vlaanderen.Basisregisters.PostalRegistry.Api.Oslo 5.0.0 c
nuget Be.Vlaanderen.Basisregisters.StreetNameRegistry.Api.Legacy 4.0.7 copy_content_to_output_dir: always
nuget Be.Vlaanderen.Basisregisters.StreetNameRegistry.Api.Oslo 4.0.7 copy_content_to_output_dir: always
nuget Be.Vlaanderen.Basisregisters.StreetNameRegistry.Api.BackOffice.Abstractions 4.0.7 copy_content_to_output_dir: always
-nuget Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Legacy 4.1.10 copy_content_to_output_dir: always
-nuget Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Oslo 4.1.10 copy_content_to_output_dir: always
-nuget Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.BackOffice.Abstractions 4.1.10 copy_content_to_output_dir: always
+nuget Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Legacy 4.2.0 copy_content_to_output_dir: always
+nuget Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Oslo 4.2.0 copy_content_to_output_dir: always
+nuget Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.BackOffice.Abstractions 4.2.0 copy_content_to_output_dir: always
nuget Be.Vlaanderen.Basisregisters.AddressRegistry.Api.Legacy 4.0.8 copy_content_to_output_dir: always
nuget Be.Vlaanderen.Basisregisters.AddressRegistry.Api.Oslo 4.0.8 copy_content_to_output_dir: always
nuget Be.Vlaanderen.Basisregisters.AddressRegistry.Api.BackOffice.Abstractions 4.0.8 copy_content_to_output_dir: always
diff --git a/paket.lock b/paket.lock
index 09936cb4d..8d53c4964 100644
--- a/paket.lock
+++ b/paket.lock
@@ -179,11 +179,11 @@ NUGET
Microsoft.Data.SqlClient (>= 5.2)
System.Collections.Immutable (>= 8.0)
Be.Vlaanderen.Basisregisters.Build.Pipeline (7.2.5)
- Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.BackOffice.Abstractions (4.1.10) - copy_content_to_output_dir: always
+ Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.BackOffice.Abstractions (4.2) - copy_content_to_output_dir: always
Be.Vlaanderen.Basisregisters.Api (>= 23.1)
MediatR.Contracts (>= 2.0.1)
- Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Legacy (4.1.10) - copy_content_to_output_dir: always
- Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Oslo (4.1.10) - copy_content_to_output_dir: always
+ Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Legacy (4.2) - copy_content_to_output_dir: always
+ Be.Vlaanderen.Basisregisters.BuildingRegistry.Api.Oslo (4.2) - copy_content_to_output_dir: always
Be.Vlaanderen.Basisregisters.CommandHandling (9.0.1)
Be.Vlaanderen.Basisregisters.CommandHandling.Idempotency (9.0.1)
Be.Vlaanderen.Basisregisters.CommandHandling (9.0.1)
diff --git a/src/Common/Infrastructure/FeatureToggles.cs b/src/Common/Infrastructure/FeatureToggles.cs
index f6835dbc3..0f966f26b 100644
--- a/src/Common/Infrastructure/FeatureToggles.cs
+++ b/src/Common/Infrastructure/FeatureToggles.cs
@@ -436,6 +436,13 @@ public class CorrectFunctionBuildingUnitToggle : IFeatureToggle
public CorrectFunctionBuildingUnitToggle(bool featureEnabled) => FeatureEnabled = featureEnabled;
}
+ public class MoveBuildingUnitToggle : IFeatureToggle
+ {
+ public bool FeatureEnabled { get; }
+
+ public MoveBuildingUnitToggle(bool featureEnabled) => FeatureEnabled = featureEnabled;
+ }
+
public class AttachAddressParcelToggle : IFeatureToggle
{
public bool FeatureEnabled { get; }
diff --git a/src/Public.Api/BuildingUnit/BackOffice/BuildingUnitBackOfficerController-Move.cs b/src/Public.Api/BuildingUnit/BackOffice/BuildingUnitBackOfficerController-Move.cs
new file mode 100644
index 000000000..5ad196f55
--- /dev/null
+++ b/src/Public.Api/BuildingUnit/BackOffice/BuildingUnitBackOfficerController-Move.cs
@@ -0,0 +1,98 @@
+namespace Public.Api.BuildingUnit.BackOffice
+{
+ using System.Threading;
+ using System.Threading.Tasks;
+ using Be.Vlaanderen.Basisregisters.Api.Exceptions;
+ using BuildingRegistry.Api.BackOffice.Abstractions.BuildingUnit.Requests;
+ using BuildingRegistry.Api.Oslo.BuildingUnit.Detail;
+ using Common.Infrastructure;
+ using Common.Infrastructure.Extensions;
+ using Infrastructure;
+ using Infrastructure.Swagger;
+ using Microsoft.AspNetCore.Http;
+ using Microsoft.AspNetCore.Mvc;
+ using Microsoft.AspNetCore.Mvc.Infrastructure;
+ using RestSharp;
+ using Swashbuckle.AspNetCore.Annotations;
+ using Swashbuckle.AspNetCore.Filters;
+ using ProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ProblemDetails;
+ using ValidationProblemDetails = Be.Vlaanderen.Basisregisters.BasicApiProblem.ValidationProblemDetails;
+
+ public partial class BuildingUnitBackOfficeController
+ {
+ public const string MoveBuildingUnitRoute = "gebouweenheden/{objectId}/acties/verplaatsen";
+
+ ///
+ /// Verplaats de gebouweenheid naar het doelgebouw (v2).
+ ///
+ /// Identificator van de gebouweenheid.
+ ///
+ ///
+ ///
+ ///
+ /// If-Match header met ETag van de laatst gekende versie van de gebouweenheid (optioneel).
+ ///
+ /// Als het ticket succesvol is aangemaakt.
+ /// Als uw verzoek foutieve data bevat.
+ /// Als u niet geauthenticeerd bent om deze actie uit te voeren.
+ /// Als u niet beschikt over de correcte rechten om deze actie uit te voeren.
+ /// Als de gebouweenheid niet gevonden kan worden.
+ /// Als het gevraagde formaat niet beschikbaar is.
+ /// Als de If-Match header niet overeenkomt met de laatste ETag.
+ /// Als het aantal requests per seconde de limiet overschreven heeft.
+ /// Als er een interne fout is opgetreden.
+ ///
+ [ApiOrder(ApiOrder.BuildingUnit.Edit + 20)]
+ [ProducesResponseType(StatusCodes.Status202Accepted)]
+ [ProducesResponseType(typeof(ValidationProblemDetails), StatusCodes.Status400BadRequest)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status403Forbidden)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status412PreconditionFailed)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status429TooManyRequests)]
+ [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)]
+ [SwaggerResponseHeader(StatusCodes.Status202Accepted, "location", "string", "De URL van het aangemaakte ticket.")]
+ [SwaggerResponseHeader(StatusCodes.Status202Accepted, "x-correlation-id", "string", "Correlatie identificator van de response.")]
+ [SwaggerRequestExample(typeof(MoveBuildingUnitRequest), typeof(MoveBuildingUnitRequestExamples))]
+ [SwaggerResponseExample(StatusCodes.Status400BadRequest, typeof(BadRequestResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status401Unauthorized, typeof(UnauthorizedOAuthResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status403Forbidden, typeof(ForbiddenOAuthResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status404NotFound, typeof(BuildingUnitNotFoundResponseExamples))]
+ [SwaggerResponseExample(StatusCodes.Status412PreconditionFailed, typeof(PreconditionFailedResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status429TooManyRequests, typeof(TooManyRequestsResponseExamplesV2))]
+ [SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamplesV2))]
+ [SwaggerOperation(Description = "Verplaats de gebouweenheid naar het doelgebouw.")]
+ [HttpPost(MoveBuildingUnitRoute, Name = nameof(MoveBuildingUnit))]
+ public async Task MoveBuildingUnit(
+ [FromRoute] int objectId,
+ [FromBody] MoveBuildingUnitRequest moveBuildingUnitRequest,
+ [FromServices] IActionContextAccessor actionContextAccessor,
+ [FromServices] ProblemDetailsHelper problemDetailsHelper,
+ [FromServices] MoveBuildingUnitToggle moveBuildingUnitToggle,
+ [FromHeader(Name = HeaderNames.IfMatch)] string? ifMatch,
+ CancellationToken cancellationToken = default)
+ {
+ if (!moveBuildingUnitToggle.FeatureEnabled)
+ {
+ return NotFound();
+ }
+
+ var contentFormat = DetermineFormat(actionContextAccessor.ActionContext);
+
+ RestRequest BackendRequest() =>
+ CreateBackendRequestWithJsonBody(MoveBuildingUnitRoute, moveBuildingUnitRequest, Method.Post)
+ .AddParameter("objectId", objectId, ParameterType.UrlSegment)
+ .AddHeaderIfMatch(ifMatch)
+ .AddHeaderAuthorization(actionContextAccessor);
+
+ var value = await GetFromBackendWithBadRequestAsync(
+ contentFormat.ContentType,
+ BackendRequest,
+ CreateDefaultHandleBadRequest(),
+ problemDetailsHelper,
+ cancellationToken: cancellationToken);
+
+ return new BackendResponseResult(value, BackendResponseResultOptions.ForBackOffice());
+ }
+ }
+}
diff --git a/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs b/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs
index a7ecbaba3..15b329226 100644
--- a/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs
+++ b/src/Public.Api/Infrastructure/Configuration/FeatureToggleOptions.cs
@@ -70,6 +70,7 @@ public class FeatureToggleOptions
public bool CorrectFunctionBuildingUnit { get; set; }
public bool CorrectBuildingUnitPosition { get; set; }
public bool RemoveBuildingUnit { get; set; }
+ public bool MoveBuildingUnit { get; set; }
public bool AttachAddressParcel { get; set; }
public bool DetachAddressParcel { get; set; }
diff --git a/src/Public.Api/Infrastructure/Startup.cs b/src/Public.Api/Infrastructure/Startup.cs
index 5d9b1de8a..ef8e9667b 100644
--- a/src/Public.Api/Infrastructure/Startup.cs
+++ b/src/Public.Api/Infrastructure/Startup.cs
@@ -398,6 +398,7 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
.AddSingleton(c => new CorrectFunctionBuildingUnitToggle(c.GetRequiredService>().Value.CorrectFunctionBuildingUnit))
.AddSingleton(c => new CorrectBuildingUnitPositionToggle(c.GetRequiredService>().Value.CorrectBuildingUnitPosition))
.AddSingleton(c => new RemoveBuildingUnitToggle(c.GetRequiredService>().Value.RemoveBuildingUnit))
+ .AddSingleton(c => new MoveBuildingUnitToggle(c.GetRequiredService>().Value.MoveBuildingUnit))
.AddSingleton(c => new AttachAddressParcelToggle(c.GetRequiredService>().Value.AttachAddressParcel))
.AddSingleton(c => new DetachAddressParcelToggle(c.GetRequiredService>().Value.DetachAddressParcel))
diff --git a/src/Public.Api/appsettings.json b/src/Public.Api/appsettings.json
index 8f895e625..33b4ca6ca 100755
--- a/src/Public.Api/appsettings.json
+++ b/src/Public.Api/appsettings.json
@@ -474,6 +474,7 @@
"CorrectBuildingUnitRetirement": false,
"CorrectBuildingUnitRegularization": false,
"CorrectBuildingUnitDeregulation": false,
+ "MoveBuildingUnit": false,
"AttachAddressParcel": false,
"DetachAddressParcel": false,