Skip to content

Commit

Permalink
FEAT: issue와 관련된 swagger 작성 (codesquad-2023-group04#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
birdieHyun committed May 20, 2023
1 parent fb411fe commit c0d7561
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package issuetracker.issuetracker.domain.issue;


import io.swagger.v3.oas.annotations.tags.Tag;
import issuetracker.issuetracker.domain.issue.comment.dto.CommentInIssueDTO;
import issuetracker.issuetracker.domain.issue.comment.dto.CommentPostDTO;
import issuetracker.issuetracker.domain.issue.dto.PostingIssueDTO;
import issuetracker.issuetracker.domain.issue.dto.IssueDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@Tag(name = "posts", description = "issue 메인 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/issues")
public class IssueController {


@PostMapping("/{issueId}")
public void postIssue(@RequestBody PostingIssueDTO issue) {
// 저장하는 로직 추가
}

@GetMapping("/{issueId}")
public IssueDTO explainIssue(@RequestParam Long issueId) {
// findByIssue

return new IssueDTO();
}

@PutMapping("/{issueId}")
public void updateIssue(@RequestBody PostingIssueDTO issue) {
// 수정하는 메서드 생성
}

@DeleteMapping("/{issueId}")
public void deleteIssue(@RequestParam Long issueId) {
// 삭제 로직
}

@GetMapping("/{issueId}/comments")
public List<CommentInIssueDTO> showComment(@RequestParam Long issueId) {
// TODO 댓글 리스트 구현
return new ArrayList<>();
}

@PostMapping("/{issueId}/comments")
public void postComment(@RequestBody CommentPostDTO comment) {
// TODO 댓글 작성하기 구현

}

@PutMapping("/{issueId}/comments/{commentId}")
public void updateComment(@RequestParam Long issueId, @RequestParam Long commentId, @RequestBody CommentPostDTO comment) {
// TODO 댓글 수정하기 구현
}

@DeleteMapping("/{issueId}/comments/{commentId}")
public void deleteComment(@RequestParam Long issueId, @RequestParam Long commentId) {
// TODO 댓글 삭제하기 구현
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package issuetracker.issuetracker.domain.issue.dto.req;
package issuetracker.issuetracker.domain.issue.dto;

import issuetracker.issuetracker.domain.label.dto.LabelDTO;
import issuetracker.issuetracker.domain.user.dto.AssigneeDTO;
Expand All @@ -8,20 +8,26 @@
import nonapi.io.github.classgraph.json.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Set;

@Getter
@Setter
public class IssueDTO {
@Id
@NotNull
private Long issueId;
@NotNull
private String title;
@NotNull
private LocalDateTime createTime;
@NotNull
private LocalDateTime updateTime;
@NotNull
private Boolean isOPen;
private String milestone;

@NotNull
private AuthorDTO author;

@MappedCollection(idColumn = "issue_id")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package issuetracker.issuetracker.domain.issue.dto;

import issuetracker.issuetracker.domain.issue.comment.dto.CommentInIssueDTO;
import issuetracker.issuetracker.domain.label.dto.LabelDTO;
import issuetracker.issuetracker.domain.user.dto.AssigneeDTO;
import issuetracker.issuetracker.domain.user.dto.AuthorDTO;
import lombok.Getter;
import lombok.Setter;
import nonapi.io.github.classgraph.json.Id;
import org.springframework.data.relational.core.mapping.MappedCollection;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.Set;

@Getter
@Setter
public class IssueDetailInfoDTO {

@Id
@NotNull
private Long issueId;
@NotNull
private String title;
@NotNull
private LocalDateTime createTime;
@NotNull
private LocalDateTime updateTime;
@NotNull
private Boolean isOPen;
private String milestone;
@NotNull
private AuthorDTO author;

@MappedCollection(idColumn = "issue_id")
private Set<AssigneeDTO> assignees;

@MappedCollection(idColumn = "issue_id")
private Set<LabelDTO> label;

private Set<CommentInIssueDTO> reply;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package issuetracker.issuetracker.domain.issue.dto;

import issuetracker.issuetracker.domain.label.dto.LabelDTO;
import issuetracker.issuetracker.domain.milestone.Milestone;
import issuetracker.issuetracker.domain.milestone.dto.MileStoneDTO;
import issuetracker.issuetracker.domain.user.dto.AssigneeDTO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotNull;

@Getter
@Setter
@AllArgsConstructor
public class PostingIssueDTO {
@NotNull
private String title;
private String contents;
private String fileUrl;
private AssigneeDTO assignee;
private LabelDTO label;
private MileStoneDTO milestone;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package issuetracker.issuetracker.domain.issue.repositroy;

import issuetracker.issuetracker.domain.issue.dto.req.IssueDTO;
import issuetracker.issuetracker.domain.issue.dto.IssueDTO;
import issuetracker.issuetracker.domain.issue.mapper.IssueRowMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.jdbc.core.JdbcTemplate;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package issuetracker.issuetracker.domain.page.dto;

import issuetracker.issuetracker.domain.issue.dto.req.IssueDTO;
import issuetracker.issuetracker.domain.issue.dto.IssueDTO;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
Expand Down

0 comments on commit c0d7561

Please sign in to comment.