From 244902d788007de877595254b16546e9144ee6db Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Sun, 5 Mar 2023 20:59:09 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20ssh=20=D0=B8=20http=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=83=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BE=20=D0=BD=D0=BE=D0=B2=D0=BE=D0=BC=20?= =?UTF-8?q?=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bot/gitlab/context/domain/entity/Project.java | 6 ++++++ .../context/domain/notify/project/NewProjectNotify.java | 8 +++++++- .../gitlab/core/service/convert/ProjectJsonConverter.java | 2 ++ .../bot/gitlab/core/service/impl/ProjectServiceImpl.java | 2 ++ .../liquibase/v.1.0.0/2022-12-03-create-tables.xml | 2 ++ .../dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java | 6 ++++++ .../service/notify/NewProjectNotifyGenerator.java | 4 ++++ 7 files changed, 29 insertions(+), 1 deletion(-) diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java index 90c2680..52704b6 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Project.java @@ -39,6 +39,12 @@ public class Project { @Column(name = "web_url") private String webUrl; + @Column(name = "ssh_url_to_repo") + private String sshUrlToRepo; + + @Column(name = "http_url_to_repo") + private String httpUrlToRepo; + @Column(name = "notification") private boolean notification; diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/project/NewProjectNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/project/NewProjectNotify.java index 90091c3..a91ac95 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/project/NewProjectNotify.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/project/NewProjectNotify.java @@ -21,6 +21,8 @@ public final class NewProjectNotify implements Notify { private final String projectUrl; private final String projectDescription; private final String authorName; + private final String sshUrlToRepo; + private final String httpUrlToRepo; @Builder public NewProjectNotify( @@ -28,13 +30,17 @@ public final class NewProjectNotify implements Notify { String projectName, String projectUrl, String projectDescription, - String authorName + String authorName, + String sshUrlToRepo, + String httpUrlToRepo ) { this.projectId = projectId; this.projectName = projectName; this.projectUrl = projectUrl; this.projectDescription = projectDescription; this.authorName = authorName; + this.sshUrlToRepo = sshUrlToRepo; + this.httpUrlToRepo = httpUrlToRepo; } @Override diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java index c2db30b..85d4c70 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/convert/ProjectJsonConverter.java @@ -22,6 +22,8 @@ public class ProjectJsonConverter implements Converter { project.setDescription(source.getDescription()); project.setName(source.getName()); project.setWebUrl(source.getWebUrl()); + project.setHttpUrlToRepo(source.getHttpUrlToRepo()); + project.setSshUrlToRepo(source.getSshUrlToRepo()); return project; } diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java index b8c0e2a..5210320 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/impl/ProjectServiceImpl.java @@ -118,6 +118,8 @@ public class ProjectServiceImpl implements ProjectService { .projectDescription(newProject.getDescription()) .projectName(newProject.getName()) .projectUrl(newProject.getWebUrl()) + .sshUrlToRepo(newProject.getSshUrlToRepo()) + .httpUrlToRepo(newProject.getHttpUrlToRepo()) .authorName(authorName) .build() ); diff --git a/gitlab-app/src/main/resources/liquibase/v.1.0.0/2022-12-03-create-tables.xml b/gitlab-app/src/main/resources/liquibase/v.1.0.0/2022-12-03-create-tables.xml index 5265037..81d5102 100644 --- a/gitlab-app/src/main/resources/liquibase/v.1.0.0/2022-12-03-create-tables.xml +++ b/gitlab-app/src/main/resources/liquibase/v.1.0.0/2022-12-03-create-tables.xml @@ -45,6 +45,8 @@ + + diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java index e714e26..6f848a8 100644 --- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java +++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/ProjectJson.java @@ -27,6 +27,12 @@ public class ProjectJson { @JsonProperty("web_url") private String webUrl; + @JsonProperty("ssh_url_to_repo") + private String sshUrlToRepo; + + @JsonProperty("http_url_to_repo") + private String httpUrlToRepo; + @JsonProperty("creator_id") private Long creatorId; diff --git a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java index 79784f2..7c28326 100644 --- a/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java +++ b/telegram-bot/src/main/java/dev/struchkov/bot/gitlab/telegram/service/notify/NewProjectNotifyGenerator.java @@ -38,6 +38,10 @@ public class NewProjectNotifyGenerator implements NotifyBoxAnswerGenerator