From 7396c2a2ef0ae359bad0c6088f9212055bb15bf3 Mon Sep 17 00:00:00 2001 From: DmitrySheyko Date: Thu, 19 Jan 2023 18:39:06 +0300 Subject: [PATCH] =?UTF-8?q?Feat:=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=20?= =?UTF-8?q?changelog=20=D0=B4=D0=BB=D1=8F=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8?= =?UTF-8?q?=D1=86=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20iss?= =?UTF-8?q?ue.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gitlab/context/domain/entity/Issue.java | 38 ++-- .../context/domain/entity/Milestone.java | 2 +- .../2023-01-19-create-tables-for-issue.xml | 206 ++++++++++++++++++ .../resources/liquibase/v.1.0.0/changelog.xml | 1 + .../bot/gitlab/sdk/domain/IssueJson.java | 6 +- .../bot/gitlab/sdk/domain/TimeStatsJson.java | 9 + 6 files changed, 239 insertions(+), 23 deletions(-) create mode 100644 gitlab-app/src/main/resources/liquibase/v.1.0.0/2023-01-19-create-tables-for-issue.xml diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java index 88aad0c..0253047 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Issue.java @@ -34,7 +34,7 @@ public class Issue { @EqualsAndHashCode.Include private Long id; - @Column(name = "iid") + @Column(name = "two_id") private Long twoId; @Column(name = "project_id") @@ -64,7 +64,7 @@ public class Issue { private Person closedBy; @ElementCollection - @CollectionTable(name = "issue_label", joinColumns = @JoinColumn(name = "label_id")) + @CollectionTable(name = "issue_labels", joinColumns = @JoinColumn(name = "label_id")) @Column(name = "labels") private Set labels = new HashSet<>(); @@ -93,29 +93,29 @@ public class Issue { private IssueType type; // ОБразец приходящего значения "INCIDENT" @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE}) - @JoinColumn(name = "assignee") + @JoinColumn(name = "assignee_id") private Person assignee; - @Column(name = "user_notes_count") //Количество комментов пользователя + @Column(name = "user_notes_count") private Integer userNotesCount; @Column(name = "merge_requests_count") private Integer mergeRequestsCount; - @Column(name = "upvotes") // Количество лайков + @Column(name = "up_votes") private Integer upVotes; - @Column(name = "downvotes") // Количество дизлайков + @Column(name = "down_votes") private Integer downVotes; @Column(name = "due_date") private LocalDateTime dueDate; - @Column(name = "confidential") // Конфиденцальное или нет + @Column(name = "confidential") private Boolean confidential; @Column(name = "discussion_locked") - private Integer discussionLocked; //TODO выяснить тип поляя. + private Integer discussionLocked; @Column(name = "issue_type") private String issueType; //TODO выяснить зачем дублирует поле type Образец приходящего значения "incident" @@ -123,7 +123,6 @@ public class Issue { @Column(name = "web_url") private String webUrl; - @Embedded @AttributeOverrides({ @AttributeOverride(name = "timeEstimate", column = @Column(name = "time_estimate")), @@ -135,8 +134,8 @@ public class Issue { @Embedded @AttributeOverrides({ - @AttributeOverride(name = "count", column = @Column(name = "count")), - @AttributeOverride(name = "completedCount", column = @Column(name = "completed_count")) + @AttributeOverride(name = "count", column = @Column(name = "task_count")), + @AttributeOverride(name = "completedCount", column = @Column(name = "task_completed_count")) }) private TaskCompletionStatus taskCompletionStatus; @@ -148,11 +147,11 @@ public class Issue { @Embedded @AttributeOverrides({ - @AttributeOverride(name = "self", column = @Column(name = "self")), - @AttributeOverride(name = "notes", column = @Column(name = "notes")), - @AttributeOverride(name = "awardEmoji", column = @Column(name = "award_emoji")), - @AttributeOverride(name = "project", column = @Column(name = "project")), - @AttributeOverride(name = "closedAsDuplicateOf", column = @Column(name = "closed_as_duplicate_of")) + @AttributeOverride(name = "self", column = @Column(name = "link_to_self")), + @AttributeOverride(name = "notes", column = @Column(name = "link_to_notes")), + @AttributeOverride(name = "awardEmoji", column = @Column(name = "link_to_award_emoji")), + @AttributeOverride(name = "project", column = @Column(name = "link_to_project")), + @AttributeOverride(name = "closedAsDuplicateOf", column = @Column(name = "link_to_closed_as_duplicate_of")) }) private Links links; @@ -164,8 +163,9 @@ public class Issue { }) private References references; - /*Возможно надо заменить на енум "UNKNOWN", Critical - S1, High - S2, Medium - S3, Low - S4. - Но это поле доступно только для премиум акаунтов + /** + Возможно надо заменить на енум: "UNKNOWN", "Critical - S1", "High - S2", "Medium - S3", "Low - S4". + Но выбор любых значений кроме "UNKNOWN" доступен только для премиум акаунтов и я не могу получить точные значения котоые оно принимает. */ @Column(name = "severity") private String severity; @@ -174,7 +174,7 @@ public class Issue { private Long movedToId; @Column(name = "service_desk_reply_to") - private String serviceDescReplyTo; //TODO не понятен тип поля + private String serviceDescReplyTo; @Column(name = "epic_issue_id") private Long epicId; // "epic_issue_id" Поле доснтупное только для премиум акаунтов diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java index 3bde4d5..ed7e7b3 100644 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java +++ b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/entity/Milestone.java @@ -28,7 +28,7 @@ public class Milestone { @EqualsAndHashCode.Include private Long id; - @Column(name = "iid") + @Column(name = "two_id") private Long twoId; @Column(name = "project_id") diff --git a/gitlab-app/src/main/resources/liquibase/v.1.0.0/2023-01-19-create-tables-for-issue.xml b/gitlab-app/src/main/resources/liquibase/v.1.0.0/2023-01-19-create-tables-for-issue.xml new file mode 100644 index 0000000..5d11b50 --- /dev/null +++ b/gitlab-app/src/main/resources/liquibase/v.1.0.0/2023-01-19-create-tables-for-issue.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gitlab-app/src/main/resources/liquibase/v.1.0.0/changelog.xml b/gitlab-app/src/main/resources/liquibase/v.1.0.0/changelog.xml index 31d0925..a392bdb 100644 --- a/gitlab-app/src/main/resources/liquibase/v.1.0.0/changelog.xml +++ b/gitlab-app/src/main/resources/liquibase/v.1.0.0/changelog.xml @@ -9,5 +9,6 @@ + \ No newline at end of file diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/IssueJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/IssueJson.java index 88449b4..11acb8e 100644 --- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/IssueJson.java +++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/IssueJson.java @@ -71,7 +71,7 @@ public class IssueJson { private Boolean confidential; @JsonProperty("discussion_locked") - private Integer discussionLocked; //TODO выяснить тип поля + private Integer discussionLocked; @JsonProperty("issue_type") private String issueType; //TODO выяснить зачем дублирует поле type @@ -95,13 +95,13 @@ public class IssueJson { private LinksJson links; private ReferencesJson references; - private String severity; //TODO заменить на енум "UNKNOWN", Critical - S1, High - S2, Medium - S3, Low - S4, + private String severity; @JsonProperty("moved_to_id") private Long movedToId; @JsonProperty("service_desk_reply_to") - private Long serviceDescReplyTo; //TODO не понятен тип поля + private Long serviceDescReplyTo; @JsonProperty("epic_issue_id") private Long epicId; // "epic_issue_id" Поле доступное только для премиум акаунтов diff --git a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/TimeStatsJson.java b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/TimeStatsJson.java index 91d3943..4eeef90 100644 --- a/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/TimeStatsJson.java +++ b/gitlab-sdk/src/main/java/dev/struchkov/bot/gitlab/sdk/domain/TimeStatsJson.java @@ -1,5 +1,6 @@ package dev.struchkov.bot.gitlab.sdk.domain; +import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; /** @@ -8,8 +9,16 @@ import lombok.Data; @Data public class TimeStatsJson { + + @JsonProperty("time_estimate") private Integer timeEstimate; + + @JsonProperty("total_time_spent") private Integer totalTimeSpent; // количество секунд затраченых на работы, пример 37800" + + @JsonProperty("human_time_estimate") private String humanTimeEstimate; + + @JsonProperty("human_total_time_spent") private String humanTotalTimeSpent; // Время строкой, пример "10h 30m" } \ No newline at end of file