From f132f4d2936eecdc92243e815d9415d74384f358 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 8 Oct 2024 11:37:31 +0200 Subject: [PATCH] amendmends after code-review --- .../hs/booking/item/HsBookingItemController.java | 2 +- .../factories/DomainSetupHostingAssetFactory.java | 2 +- .../hs-booking/hs-booking-item-schemas.yaml | 13 +------------ .../item/HsBookingItemControllerAcceptanceTest.java | 6 +++--- .../hs/migration/BaseOfficeDataImport.java | 2 +- 5 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java index 4a6b3729..e8441b01 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemController.java @@ -146,7 +146,7 @@ public class HsBookingItemController implements HsBookingItemsApi { try { final var bookingItemRealEntity = em.getReference(HsBookingItemRealEntity.class, saveProcessor.getEntity().getUuid()); applicationEventPublisher.publishEvent(new BookingItemCreatedAppEvent( - this, bookingItemRealEntity, jsonMapper.writeValueAsString(body.getAsset()))); + this, bookingItemRealEntity, jsonMapper.writeValueAsString(body.getHostingAsset()))); } catch (JsonProcessingException e) { throw new RuntimeException(e); } diff --git a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/DomainSetupHostingAssetFactory.java b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/DomainSetupHostingAssetFactory.java index d12e8dcf..de6b4f02 100644 --- a/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/DomainSetupHostingAssetFactory.java +++ b/src/main/java/net/hostsharing/hsadminng/hs/hosting/asset/factories/DomainSetupHostingAssetFactory.java @@ -132,7 +132,7 @@ public class DomainSetupHostingAssetFactory extends HostingAssetFactory { final var expectedSubAssetResource = new HsHostingAssetSubInsertResource(); expectedSubAssetResource.setType(givenSubAssetResource.getType()); if ( !convert.from(givenSubAssetResource).equals(convert.from(expectedSubAssetResource)) ) { - throw new ValidationException("sub asset " + givenSubAssetResource.getType() + " is over-specified, in compatibilty mode, only default values allowed"); + throw new ValidationException("sub asset " + givenSubAssetResource.getType() + " is over-specified, in compatibility mode, only default values allowed"); } } diff --git a/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml b/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml index 354bec43..ef0ac307 100644 --- a/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml +++ b/src/main/resources/api-definition/hs-booking/hs-booking-item-schemas.yaml @@ -62,17 +62,6 @@ components: nullable: false type: $ref: '#/components/schemas/HsBookingItemType' - identifier: - type: string - minLength: 3 - maxLength: 80 - nullable: false - description: only used as a default value for automatically created hosting assets, not part of the booking item - assignedToHostingAssetUuid: - type: string - format: uuid - nullable: false - description: only used as a default value for automatically created hosting assets, not part of the booking item caption: type: string minLength: 3 @@ -84,7 +73,7 @@ components: nullable: true resources: $ref: '#/components/schemas/BookingResources' - asset: + hostingAsset: $ref: '../hs-hosting/hs-hosting-asset-schemas.yaml#/components/schemas/HsHostingAssetAutoInsert' required: - caption diff --git a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java index 0217667c..6b4a4b29 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/booking/item/HsBookingItemControllerAcceptanceTest.java @@ -208,7 +208,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup "SSD": 25, "Traffic": 250 }, - "asset": { + "hostingAsset": { "type": "MANAGED_WEBSPACE", "identifier": "fir00" } @@ -277,7 +277,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup "domainName": "example.org", "verificationCode": "just-a-fake-verification-code" }, - "asset": { // FIXME: rename to hostingAsset + "hostingAsset": { "identifier": "example.org", // also as default for all subAssets "subHostingAssets": [ { @@ -367,7 +367,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup "domainName": "example.org", "verificationCode": "just-a-fake-verification-code" }, - "asset": { // FIXME: rename to hostingAsset + "hostingAsset": { "identifier": "example.org", // also as default for all subAssets "subHostingAssets": [ { diff --git a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java index 9aa92773..511647aa 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/migration/BaseOfficeDataImport.java @@ -502,7 +502,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport { // this happens if a natural person is marked as 'contractual' for itself final var idsToRemove = new HashSet(); relations.forEach((id, r) -> { - if (r.getType() == HsOfficeRelationType.REPRESENTATIVE && r.getHolder() == r.getAnchor()) { + if (r.getHolder() == r.getAnchor()) { idsToRemove.add(id); } });