From cdce68875edd736a7102837cc74971cb811c03c7 Mon Sep 17 00:00:00 2001 From: Simon Dalvai Date: Wed, 17 Jan 2024 09:59:53 +0100 Subject: [PATCH] backend: add highlighted and theme flags --- .../webcomponents/common/data/model/WebcomponentModel.java | 4 ++++ .../adapter/in/web/rest/WebcomponentEntryRest.java | 4 ++++ .../repository/mapper/WebcomponentModelMapper.java | 3 +++ .../dataservice/application/domain/Webcomponent.java | 3 +++ .../migration/V2024_01_17.01__add_highlighted_and_theme.sql | 5 +++++ 5 files changed, 19 insertions(+) create mode 100644 backend/data-service/src/main/resources/db/migration/V2024_01_17.01__add_highlighted_and_theme.sql diff --git a/backend/common/src/main/java/it/bz/opendatahub/webcomponents/common/data/model/WebcomponentModel.java b/backend/common/src/main/java/it/bz/opendatahub/webcomponents/common/data/model/WebcomponentModel.java index cd08269f..86b80bfc 100644 --- a/backend/common/src/main/java/it/bz/opendatahub/webcomponents/common/data/model/WebcomponentModel.java +++ b/backend/common/src/main/java/it/bz/opendatahub/webcomponents/common/data/model/WebcomponentModel.java @@ -52,4 +52,8 @@ public class WebcomponentModel { private List searchTags; private Boolean deleted; + + private Boolean highlighted; + + private String theme; } diff --git a/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/in/web/rest/WebcomponentEntryRest.java b/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/in/web/rest/WebcomponentEntryRest.java index a890f6f0..cb69f244 100644 --- a/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/in/web/rest/WebcomponentEntryRest.java +++ b/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/in/web/rest/WebcomponentEntryRest.java @@ -36,4 +36,8 @@ public class WebcomponentEntryRest { private List searchTags; private WebcomponentVersionRest currentVersion; + + private Boolean highlighted; + + private String theme; } diff --git a/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/out/persistence/repository/mapper/WebcomponentModelMapper.java b/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/out/persistence/repository/mapper/WebcomponentModelMapper.java index c53a6323..eeba49d7 100644 --- a/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/out/persistence/repository/mapper/WebcomponentModelMapper.java +++ b/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/adapter/out/persistence/repository/mapper/WebcomponentModelMapper.java @@ -29,6 +29,9 @@ public WebcomponentModel mapRow(ResultSet resultSet, int i) throws SQLException model.setRepositoryUrl(resultSet.getString("repository_url")); model.setImage(resultSet.getString("image")); model.setLicense(resultSet.getString("license")); + model.setHighlighted(resultSet.getBoolean("highlighted")); + model.setTheme(resultSet.getString("theme")); + try { model.setCopyrightHolders( diff --git a/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/domain/Webcomponent.java b/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/domain/Webcomponent.java index 6139c12a..dcd4d5d8 100644 --- a/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/domain/Webcomponent.java +++ b/backend/data-service/src/main/java/it/bz/opendatahub/webcomponents/dataservice/application/domain/Webcomponent.java @@ -37,4 +37,7 @@ public class Webcomponent { private Boolean deleted; + private Boolean highlighted; + + private String theme; } diff --git a/backend/data-service/src/main/resources/db/migration/V2024_01_17.01__add_highlighted_and_theme.sql b/backend/data-service/src/main/resources/db/migration/V2024_01_17.01__add_highlighted_and_theme.sql new file mode 100644 index 00000000..b60d3f50 --- /dev/null +++ b/backend/data-service/src/main/resources/db/migration/V2024_01_17.01__add_highlighted_and_theme.sql @@ -0,0 +1,5 @@ +alter table webcomponent + add highlighted boolean default false not null; + +alter table webcomponent + add theme text default "dark" not null; \ No newline at end of file