Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 이슈 라벨, 마일스톤, 참여자 목록 조회 응답 형식 변경 #95

Merged
merged 3 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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