forked from codesquad-members-2024/issue-tracker
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
241 additions
and
2 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
be/issue-tracker/src/main/java/com/issuetracker/comment/domain/Comment.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,21 @@ | ||
package com.issuetracker.comment.domain; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
import org.springframework.data.annotation.Id; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public class Comment { | ||
@Id | ||
@Setter | ||
private Long id; | ||
private final String content; | ||
private final LocalDateTime createDate; | ||
private final boolean isWriter; | ||
private final Long issueId; | ||
private final String memberId; | ||
private final Long fileId; | ||
} |
7 changes: 7 additions & 0 deletions
7
be/issue-tracker/src/main/java/com/issuetracker/comment/repository/CommentRepository.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,7 @@ | ||
package com.issuetracker.comment.repository; | ||
|
||
import com.issuetracker.comment.domain.Comment; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface CommentRepository extends CrudRepository<Comment, Long> { | ||
} |
7 changes: 7 additions & 0 deletions
7
be/issue-tracker/src/main/java/com/issuetracker/file/Repository/FileRepository.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,7 @@ | ||
package com.issuetracker.file.Repository; | ||
|
||
import com.issuetracker.file.domain.File; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface FileRepository extends CrudRepository<File, Long> { | ||
} |
16 changes: 16 additions & 0 deletions
16
be/issue-tracker/src/main/java/com/issuetracker/file/domain/File.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,16 @@ | ||
package com.issuetracker.file.domain; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
import org.springframework.data.annotation.Id; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public class File { | ||
@Id | ||
@Setter | ||
private Long id; | ||
private final String uploadName; | ||
private final String storeName; | ||
} |
22 changes: 22 additions & 0 deletions
22
be/issue-tracker/src/main/java/com/issuetracker/issue/domain/Issue.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,22 @@ | ||
package com.issuetracker.issue.domain; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
import org.springframework.data.annotation.Id; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public class Issue { | ||
@Id | ||
@Setter | ||
private Long id; | ||
private final String title; | ||
private final String content; | ||
private final LocalDateTime createDate; | ||
private final boolean isClosed; | ||
private final String memberId; | ||
private final Long milestoneId; | ||
private final Long fileId; | ||
} |
13 changes: 13 additions & 0 deletions
13
be/issue-tracker/src/main/java/com/issuetracker/issue/domain/IssueAssignee.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 com.issuetracker.issue.domain; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.annotation.Id; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public class IssueAssignee { | ||
@Id | ||
private final Long issueId; | ||
private final String memberId; | ||
} |
13 changes: 13 additions & 0 deletions
13
be/issue-tracker/src/main/java/com/issuetracker/issue/domain/IssueLabel.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 com.issuetracker.issue.domain; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.annotation.Id; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public class IssueLabel { | ||
@Id | ||
private final Long issueId; | ||
private final Long labelId; | ||
} |
20 changes: 20 additions & 0 deletions
20
...ssue-tracker/src/main/java/com/issuetracker/issue/repository/IssueAssigneeRepository.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,20 @@ | ||
package com.issuetracker.issue.repository; | ||
|
||
import com.issuetracker.issue.domain.IssueAssignee; | ||
import java.util.Optional; | ||
import org.springframework.data.jdbc.repository.query.Modifying; | ||
import org.springframework.data.jdbc.repository.query.Query; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface IssueAssigneeRepository extends CrudRepository<IssueAssignee, Long> { | ||
@Modifying | ||
@Query("INSERT INTO issue_assignee (issue_id, member_id) VALUES (:issueId, :memberId)") | ||
void insert(Long issueId, String memberId); | ||
|
||
@Query("SELECT issue_id, member_id FROM issue_assignee WHERE issue_id = :issueId AND member_id = :memberId") | ||
Optional<IssueAssignee> findById(Long issueId, String memberId); | ||
|
||
@Modifying | ||
@Query("DELETE FROM issue_assignee WHERE issue_id = :issueId AND member_id = :memberId") | ||
void deleteById(Long issueId, String memberId); | ||
} |
20 changes: 20 additions & 0 deletions
20
be/issue-tracker/src/main/java/com/issuetracker/issue/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,20 @@ | ||
package com.issuetracker.issue.repository; | ||
|
||
import com.issuetracker.issue.domain.IssueLabel; | ||
import java.util.Optional; | ||
import org.springframework.data.jdbc.repository.query.Modifying; | ||
import org.springframework.data.jdbc.repository.query.Query; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface IssueLabelRepository extends CrudRepository<IssueLabel, Long> { | ||
@Modifying | ||
@Query("INSERT INTO issue_label (issue_id, label_id) VALUES (:issueId, :labelId)") | ||
void insert(Long issueId, Long labelId); | ||
|
||
@Query("SELECT issue_id, label_id FROM issue_label WHERE issue_id = :issueId AND label_id = :labelId") | ||
Optional<IssueLabel> findById(Long issueId, Long labelId); | ||
|
||
@Modifying | ||
@Query("DELETE FROM issue_label WHERE issue_id = :issueId AND label_id = :labelId") | ||
void deleteById(Long issueId, Long labelId); | ||
} |
7 changes: 7 additions & 0 deletions
7
be/issue-tracker/src/main/java/com/issuetracker/issue/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,7 @@ | ||
package com.issuetracker.issue.repository; | ||
|
||
import com.issuetracker.issue.domain.Issue; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface IssueRepository extends CrudRepository<Issue, Long> { | ||
} |
7 changes: 7 additions & 0 deletions
7
...ssue-tracker/src/main/java/com/issuetracker/milestone/Repository/MilestoneRepository.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,7 @@ | ||
package com.issuetracker.milestone.Repository; | ||
|
||
import com.issuetracker.milestone.domain.Milestone; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface MilestoneRepository extends CrudRepository<Milestone, Long> { | ||
} |
19 changes: 19 additions & 0 deletions
19
be/issue-tracker/src/main/java/com/issuetracker/milestone/domain/Milestone.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,19 @@ | ||
package com.issuetracker.milestone.domain; | ||
|
||
import java.time.LocalDateTime; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Setter; | ||
import org.springframework.data.annotation.Id; | ||
|
||
@RequiredArgsConstructor | ||
@Getter | ||
public class Milestone { | ||
@Setter | ||
@Id | ||
private Long id; | ||
private final String name; | ||
private final String description; | ||
private final LocalDateTime dueDate; | ||
private final boolean isClosed; | ||
} |
33 changes: 33 additions & 0 deletions
33
...-tracker/src/test/java/com/issuetracker/issue/repository/IssueAssigneeRepositoryTest.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,33 @@ | ||
package com.issuetracker.issue.repository; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.issuetracker.issue.domain.IssueAssignee; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@SpringBootTest | ||
@Transactional | ||
class IssueAssigneeRepositoryTest { | ||
@Autowired | ||
IssueAssigneeRepository issueAssigneeRepository; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
issueAssigneeRepository.deleteAll(); | ||
} | ||
|
||
@Test | ||
void crud() { | ||
issueAssigneeRepository.insert(1L, "sangchu"); | ||
IssueAssignee find = issueAssigneeRepository.findById(1L, "sangchu").get(); | ||
assertThat(find.getIssueId()).isEqualTo(1L); | ||
assertThat(find.getMemberId()).isEqualTo("sangchu"); | ||
|
||
issueAssigneeRepository.deleteById(1L, "sangchu"); | ||
assertThat(issueAssigneeRepository.count()).isEqualTo(0); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...sue-tracker/src/test/java/com/issuetracker/issue/repository/IssueLabelRepositoryTest.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,34 @@ | ||
package com.issuetracker.issue.repository; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.issuetracker.issue.domain.IssueLabel; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@SpringBootTest | ||
@Transactional | ||
class IssueLabelRepositoryTest { | ||
@Autowired | ||
IssueLabelRepository issueLabelRepository; | ||
|
||
@BeforeEach | ||
void setUp() { | ||
issueLabelRepository.deleteAll(); | ||
} | ||
|
||
@Test | ||
void crud() { | ||
issueLabelRepository.insert(1L, 4L); | ||
IssueLabel find = issueLabelRepository.findById(1L, 4L).get(); | ||
|
||
assertThat(find.getIssueId()).isEqualTo(1L); | ||
assertThat(find.getLabelId()).isEqualTo(4L); | ||
|
||
issueLabelRepository.deleteById(1L, 4L); | ||
assertThat(issueLabelRepository.count()).isEqualTo(0); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -26,10 +26,10 @@ void setUp() { | |
void insert() { | ||
|
||
Member member = new Member("sangchu", "123", "상추", "[email protected]"); | ||
Member saved = memberRepository.insert(member); | ||
memberRepository.insert(member); | ||
Member find = memberRepository.findById("sangchu").get(); | ||
|
||
assertThat(find).isEqualTo(saved); | ||
assertThat(find).isEqualTo(member); | ||
} | ||
|
||
@Test | ||
|