Skip to content

Commit

Permalink
Merge pull request #95 from chunghye98/dev-be/feature/#80
Browse files Browse the repository at this point in the history
[BE] 이슈 라벨, 마일스톤, 참여자 목록 조회 응답 형식 변경
  • Loading branch information
DOEKYONG authored Aug 15, 2023
2 parents b2d44cb + bc7991a commit 25c932a
Show file tree
Hide file tree
Showing 14 changed files with 328 additions and 288 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,20 @@ public ApiResponse<String> postIssues(@Valid @RequestBody IssueWriteRequestDto r
}

@GetMapping("/issues/labels")
public ApiResponse<List<IssueLabelResponseDto>> getIssueLabels() {
List<IssueLabelResponseDto> labels = issueService.getIssueLabels();
public ApiResponse<IssueLabelResponseDto> getIssueLabels() {
IssueLabelResponseDto labels = issueService.getIssueLabels();
return ApiResponse.success(SUCCESS.getStatus(), labels);
}

@GetMapping("/issues/milestones")
public ApiResponse<List<IssueMilestoneResponseDto>> getIssueMilestones() {
List<IssueMilestoneResponseDto> milestones = issueService.getIssueMilestones();
public ApiResponse<IssueMilestoneResponseDto> getIssueMilestones() {
IssueMilestoneResponseDto milestones = issueService.getIssueMilestones();
return ApiResponse.success(SUCCESS.getStatus(), milestones);
}

@GetMapping("/issues/participants")
public ApiResponse<List<IssueUserResponseDto>> getIssueUsers() {
List<IssueUserResponseDto> participants = issueService.getIssueUsers();
public ApiResponse<IssueUserResponseDto> getIssueUsers() {
IssueUserResponseDto participants = issueService.getIssueUsers();
return ApiResponse.success(SUCCESS.getStatus(), participants);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,22 @@
package codesquad.issueTracker.issue.dto;

import codesquad.issueTracker.label.vo.LabelVo;
import codesquad.issueTracker.issue.vo.IssueLabelVo;
import java.util.List;
import lombok.Builder;
import lombok.Getter;

@Getter
public class IssueLabelResponseDto {
private Long id;
private String name;
private String backgroundColor;
private String textColor;
List<IssueLabelVo> labels;

@Builder
public IssueLabelResponseDto(Long id, String name, String backgroundColor, String textColor) {
this.id = id;
this.name = name;
this.backgroundColor = backgroundColor;
this.textColor = textColor;
public IssueLabelResponseDto(List<IssueLabelVo> labels) {
this.labels = labels;
}

public static IssueLabelResponseDto from(LabelVo label) {
public static IssueLabelResponseDto from(List<IssueLabelVo> labels) {
return IssueLabelResponseDto.builder()
.id(label.getId())
.name(label.getName())
.backgroundColor(label.getBackgroundColor())
.textColor(label.getTextColor())
.labels(labels)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package codesquad.issueTracker.issue.dto;

import codesquad.issueTracker.milestone.vo.MilestoneVo;
import codesquad.issueTracker.issue.vo.IssueMileStoneDetailVo;
import java.util.List;
import lombok.Builder;
import lombok.Getter;

@Getter
public class IssueMilestoneResponseDto {
private Long id;
private String name;
private List<IssueMileStoneDetailVo> milestones;

@Builder
public IssueMilestoneResponseDto(Long id, String name) {
this.id = id;
this.name = name;
public IssueMilestoneResponseDto(List<IssueMileStoneDetailVo> milestones) {
this.milestones = milestones;
}

public static IssueMilestoneResponseDto from(MilestoneVo milestoneVo) {
public static IssueMilestoneResponseDto from(List<IssueMileStoneDetailVo> milestones) {
return builder()
.id(milestoneVo.getId())
.name(milestoneVo.getName())
.milestones(milestones)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public IssueOptionResponseDto(List<AssigneeVo> assignees, List<IssueLabelVo> lab
}

public static IssueOptionResponseDto of(List<AssigneeVo> assignees, List<IssueLabelVo> labels, IssueMilestoneVo milestone) {
if (milestone.getId() == null) {
if (milestone.getIssueMileStoneDetailVo().getId() == null) {
return IssueOptionResponseDto.builder()
.assignees(assignees)
.labels(labels)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
package codesquad.issueTracker.issue.dto;

import codesquad.issueTracker.user.domain.User;
import codesquad.issueTracker.issue.vo.IssueUserVo;
import java.util.List;
import lombok.Builder;
import lombok.Getter;

@Getter
public class IssueUserResponseDto {
private Long id;
private String name;
private String imageUrl;
private List<IssueUserVo> participants;


@Builder
public IssueUserResponseDto(Long id, String name, String imageUrl) {
this.id = id;
this.name = name;
this.imageUrl = imageUrl;
public IssueUserResponseDto(List<IssueUserVo> participants) {
this.participants = participants;
}

public static IssueUserResponseDto from(User user) {
public static IssueUserResponseDto from(List<IssueUserVo> participants) {
return IssueUserResponseDto.builder()
.id(user.getId())
.name(user.getName())
.imageUrl(user.getProfileImg())
.participants(participants)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public int findCountByStatusAndMilestone(boolean status, IssueMilestoneVo milest
+ "and i.is_deleted = false "
+ "and i.is_closed = :status";
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue("milestoneId", milestone.getId());
params.addValue("milestoneId", milestone.getIssueMileStoneDetailVo().getId());
params.addValue("status", status);
return jdbcTemplate.queryForObject(sql, params, Integer.class);
}
Expand Down
Loading

0 comments on commit 25c932a

Please sign in to comment.