Feat: создан changelog для таблиц сущности issue.

This commit is contained in:
Dmitry Sheyko 2023-01-19 18:39:06 +03:00
parent b5ff193b49
commit 7396c2a2ef
6 changed files with 239 additions and 23 deletions

View File

@ -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<String> 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" Поле доснтупное только для премиум акаунтов

View File

@ -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")

View File

@ -0,0 +1,206 @@
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.17.xsd">
<changeSet id="2023-01-19-create-table-milestone" author="Dmitry Sheyko">
<createTable tableName="milestone">
<column name="id" type="int">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="two_id" type="int">
<constraints nullable="false"/>
</column>
<column name="project_id" type="int">
<constraints nullable="false"/>
</column>
<column name="title" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="description" type="varchar(2000)">
<constraints nullable="true"/>
</column>
<column name="state" type="varchar(10)">
<constraints nullable="false"/>
</column>
<column name="created_date" type="datetime">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="datetime">
<constraints nullable="true"/>
</column>
<column name="start_date" type="datetime">
<constraints nullable="true"/>
</column>
<column name="due_date" type="datetime">
<constraints nullable="true"/>
</column>
<column name="expired" type="boolean">
<constraints nullable="false"/>
</column>
<column name="web_url" type="varchar(300)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet id="create-table-issue" author="Dmitry Sheyko">
<createTable tableName="issue">
<column name="id" type="int">
<constraints nullable="false" primaryKey="true"/>
</column>
<column name="two_id" type="int">
<constraints nullable="false"/>
</column>
<column name="project_id" type="int">
<constraints nullable="false"/>
</column>
<column name="title" type="varchar(255)">
<constraints nullable="false"/>
</column>
<column name="description" type="varchar(2000)">
<constraints nullable="true"/>
</column>
<column name="state" type="varchar(10)">
<constraints nullable="false"/>
</column>
<column name="created_date" type="datetime">
<constraints nullable="false"/>
</column>
<column name="updated_date" type="datetime">
<constraints nullable="true"/>
</column>
<column name="closed_at" type="datetime">
<constraints nullable="true"/>
</column>
<column name="closed_by_id" type="int">
<constraints nullable="true" foreignKeyName="fk_issue_closed_by_id_person_id" references="person(id)"/>
</column>
<column name="milestone_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issie_milestone_id_milestone_id" references="milestone(id)"/>
</column>
<column name="author_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issue_author_id_person_id" references="person(id)"/>
</column>
<column name="type" type="varchar(10)">
<constraints nullable="false"/>
</column>
<column name="assignee_id" type="int">
<constraints nullable="true" foreignKeyName="fk_issue_assignee_id_person_id" references="person(id)"/>
</column>
<column name="user_notes_count" type="int">
<constraints nullable="false"/>
</column>
<column name="merge_requests_count" type="int">
<constraints nullable="false"/>
</column>
<column name="up_votes" type="int">
<constraints nullable="false"/>
</column>
<column name="down_votes" type="int">
<constraints nullable="false"/>
</column>
<column name="due_date" type="datetime">
<constraints nullable="true"/>
</column>
<column name="confidential" type="boolean">
<constraints nullable="false"/>
</column>
<column name="discussion_locked" type="int">
<constraints nullable="true"/>
</column>
<column name="issue_type" type="varchar(10)">
<constraints nullable="false"/>
</column>
<column name="web_url" type="varchar(300)">
<constraints nullable="false"/>
</column>
<column name="time_estimate" type="int">
<constraints nullable="false"/>
</column>
<column name="total_time_spent" type="int">
<constraints nullable="false"/>
</column>
<column name="human_time_estimate" type="varchar(20)">
<constraints nullable="true"/>
</column>
<column name="human_total_time_spent" type="varchar(20)">
<constraints nullable="true"/>
</column>
<column name="task_count" type="int">
<constraints nullable="false"/>
</column>
<column name="task_completed_count" type="int">
<constraints nullable="false"/>
</column>
<column name="blocking_issues_count" type="int">
<constraints nullable="false"/>
</column>
<column name="has_tasks" type="boolean">
<constraints nullable="false"/>
</column>
<column name="link_to_self" type="varchar(300)">
<constraints nullable="false"/>
</column>
<column name="link_to_notes" type="varchar(300)">
<constraints nullable="false"/>
</column>
<column name="link_to_award_emoji" type="varchar(300)">
<constraints nullable="false"/>
</column>
<column name="link_to_project" type="varchar(300)">
<constraints nullable="false"/>
</column>
<column name="link_to_closed_as_duplicate_of" type="varchar(300)">
<constraints nullable="true"/>
</column>
<column name="short_reference" type="varchar(100)">
<constraints nullable="false"/>
</column>
<column name="relative_reference" type="varchar(100)">
<constraints nullable="false"/>
</column>
<column name="full_reference" type="varchar(100)">
<constraints nullable="false"/>
</column>
<column name="severity" type="varchar(50)">
<constraints nullable="true"/>
</column>
<column name="moved_to_id" type="int">
<constraints nullable="true"/>
</column>
<column name="service_desk_reply_to" type="varchar(1000)">
<constraints nullable="true"/>
</column>
<column name="epic_issue_id" type="int">
<constraints nullable="true"/>
</column>
</createTable>
</changeSet>
<changeSet id="create-table-issue_labels" author="Dmitry Sheyko">
<createTable tableName="issue_labels">
<column name="issue_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issue_labels_issue_id"
references="issue(id)" deleteCascade="true"/>
</column>
<column name="labels" type="varchar(255)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet id="create-table-issue_assignees" author="Dmitry Sheyko">
<createTable tableName="issue_assignees">
<column name="issue_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issue_assignees_issue_id" references="issue(id)"/>
</column>
<column name="person_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issue_assignees_person_id" references="person(id)"/>
</column>
</createTable>
<addPrimaryKey tableName="issue_assignees" columnNames="issue_id, person_id"/>
</changeSet>
</databaseChangeLog>

View File

@ -9,5 +9,6 @@
<include file="2022-12-03-create-tables.xml" relativeToChangelogFile="true"/>
<include file="2022-12-03-insert.xml" relativeToChangelogFile="true"/>
<include file="2023-01-19-create-tables-for-issue.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

View File

@ -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" Поле доступное только для премиум акаунтов

View File

@ -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"
}