Fix: внесены правки по результатам ревью 1.

This commit is contained in:
Dmitry Sheyko 2023-01-22 00:56:50 +03:00
parent 331ddd7314
commit 30ff49eb75
12 changed files with 38 additions and 136 deletions

View File

@ -1,5 +1,10 @@
package dev.struchkov.bot.gitlab.context.domain; package dev.struchkov.bot.gitlab.context.domain;
/**
* @author Dmitry Sheyko 21.01.2021
*/
public enum IssueState { public enum IssueState {
OPENED, CLOSED OPENED, CLOSED
} }

View File

@ -1,6 +1,10 @@
package dev.struchkov.bot.gitlab.context.domain; package dev.struchkov.bot.gitlab.context.domain;
/**
* @author Dmitry Sheyko 21.01.2021
*/
public enum IssueType { public enum IssueType {
ISSUE,
INCIDENT ISSUE, INCIDENT
} }

View File

@ -1,5 +0,0 @@
package dev.struchkov.bot.gitlab.context.domain;
public enum MilestoneState {
ACTIVE, CLOSED
}

View File

@ -28,14 +28,11 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
* Сущность Issue. * Сущность Issue.
* *
* @author Dmitry Sheyko [17.01.2023] * @author Dmitry Sheyko [17.01.2023]
*/ */
// При запросе issue учесть что пагинация по умолчанию - 20 объектов
@Getter @Getter
@Setter @Setter
@Entity @Entity

View File

@ -1,10 +0,0 @@
package dev.struchkov.bot.gitlab.core.service.parser;
import dev.struchkov.bot.gitlab.context.domain.IssueState;
import java.util.Set;
public class IssueRequestParser {
private static final Set<IssueState> OLD_STATUSES = Set.of(
IssueState.OPENED, IssueState.CLOSED);
}

View File

@ -3,48 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> 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"> <changeSet id="2023-01-19-create-table-issue" 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"> <createTable tableName="issue">
<column name="id" type="int"> <column name="id" type="int">
<constraints nullable="false" primaryKey="true"/> <constraints nullable="false" primaryKey="true"/>
@ -76,18 +35,12 @@
<column name="closed_by_id" type="int"> <column name="closed_by_id" type="int">
<constraints nullable="true" foreignKeyName="fk_issue_closed_by_id_person_id" references="person(id)"/> <constraints nullable="true" foreignKeyName="fk_issue_closed_by_id_person_id" references="person(id)"/>
</column> </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"> <column name="author_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issue_author_id_person_id" references="person(id)"/> <constraints nullable="false" foreignKeyName="fk_issue_author_id_person_id" references="person(id)"/>
</column> </column>
<column name="type" type="varchar(10)"> <column name="type" type="varchar(10)">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </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"> <column name="user_notes_count" type="int">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>
@ -109,88 +62,37 @@
<column name="discussion_locked" type="int"> <column name="discussion_locked" type="int">
<constraints nullable="true"/> <constraints nullable="true"/>
</column> </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"> <column name="task_count" type="int">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>
<column name="task_completed_count" type="int"> <column name="task_completed_count" type="int">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>
<column name="web_url" type="varchar(300)">
<constraints nullable="false"/>
</column>
<column name="blocking_issues_count" type="int"> <column name="blocking_issues_count" type="int">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>
<column name="has_tasks" type="boolean"> <column name="has_tasks" type="boolean">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </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> </createTable>
</changeSet> </changeSet>
<changeSet id="create-table-issue_labels" author="Dmitry Sheyko"> <changeSet id="2023-01-19-create-table-issue_label" author="Dmitry Sheyko">
<createTable tableName="issue_labels"> <createTable tableName="issue_label">
<column name="issue_id" type="int"> <column name="issue_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issue_labels_issue_id" <constraints nullable="false" foreignKeyName="fk_issue_label_issue_id"
references="issue(id)" deleteCascade="true"/> references="issue(id)" deleteCascade="true"/>
</column> </column>
<column name="labels" type="varchar(255)"> <column name="label" type="varchar(255)">
<constraints nullable="false"/> <constraints nullable="false"/>
</column> </column>
</createTable> </createTable>
</changeSet> </changeSet>
<changeSet id="create-table-issue_assignees" author="Dmitry Sheyko"> <changeSet id="2023-01-19-create-table-issue_assignees" author="Dmitry Sheyko">
<createTable tableName="issue_assignees"> <createTable tableName="issue_assignees">
<column name="issue_id" type="int"> <column name="issue_id" type="int">
<constraints nullable="false" foreignKeyName="fk_issue_assignees_issue_id" references="issue(id)"/> <constraints nullable="false" foreignKeyName="fk_issue_assignees_issue_id" references="issue(id)"/>

View File

@ -13,9 +13,9 @@ import java.util.Set;
/** /**
* @author Dmitry Sheyko [17.01.2023] * @author Dmitry Sheyko [17.01.2023]
*/ */
@Data @Data
public class IssueJson { public class IssueJson {
private Long id; private Long id;
@JsonProperty("iid") @JsonProperty("iid")
@ -74,7 +74,7 @@ public class IssueJson {
private Integer discussionLocked; private Integer discussionLocked;
@JsonProperty("issue_type") @JsonProperty("issue_type")
private String issueType; //TODO выяснить зачем дублирует поле type private String issueType;
@JsonProperty("web_url") @JsonProperty("web_url")
private String webUrl; private String webUrl;
@ -104,5 +104,6 @@ public class IssueJson {
private Long serviceDescReplyTo; private Long serviceDescReplyTo;
@JsonProperty("epic_issue_id") @JsonProperty("epic_issue_id")
private Long epicId; // "epic_issue_id" Поле доступное только для премиум акаунтов private Long epicId;
} }

View File

@ -5,11 +5,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* @author Dmitry Sheyko [17.01.2023] * @author Dmitry Sheyko [17.01.2023]
*/ */
public enum IssueStateJson { public enum IssueStateJson {
@JsonProperty("opened") @JsonProperty("opened")
OPENED, OPENED,
@JsonProperty("closed") @JsonProperty("closed")
CLOSED CLOSED
} }

View File

@ -1,6 +1,10 @@
package dev.struchkov.bot.gitlab.sdk.domain; package dev.struchkov.bot.gitlab.sdk.domain;
/**
* @author Dmitry Sheyko 21.01.2021
*/
public enum IssueTypeJson { public enum IssueTypeJson {
ISSUE,
INCIDENT ISSUE, INCIDENT
} }

View File

@ -12,9 +12,9 @@ import java.time.LocalDateTime;
/** /**
* @author Dmitry Sheyko [17.01.2023] * @author Dmitry Sheyko [17.01.2023]
*/ */
@Data @Data
public class MilestoneJson { public class MilestoneJson {
private Long id; private Long id;
@JsonProperty("iid") @JsonProperty("iid")
@ -49,4 +49,5 @@ public class MilestoneJson {
@JsonProperty("web_url") @JsonProperty("web_url")
private String webUrl; private String webUrl;
} }

View File

@ -5,11 +5,12 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* @author Dmitry Sheyko [17.01.2023] * @author Dmitry Sheyko [17.01.2023]
*/ */
public enum MilestoneStateJson { public enum MilestoneStateJson {
@JsonProperty("active") @JsonProperty("active")
ACTIVE, ACTIVE,
@JsonProperty("closed") @JsonProperty("closed")
CLOSED CLOSED
} }

View File

@ -6,9 +6,9 @@ import lombok.Data;
/** /**
* @author Dmitry Sheyko [17.01.2023] * @author Dmitry Sheyko [17.01.2023]
*/ */
@Data @Data
public class ReferencesJson { public class ReferencesJson {
@JsonProperty("short") @JsonProperty("short")
private String shortReference; private String shortReference;
@ -17,4 +17,5 @@ public class ReferencesJson {
@JsonProperty("full") @JsonProperty("full")
private String fullReference; private String fullReference;
} }