From 02e88f5cb2c46e8d1d1276d7812501512c0aa255 Mon Sep 17 00:00:00 2001 From: Marc Itzenthaler Date: Tue, 7 Nov 2023 11:16:04 +0100 Subject: [PATCH 1/2] feat: added topic slug to topic dto --- api/topicservice.yml | 8 ++++++++ .../api/converter/TopicConverter.java | 4 ++++ .../api/model/TopicEntity.java | 3 +++ .../api/controller/TopicAdminControllerIT.java | 7 +++++++ .../api/controller/TopicControllerIT.java | 2 ++ .../api/converter/TopicConverterTest.java | 14 ++++++++++++++ .../api/repository/TopicGroupRepositoryIT.java | 8 ++++++++ .../api/repository/TopicRepositoryIT.java | 7 +++++++ .../api/service/TopicGroupsServiceIT.java | 1 + .../api/util/MultilingualTopicTestDataBuilder.java | 5 +++++ 10 files changed, 59 insertions(+) diff --git a/api/topicservice.yml b/api/topicservice.yml index 6a14edb..9efc317 100644 --- a/api/topicservice.yml +++ b/api/topicservice.yml @@ -280,6 +280,10 @@ components: type: string example: "Topic name" maxLength: 100 + slug: + type: string + example: "topic_slug" + maxLength: 100 description: type: string example: "Description" @@ -318,6 +322,10 @@ components: type: object additionalProperties: type: string + slug: + type: string + example: "topic_slug" + maxLength: 100 description: type: object additionalProperties: diff --git a/src/main/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverter.java b/src/main/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverter.java index 9eafe0f..8611dc0 100644 --- a/src/main/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverter.java +++ b/src/main/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverter.java @@ -30,6 +30,7 @@ public TopicDTO toDTO(final TopicEntity topic, final String lang) { new TopicDTO() .id(topic.getId()) .name(getTranslatedStringFromMap(topic.getName(), lang)) + .slug(topic.getSlug()) .description(getTranslatedStringFromMap(topic.getDescription(), lang)) .status(topic.getStatus().name()) .fallbackAgencyId(topic.getFallbackAgencyId()) @@ -64,6 +65,7 @@ public TopicMultilingualDTO toMultilingualDTO(final TopicEntity topic) { new TopicMultilingualDTO() .id(topic.getId()) .name(convertMapFromJson(topic.getName())) + .slug(topic.getSlug()) .description(convertMapFromJson(topic.getDescription())) .status(topic.getStatus().name()) .fallbackAgencyId(topic.getFallbackAgencyId()) @@ -93,6 +95,7 @@ public List toDTOList(final Collection topicEntities) { public TopicEntity toEntity(final TopicMultilingualDTO topicDTO) { final TopicEntity topicEntity = new TopicEntity(); topicEntity.setName(convertToJson(topicDTO.getName())); + topicEntity.setSlug(topicDTO.getSlug()); topicEntity.setStatus(TopicStatus.valueOf(topicDTO.getStatus().toUpperCase())); topicEntity.setDescription(convertToJson(topicDTO.getDescription())); topicEntity.setUpdateDate(LocalDateTime.now(ZoneOffset.UTC)); @@ -109,6 +112,7 @@ public TopicEntity toEntity(final TopicMultilingualDTO topicDTO) { public TopicEntity toEntity(final TopicEntity targetEntity, final TopicMultilingualDTO topicDTO) { targetEntity.setName(convertToJson(topicDTO.getName())); + targetEntity.setSlug(topicDTO.getSlug()); targetEntity.setStatus(TopicStatus.valueOf(topicDTO.getStatus())); targetEntity.setDescription(convertToJson(topicDTO.getDescription())); targetEntity.setInternalIdentifier(topicDTO.getInternalIdentifier()); diff --git a/src/main/java/de/caritas/cob/consultingtypeservice/api/model/TopicEntity.java b/src/main/java/de/caritas/cob/consultingtypeservice/api/model/TopicEntity.java index dbb4a13..ac200b1 100644 --- a/src/main/java/de/caritas/cob/consultingtypeservice/api/model/TopicEntity.java +++ b/src/main/java/de/caritas/cob/consultingtypeservice/api/model/TopicEntity.java @@ -77,4 +77,7 @@ public class TopicEntity implements TenantAware { @Column(name = "titles_dropdown") private String titlesDropdown; + + @Column(name = "slug") + private String slug; } diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicAdminControllerIT.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicAdminControllerIT.java index aafc693..0febfc0 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicAdminControllerIT.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicAdminControllerIT.java @@ -102,6 +102,7 @@ void updateTopic_Should_returnStatusOk_When_calledWithValidCreateParamsAndValidA new MultilingualTopicTestDataBuilder() .topicDTO() .withName("new name") + .withSlug("new_slug") .withDescription("new desc") .withInternalIdentifier("new ident") .withStatus(TopicStatus.INACTIVE.toString()) @@ -120,6 +121,7 @@ void updateTopic_Should_returnStatusOk_When_calledWithValidCreateParamsAndValidA .andExpect(status().isOk()) .andExpect(jsonPath("$.id").exists()) .andExpect(jsonPath("$.name['de']").value("new name")) + .andExpect(jsonPath("$.slug").value("new_slug")) .andExpect(jsonPath("$.description['de']").value("new desc")) .andExpect(jsonPath("$.internalIdentifier").value("new ident")) .andExpect(jsonPath("$.status").value(TopicStatus.INACTIVE.toString())) @@ -134,6 +136,7 @@ void updateTopic_Should_returnStatusOk_When_featureToggleIsDisabled() throws Exc new MultilingualTopicTestDataBuilder() .topicDTO() .withName("new name") + .withName("new_slug") .withDescription("new desc") .withInternalIdentifier("new ident") .withStatus(TopicStatus.INACTIVE.toString()) @@ -204,6 +207,7 @@ void createTopic_Should_returnStatusOk_When_calledWithValidCreateParamsAndValidA final EasyRandom easyRandom = new EasyRandom(); final TopicMultilingualDTO topicDTO = easyRandom.nextObject(TopicMultilingualDTO.class); topicDTO.setStatus(TopicStatus.INACTIVE.toString()); + topicDTO.setSlug("slug"); topicDTO.setTitles( new TitlesDTO() ._short("short") @@ -222,6 +226,7 @@ void createTopic_Should_returnStatusOk_When_calledWithValidCreateParamsAndValidA .andExpect(status().isOk()) .andExpect(jsonPath("$.id").exists()) .andExpect(jsonPath("$.name").exists()) + .andExpect(jsonPath("$.slug").exists()) .andExpect(jsonPath("$.description").exists()) .andExpect(jsonPath("$.status").value("INACTIVE")) .andExpect(jsonPath("$.internalIdentifier").exists()) @@ -266,6 +271,7 @@ void getAllTopics_Should_ReturnTopicsList_When_UserIsAuthenticated() throws Exce .andExpect(jsonPath("$", hasSize(greaterThan(1)))) .andExpect(jsonPath("$[0].id").value(1)) .andExpect(jsonPath("$[0].name").exists()) + .andExpect(jsonPath("$[0].slug").exists()) .andExpect(jsonPath("$[0].description").exists()) .andExpect(jsonPath("$[0].status").exists()) .andExpect(jsonPath("$[0].createDate").exists()); @@ -294,6 +300,7 @@ void getTopicWithTranslationById_Should_ReturnTopic_When_UserIsAuthenticated() t .andExpect(status().isOk()) .andExpect(jsonPath("$.id").value(1)) .andExpect(jsonPath("$.name").exists()) + .andExpect(jsonPath("$.slug").exists()) .andExpect(jsonPath("$.description").exists()) .andExpect(jsonPath("$.status").exists()) .andExpect(jsonPath("$.createDate").exists()); diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicControllerIT.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicControllerIT.java index 233a04f..0098bdc 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicControllerIT.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/controller/TopicControllerIT.java @@ -76,6 +76,7 @@ void getTopicList_Should_ReturnTopicsList_When_UserIsAuthenticated() throws Exce .andExpect(jsonPath("$", hasSize(greaterThan(1)))) .andExpect(jsonPath("$[0].id").value(1)) .andExpect(jsonPath("$[0].name").exists()) + .andExpect(jsonPath("$[0].slug").exists()) .andExpect(jsonPath("$[0].description").exists()) .andExpect(jsonPath("$[0].status").exists()) .andExpect(jsonPath("$[0].createDate").exists()); @@ -90,6 +91,7 @@ void getAllActiveTopics_Should_returnActiveTopicsList() throws Exception { .andExpect(jsonPath("$", hasSize(2))) .andExpect(jsonPath("$[0].id").exists()) .andExpect(jsonPath("$[0].name").exists()) + .andExpect(jsonPath("$[0].slug").exists()) .andExpect(jsonPath("$[0].description").exists()) .andExpect(jsonPath("$[0].status").exists()) .andExpect(jsonPath("$[0].createDate").exists()); diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverterTest.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverterTest.java index a1c8da8..225d5bb 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverterTest.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/converter/TopicConverterTest.java @@ -34,6 +34,7 @@ void toEntity_should_convertToEntityAndBackToMultilingualDTO() { .status(TopicStatus.ACTIVE.toString()) .internalIdentifier("identifier") .name(name) + .slug("slug") .titles( new TitlesDTO()._short("ts")._long("tl").registrationDropdown("td").welcome("tw")) .description(description); @@ -44,6 +45,7 @@ void toEntity_should_convertToEntityAndBackToMultilingualDTO() { // then final TopicDTO actual = topicConverter.toDTO(entity); assertThat(actual.getName()).isEqualTo(topicDTO.getName().get("de")); + assertThat(actual.getSlug()).isEqualTo(topicDTO.getSlug()); assertThat(actual.getDescription()).isEqualTo(topicDTO.getDescription().get("de")); } @@ -58,6 +60,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier") .name("{\"de\":\"name de\", \"en\":\"name en\"}") .description("{\"de\":\"desc de\", \"en\":\"desc en\"}") + .slug("slug") .titlesShort("ts") .titlesLong("tl") .titlesDropdown("td") @@ -70,6 +73,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier 2") .name("{\"de\":\"name 2 de\", \"en\":\"name 2 en\"}") .description("{\"de\":\"desc 2 de\", \"en\":\"desc 2 en\"}") + .slug("slug") .titlesShort("ts") .titlesLong("tl") .titlesDropdown("td") @@ -83,6 +87,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .status(TopicStatus.ACTIVE.toString()) .internalIdentifier("identifier") .name("name en") + .slug("slug") .titles(titles) .description("desc en"); final var topicDTO2 = @@ -91,6 +96,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .status(TopicStatus.ACTIVE.toString()) .internalIdentifier("identifier 2") .name("name 2 en") + .slug("slug") .titles(titles) .description("desc 2 en"); @@ -113,6 +119,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier") .name("{\"de\":\"name de\", \"en\":\"name en\"}") .description("{\"de\":\"desc de\", \"en\":\"desc en\"}") + .slug("slug") .titlesShort("ts") .titlesLong("tl") .titlesDropdown("td") @@ -125,6 +132,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier 2") .name("{\"de\":\"name 2 de\", \"en\":\"name 2 en\"}") .description("{\"de\":\"desc 2 de\", \"en\":\"desc 2 en\"}") + .slug("slug") .titlesShort("ts") .titlesLong("tl") .titlesDropdown("td") @@ -138,6 +146,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .status(TopicStatus.ACTIVE.toString()) .internalIdentifier("identifier") .name("name de") + .slug("slug") .titles(titles) .description("desc de"); final var topicDTO2 = @@ -146,6 +155,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .status(TopicStatus.ACTIVE.toString()) .internalIdentifier("identifier 2") .name("name 2 de") + .slug("slug") .titles(titles) .description("desc 2 de"); @@ -168,6 +178,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier") .name("{\"de\":\"name de\", \"en\":\"name en\"}") .description("{\"de\":\"desc de\", \"en\":\"desc en\"}") + .slug("slug") .titlesLong(titles.getLong()) .titlesShort(titles.getShort()) .titlesDropdown(titles.getRegistrationDropdown()) @@ -180,6 +191,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier 2") .name("{\"de\":\"name 2 de\", \"en\":\"name 2 en\"}") .description("{\"de\":\"desc 2 de\", \"en\":\"desc 2 en\"}") + .slug("slug") .titlesLong(titles.getLong()) .titlesShort(titles.getShort()) .titlesWelcome(titles.getWelcome()) @@ -205,6 +217,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier") .name(name1) .description(description1) + .slug("slug") .titles(titles); final var topicDTO2 = new TopicMultilingualDTO() @@ -213,6 +226,7 @@ void toDTOList_Should_convertCollectionOfTopicEntitiesToListOfTopicDTOsWithCorre .internalIdentifier("identifier 2") .name(name2) .description(description2) + .slug("slug") .titles(titles); // when diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicGroupRepositoryIT.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicGroupRepositoryIT.java index 710a53b..f04ff16 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicGroupRepositoryIT.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicGroupRepositoryIT.java @@ -46,6 +46,7 @@ void topicGroupRepositoryReturnsSomeMeaningfulData() { val te1 = TopicEntity.builder() .name("te1") + .slug("s1") .createDate(now) .updateDate(now) .titlesDropdown("td") @@ -56,6 +57,7 @@ void topicGroupRepositoryReturnsSomeMeaningfulData() { val te2 = TopicEntity.builder() .name("te2") + .slug("s2") .createDate(now) .updateDate(now) .titlesDropdown("td") @@ -97,6 +99,7 @@ void deletingTopicGroupKeepsTopicsUntouched() { val te1 = TopicEntity.builder() .name("te1") + .slug("s1") .createDate(now) .updateDate(now) .titlesDropdown("td") @@ -107,6 +110,7 @@ void deletingTopicGroupKeepsTopicsUntouched() { val te2 = TopicEntity.builder() .name("te2") + .slug("s2") .createDate(now) .updateDate(now) .titlesDropdown("td") @@ -117,6 +121,7 @@ void deletingTopicGroupKeepsTopicsUntouched() { val te3 = TopicEntity.builder() .name("te3") + .slug("s3") .createDate(now) .updateDate(now) .titlesDropdown("td") @@ -127,6 +132,7 @@ void deletingTopicGroupKeepsTopicsUntouched() { val te4 = TopicEntity.builder() .name("te4") + .slug("s4") .createDate(now) .updateDate(now) .titlesDropdown("td") @@ -180,6 +186,7 @@ void deletingTopicGetsItRemovedFromGroup() { val te1 = TopicEntity.builder() .name("te1") + .slug("s1") .createDate(now) .updateDate(now) .titlesLong("long") @@ -190,6 +197,7 @@ void deletingTopicGetsItRemovedFromGroup() { val te2 = TopicEntity.builder() .name("te2") + .slug("s2") .createDate(now) .updateDate(now) .titlesLong("long") diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicRepositoryIT.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicRepositoryIT.java index 9c070fb..0070e60 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicRepositoryIT.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/repository/TopicRepositoryIT.java @@ -56,6 +56,7 @@ void save_Should_saveNewTopic() { TopicEntity.builder() .name(NEW_TOPIC_NAME) .description("desc") + .slug("slug") .createDate(LocalDateTime.now()) .titlesLong("long") .titlesShort("short") @@ -78,6 +79,7 @@ void save_Should_saveNewTopic_withFallbackAgencyId() { TopicEntity.builder() .name(NEW_TOPIC_NAME) .description("desc") + .slug("slug") .createDate(LocalDateTime.now()) .fallbackAgencyId(123) .titlesLong("long") @@ -100,6 +102,7 @@ void save_Should_saveNewTopic_withoutFallbackAgencyId() { TopicEntity.builder() .name(NEW_TOPIC_NAME) .description("desc") + .slug("slug") .createDate(LocalDateTime.now()) .titlesLong("long") .titlesShort("short") @@ -125,6 +128,7 @@ void save_Should_saveNewTopic_withFallbackUrl() { TopicEntity.builder() .name(NEW_TOPIC_NAME) .description("desc") + .slug("slug") .createDate(LocalDateTime.now()) .fallbackUrl(fallbackUrl) .titlesLong("long") @@ -147,6 +151,7 @@ void save_Should_saveNewTopic_withoutFallbackUrl() { TopicEntity.builder() .name(NEW_TOPIC_NAME) .description("desc") + .slug("slug") .createDate(LocalDateTime.now()) .titlesLong("long") .titlesShort("short") @@ -172,6 +177,7 @@ void save_Should_saveNewTopic_withWelcomeMessage() { TopicEntity.builder() .name(NEW_TOPIC_NAME) .description("desc") + .slug("slug") .createDate(LocalDateTime.now()) .welcomeMessage(welcomeMessage) .titlesShort("short") @@ -194,6 +200,7 @@ void save_Should_saveNewTopic_withoutWelcomeMessage() { TopicEntity.builder() .name(NEW_TOPIC_NAME) .description("desc") + .slug("slug") .createDate(LocalDateTime.now()) .titlesWelcome("welcome") .titlesLong("long") diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/service/TopicGroupsServiceIT.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/service/TopicGroupsServiceIT.java index 08ce0fd..cfc184f 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/service/TopicGroupsServiceIT.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/service/TopicGroupsServiceIT.java @@ -60,6 +60,7 @@ private static TopicEntity newTopicEntity(String te1, LocalDateTime now) { .name(te1) .createDate(now) .updateDate(now) + .slug("slug") .titlesDropdown("td") .titlesWelcome("tw") .titlesLong("tl") diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/util/MultilingualTopicTestDataBuilder.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/util/MultilingualTopicTestDataBuilder.java index 043cc65..9cb9bc2 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/util/MultilingualTopicTestDataBuilder.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/util/MultilingualTopicTestDataBuilder.java @@ -77,6 +77,11 @@ public MultilingualTopicTestDataBuilder withDescription(final String desc, final return this; } + public MultilingualTopicTestDataBuilder withSlug(final String slug) { + topicMultilingualDTO.setSlug(slug); + return this; + } + public TopicMultilingualDTO build() { return topicMultilingualDTO; } From 786c319e8ca201e52c39161c444da4e2adf4221f Mon Sep 17 00:00:00 2001 From: tkuzynow Date: Tue, 7 Nov 2023 13:09:46 +0100 Subject: [PATCH 2/2] fixed tests for topics --- .../api/validation/TopicInputSanitizer.java | 1 + .../api/validation/TopicInputSanitizerTest.java | 2 ++ src/test/resources/database/TopicDatabase.sql | 13 +++++++------ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizer.java b/src/main/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizer.java index 4bfb9fc..e0725f7 100644 --- a/src/main/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizer.java +++ b/src/main/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizer.java @@ -29,6 +29,7 @@ private TopicMultilingualDTO copyNotSanitizedAttributes(final TopicMultilingualD output.setCreateDate(input.getCreateDate()); output.setUpdateDate(input.getUpdateDate()); output.setTitles(input.getTitles()); + output.setSlug(input.getSlug()); return output; } } diff --git a/src/test/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizerTest.java b/src/test/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizerTest.java index 9a38b61..b3ed6f7 100644 --- a/src/test/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizerTest.java +++ b/src/test/java/de/caritas/cob/consultingtypeservice/api/validation/TopicInputSanitizerTest.java @@ -24,6 +24,7 @@ void sanitize_Should_sanitizeTopicDTO() { .withDescription("desc" + SCRIPT_MALICIOUS_CONTENT) .withInternalIdentifier(SCRIPT_MALICIOUS_CONTENT + "internalIdent") .withStatus(TopicStatus.ACTIVE.toString()) + .withSlug("slug") .build(); // when final TopicMultilingualDTO sanitized = topicInputSanitizer.sanitize(topicMultilingualDTO); @@ -33,5 +34,6 @@ void sanitize_Should_sanitizeTopicDTO() { assertThat(sanitized.getDescription().get("de"), is("desc")); assertThat(sanitized.getInternalIdentifier(), is("internalIdent")); assertThat(sanitized.getStatus(), is(TopicStatus.ACTIVE.toString())); + assertThat(sanitized.getSlug(), is("slug")); } } diff --git a/src/test/resources/database/TopicDatabase.sql b/src/test/resources/database/TopicDatabase.sql index 5af5397..aa5fae6 100644 --- a/src/test/resources/database/TopicDatabase.sql +++ b/src/test/resources/database/TopicDatabase.sql @@ -22,6 +22,7 @@ CREATE TABLE IF NOT EXISTS `topic` `titles_long` varchar(255) NOT NULL, `titles_welcome` varchar(255) NOT NULL, `titles_dropdown` varchar(255) NOT NULL, + `slug` varchar(255) NULL, PRIMARY KEY (`id`) ); @@ -36,22 +37,22 @@ CREATE SEQUENCE IF NOT EXISTS sequence_topic INSERT INTO TOPIC (`id`, `tenant_id`, `name`, `description`, `status`, `create_date`, `fallback_agency_id`, `fallback_url`, `welcome_message`, `send_next_step_message`, `titles_short`, - `titles_long`, `titles_welcome`, `titles_dropdown`) + `titles_long`, `titles_welcome`, `titles_dropdown`,`slug`) VALUES (1, '1', '{"de" : "de an active topic", "en": "en an active topic"}', '{"de" : "de description", "en": "en description"}', 'ACTIVE', '2022-06-02', 1, 'https://www.google.com', 'Welcome', TRUE, '1-short', - '1-long', '1-welcome', '1-dropdown'); + '1-long', '1-welcome', '1-dropdown','1-slug'); INSERT INTO TOPIC (`id`, `tenant_id`, `name`, `description`, `status`, `create_date`, `titles_short`, - `titles_long`, `titles_welcome`, `titles_dropdown`) + `titles_long`, `titles_welcome`, `titles_dropdown`, `slug`) VALUES (2, '1', '{"de" : "de not an active topic", "en": "en not an active topic"}', '{"de" : "de description", "en": "en description"}', 'INACTIVE', '2022-06-02', '2-short', '2-long', - '2-welcome', '2-dropdown'); + '2-welcome', '2-dropdown', '2-slug'); INSERT INTO TOPIC (`id`, `tenant_id`, `name`, `description`, `status`, `create_date`, `titles_short`, - `titles_long`, `titles_welcome`, `titles_dropdown`) + `titles_long`, `titles_welcome`, `titles_dropdown`, `slug`) VALUES (3, '2', '{"de" : "de another topic"}', '{"de" : "de description"}', 'ACTIVE', '2022-06-02', - '3-short', '3-long', '3-welcome', '3-dropdown'); + '3-short', '3-long', '3-welcome', '3-dropdown', '3-slug'); CREATE TABLE IF NOT EXISTS topic_group (