-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from 2024-Iris/issue
Issue 저장 로직 구현
- Loading branch information
Showing
26 changed files
with
816 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package site.iris.issuefy.entity; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor | ||
@Table(name = "issue_label") | ||
public class IssueLabel { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "issue_id") | ||
private Issue issue; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "label_id") | ||
private Label label; | ||
|
||
private IssueLabel(Issue issue, Label label) { | ||
this.issue = issue; | ||
this.label = label; | ||
} | ||
|
||
public static IssueLabel of(Issue issue, Label label) { | ||
return new IssueLabel(issue, label); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package site.iris.issuefy.mapper; | ||
|
||
import org.mapstruct.Mapper; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
import site.iris.issuefy.entity.Label; | ||
import site.iris.issuefy.response.LabelResponse; | ||
|
||
@Mapper | ||
public interface LabelMapper { | ||
LabelMapper INSTANCE = Mappers.getMapper(LabelMapper.class); | ||
|
||
LabelResponse labelEntityToLabelDto(Label label); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package site.iris.issuefy.model.dto; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import site.iris.issuefy.entity.Label; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class IssueDto { | ||
@JsonProperty("id") | ||
private Long ghIssueId; | ||
|
||
private String title; | ||
private boolean isStarred; | ||
private boolean isRead; | ||
private String state; | ||
|
||
@JsonProperty("created_at") | ||
private Date createdAt; | ||
|
||
@JsonProperty("updated_at") | ||
private Date updatedAt; | ||
|
||
@JsonProperty("closed_at") | ||
private Date closedAt; | ||
|
||
private List<Label> labels; | ||
|
||
public static IssueDto of(Long ghIssueId, String title, boolean isStarred, boolean isRead, String state, | ||
Date createdAt, | ||
Date updatedAt, Date closedAt, List<Label> labels) { | ||
return new IssueDto(ghIssueId, title, isStarred, isRead, state, createdAt, updatedAt, closedAt, | ||
labels); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package site.iris.issuefy.model.dto; | ||
|
||
import lombok.Data; | ||
import lombok.Getter; | ||
|
||
@Data | ||
@Getter | ||
public class LabelDto { | ||
Long id; | ||
String name; | ||
String color; | ||
} | ||
|
||
|
8 changes: 8 additions & 0 deletions
8
src/main/java/site/iris/issuefy/repository/IssueLabelRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package site.iris.issuefy.repository; | ||
|
||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import site.iris.issuefy.entity.IssueLabel; | ||
|
||
public interface IssueLabelRepository extends CrudRepository<IssueLabel, Long> { | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/site/iris/issuefy/repository/IssueRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package site.iris.issuefy.repository; | ||
|
||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import site.iris.issuefy.entity.Issue; | ||
|
||
public interface IssueRepository extends CrudRepository<Issue, Long> { | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/site/iris/issuefy/repository/LabelRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package site.iris.issuefy.repository; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import org.springframework.data.repository.CrudRepository; | ||
|
||
import site.iris.issuefy.entity.Label; | ||
|
||
public interface LabelRepository extends CrudRepository<Label, Long> { | ||
Optional<Label> findByNameAndColor(String name, String color); | ||
Optional<List<Label>> findByIssue_id(Long issueId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 35 additions & 4 deletions
39
src/main/java/site/iris/issuefy/response/IssueResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,48 @@ | ||
package site.iris.issuefy.response; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class IssueResponse { | ||
private Long id; | ||
private int githubIssueNumber; | ||
private Long githubIssueId; | ||
private String state; | ||
private String title; | ||
private String label; | ||
private List<LabelResponse> labels; | ||
private boolean isRead; | ||
private boolean isStarred; | ||
private Date createdAt; | ||
private Date updatedAt; | ||
private Date closedAt; | ||
|
||
public static IssueResponse of(Long id, int githubIssueNumber, String title, String label) { | ||
return new IssueResponse(id, githubIssueNumber, title, label); | ||
public static IssueResponse of( | ||
Long id, | ||
Long githubIssueId, | ||
String state, | ||
String title, | ||
List<LabelResponse> labels, | ||
boolean isRead, | ||
boolean isStarred, | ||
Date createdAt, | ||
Date updatedAt, | ||
Date closedAt) { | ||
return new IssueResponse( | ||
id, | ||
githubIssueId, | ||
state, | ||
title, | ||
labels, | ||
isRead, | ||
isStarred, | ||
createdAt, | ||
updatedAt, | ||
closedAt | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package site.iris.issuefy.response; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class LabelResponse { | ||
String name; | ||
String color; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/site/iris/issuefy/response/RepositoryIssuesResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package site.iris.issuefy.response; | ||
|
||
import java.util.List; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class RepositoryIssuesResponse { | ||
private String repositoryName; | ||
private List<IssueResponse> issues; | ||
} |
Oops, something went wrong.