From 8a5dae690a37e1522025868f60dc6414016aae1a Mon Sep 17 00:00:00 2001 From: aalicic Date: Thu, 22 Sep 2022 16:05:57 +0200 Subject: [PATCH] Add calendar app and budibase url to application settings --- api/applicationsettingsservice.yml | 6 ++++ .../service/ApplicationSettingsConverter.java | 4 ++- ...DefaultApplicationSettingsInitializer.java | 4 +++ .../schemas/application-settings.json | 32 ++++++++++++++++++- .../ApplicationSettingsControllerIT.java | 4 +++ .../ApplicationSettingsConverterTest.java | 6 ++++ 6 files changed, 54 insertions(+), 2 deletions(-) diff --git a/api/applicationsettingsservice.yml b/api/applicationsettingsservice.yml index 5e2b9994..2924eb2e 100644 --- a/api/applicationsettingsservice.yml +++ b/api/applicationsettingsservice.yml @@ -64,6 +64,12 @@ components: budibaseAuthClientId: allOf: - $ref: '#/components/schemas/SettingDTO' + budibaseUrl: + allOf: + - $ref: '#/components/schemas/SettingDTO' + calendarAppUrl: + allOf: + - $ref: '#/components/schemas/SettingDTO' FeatureToggleDTO: type: object diff --git a/src/main/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverter.java b/src/main/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverter.java index 75adef2a..74fc5a21 100644 --- a/src/main/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverter.java +++ b/src/main/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverter.java @@ -30,7 +30,9 @@ public ApplicationSettingsDTO toDTO(ApplicationSettingsEntity applicationSetting toSettingDTO(applicationSettings.getMainTenantSubdomainForSingleDomainMultitenancy())) .useOverviewPage(toFeatureToggleDTO(applicationSettings.getUseOverviewPage())) .calcomUrl(toSettingDTO(applicationSettings.getCalcomUrl())) - .budibaseAuthClientId(toSettingDTO(applicationSettings.getBudibaseAuthClientId())); + .budibaseAuthClientId(toSettingDTO(applicationSettings.getBudibaseAuthClientId())) + .budibaseUrl(toSettingDTO(applicationSettings.getBudibaseUrl())) + .calendarAppUrl(toSettingDTO(applicationSettings.getCalendarAppUrl())); } private SettingDTO toSettingDTO(Object setting) { diff --git a/src/main/java/de/caritas/cob/consultingtypeservice/api/service/DefaultApplicationSettingsInitializer.java b/src/main/java/de/caritas/cob/consultingtypeservice/api/service/DefaultApplicationSettingsInitializer.java index 2d54e5e3..6d701876 100644 --- a/src/main/java/de/caritas/cob/consultingtypeservice/api/service/DefaultApplicationSettingsInitializer.java +++ b/src/main/java/de/caritas/cob/consultingtypeservice/api/service/DefaultApplicationSettingsInitializer.java @@ -3,7 +3,9 @@ import de.caritas.cob.consultingtypeservice.api.model.ApplicationSettingsEntity; import de.caritas.cob.consultingtypeservice.api.repository.ApplicationSettingsRepository; import de.caritas.cob.consultingtypeservice.schemas.model.BudibaseAuthClientId; +import de.caritas.cob.consultingtypeservice.schemas.model.BudibaseUrl; import de.caritas.cob.consultingtypeservice.schemas.model.CalcomUrl; +import de.caritas.cob.consultingtypeservice.schemas.model.CalendarAppUrl; import de.caritas.cob.consultingtypeservice.schemas.model.DisableVideoAppointments; import de.caritas.cob.consultingtypeservice.schemas.model.EnableWalkthrough; import de.caritas.cob.consultingtypeservice.schemas.model.MainTenantSubdomainForSingleDomainMultitenancy; @@ -61,6 +63,8 @@ private ApplicationSettingsEntity createDefaultApplicationSettings() { entity.setUseOverviewPage(new UseOverviewPage().withValue(false).withReadOnly(false)); entity.setCalcomUrl(new CalcomUrl().withValue("calcomUrl").withReadOnly(false)); entity.setBudibaseAuthClientId(new BudibaseAuthClientId().withValue("budibaseAuthClientId").withReadOnly(false)); + entity.setBudibaseUrl(new BudibaseUrl().withValue("budibaseUrl").withReadOnly(false)); + entity.setCalendarAppUrl(new CalendarAppUrl().withValue("calendarAppUrl").withReadOnly(false)); return entity; } } diff --git a/src/main/resources/schemas/application-settings.json b/src/main/resources/schemas/application-settings.json index 1e5430b5..045b360d 100644 --- a/src/main/resources/schemas/application-settings.json +++ b/src/main/resources/schemas/application-settings.json @@ -158,7 +158,37 @@ "value", "readOnly" ] - } + }, + "budibaseUrl": { + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "readOnly": { + "type": "boolean" + } + }, + "required": [ + "value", + "readOnly" + ] + }, + "calendarAppUrl": { + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "readOnly": { + "type": "boolean" + } + } + }, + "required": [ + "value", + "readOnly" + ] }, "required": [ "multitenancyWithSingleDomainEnabled", diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/ApplicationSettingsControllerIT.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/ApplicationSettingsControllerIT.java index 8534d7ad..8b352b65 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/ApplicationSettingsControllerIT.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/ApplicationSettingsControllerIT.java @@ -65,6 +65,10 @@ void getApplicationSettings_Should_ReturnApplicationSettings_When_UserIsNotAuthe .andExpect(jsonPath("$.budibaseAuthClientId.readOnly").value(false)) .andExpect(jsonPath("$.calcomUrl.value").value("calcomUrl")) .andExpect(jsonPath("$.calcomUrl.readOnly").value(false)) + .andExpect(jsonPath("$.budibaseUrl.value").value("budibaseUrl")) + .andExpect(jsonPath("$.budibaseUrl.readOnly").value(false)) + .andExpect(jsonPath("$.calendarAppUrl.value").value("calendarAppUrl")) + .andExpect(jsonPath("$.calendarAppUrl.readOnly").value(false)) .andExpect(jsonPath("$.useOverviewPage.value").value(false)) .andExpect(jsonPath("$.useOverviewPage.readOnly").value(false)); } diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverterTest.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverterTest.java index 16db34a8..69c44bdc 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverterTest.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/service/ApplicationSettingsConverterTest.java @@ -5,7 +5,9 @@ import de.caritas.cob.consultingtypeservice.api.model.ApplicationSettingsDTO; import de.caritas.cob.consultingtypeservice.api.model.ApplicationSettingsEntity; import de.caritas.cob.consultingtypeservice.schemas.model.BudibaseAuthClientId; +import de.caritas.cob.consultingtypeservice.schemas.model.BudibaseUrl; import de.caritas.cob.consultingtypeservice.schemas.model.CalcomUrl; +import de.caritas.cob.consultingtypeservice.schemas.model.CalendarAppUrl; import de.caritas.cob.consultingtypeservice.schemas.model.DisableVideoAppointments; import de.caritas.cob.consultingtypeservice.schemas.model.EnableWalkthrough; import de.caritas.cob.consultingtypeservice.schemas.model.MainTenantSubdomainForSingleDomainMultitenancy; @@ -60,6 +62,8 @@ void toDTO_Should_ConvertToDTOAllSettings() { assertThat(applicationSettingsDTO.getBudibaseAuthClientId().getReadOnly()).isEqualTo(false); assertThat(applicationSettingsDTO.getBudibaseAuthClientId().getValue()).isEqualTo("budibaseAuthClientId"); assertThat(applicationSettingsDTO.getCalcomUrl().getValue()).isEqualTo("calcomUrl"); + assertThat(applicationSettingsDTO.getBudibaseUrl().getValue()).isEqualTo("budibaseUrl"); + assertThat(applicationSettingsDTO.getCalendarAppUrl().getValue()).isEqualTo("calendarAppUrl"); assertThat(applicationSettingsDTO.getCalcomUrl().getReadOnly()).isEqualTo(false); assertThat(applicationSettingsDTO.getUseOverviewPage().getValue()).isFalse(); assertThat(applicationSettingsDTO.getUseOverviewPage().getReadOnly()).isFalse(); @@ -75,6 +79,8 @@ private ApplicationSettingsEntity giveApplicationSettings() { settings.setMainTenantSubdomainForSingleDomainMultitenancy(new MainTenantSubdomainForSingleDomainMultitenancy().withReadOnly(false).withValue("app")); settings.setBudibaseAuthClientId(new BudibaseAuthClientId().withReadOnly(false).withValue("budibaseAuthClientId")); settings.setCalcomUrl(new CalcomUrl().withReadOnly(false).withValue("calcomUrl")); + settings.setBudibaseUrl(new BudibaseUrl().withReadOnly(false).withValue("budibaseUrl")); + settings.setCalendarAppUrl(new CalendarAppUrl().withReadOnly(false).withValue("calendarAppUrl")); settings.setUseOverviewPage(new UseOverviewPage().withReadOnly(false).withValue(false)); return settings; }