validFrom not patchable anymore

This commit is contained in:
Michael Hoennig 2024-04-16 09:39:35 +02:00
parent c8a3070fac
commit 93cf73b78e
4 changed files with 1 additions and 13 deletions

View File

@ -22,8 +22,6 @@ public class HsBookingItemEntityPatcher implements EntityPatcher<HsBookingItemPa
.ifPresent(entity::setCaption); .ifPresent(entity::setCaption);
Optional.ofNullable(resource.getResources()) Optional.ofNullable(resource.getResources())
.ifPresent(r -> entity.getResources().patch(KeyValueMap.from(resource.getResources()))); .ifPresent(r -> entity.getResources().patch(KeyValueMap.from(resource.getResources())));
OptionalFromJson.of(resource.getValidFrom())
.ifPresent(entity::setValidFrom);
OptionalFromJson.of(resource.getValidTo()) OptionalFromJson.of(resource.getValidTo())
.ifPresent(entity::setValidTo); .ifPresent(entity::setValidTo);
} }

View File

@ -32,10 +32,6 @@ components:
caption: caption:
type: string type: string
nullable: true nullable: true
validFrom:
type: string
format: date
nullable: true
validTo: validTo:
type: string type: string
format: date format: date

View File

@ -258,7 +258,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
.body("", lenientlyEquals(""" .body("", lenientlyEquals("""
{ {
"caption": "some test-booking", "caption": "some test-booking",
"validFrom": "2020-06-05", "validFrom": "2022-11-01",
"validTo": "2022-12-31", "validTo": "2022-12-31",
"resources": { "resources": {
"CPU": "4", "CPU": "4",

View File

@ -34,7 +34,6 @@ class HsBookingItemEntityPatcherUnitTest extends PatchUnitTestBase<
private static final UUID INITIAL_BOOKING_ITEM_UUID = UUID.randomUUID(); private static final UUID INITIAL_BOOKING_ITEM_UUID = UUID.randomUUID();
private static final LocalDate GIVEN_VALID_FROM = LocalDate.parse("2020-04-15"); private static final LocalDate GIVEN_VALID_FROM = LocalDate.parse("2020-04-15");
private static final LocalDate PATCHED_VALID_FROM = LocalDate.parse("2022-10-30");
private static final LocalDate PATCHED_VALID_TO = LocalDate.parse("2022-12-31"); private static final LocalDate PATCHED_VALID_TO = LocalDate.parse("2022-12-31");
private static final Map<String, Object> INITIAL_RESOURCES = patchMap( private static final Map<String, Object> INITIAL_RESOURCES = patchMap(
@ -103,11 +102,6 @@ class HsBookingItemEntityPatcherUnitTest extends PatchUnitTestBase<
HsBookingItemEntity::putResources, HsBookingItemEntity::putResources,
PATCHED_RESOURCES) PATCHED_RESOURCES)
.notNullable(), .notNullable(),
new JsonNullableProperty<>(
"validfrom",
HsBookingItemPatchResource::setValidFrom,
PATCHED_VALID_FROM,
HsBookingItemEntity::setValidFrom),
new JsonNullableProperty<>( new JsonNullableProperty<>(
"validto", "validto",
HsBookingItemPatchResource::setValidTo, HsBookingItemPatchResource::setValidTo,