Skip to content

Commit da08ed1

Browse files
committed
CLAP-408 Refactor: 팀 현황 조회 매핑 로직 매퍼 메서드로 이동
<footer> - #529
1 parent 24bdc69 commit da08ed1

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

src/main/java/clap/server/adapter/inbound/web/dto/task/response/TeamStatusResponse.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,4 @@ public record TeamStatusResponse(
88
int totalInReviewingTaskCount,
99
int totalTaskCount
1010
) {
11-
// 기존 생성자 (3개 파라미터)
12-
public TeamStatusResponse(List<TeamTaskResponse> members, int totalInProgressTaskCount, int totalInReviewingTaskCount) {
13-
this(
14-
(members == null) ? List.of() : members,
15-
totalInProgressTaskCount,
16-
totalInReviewingTaskCount,
17-
totalInProgressTaskCount + totalInReviewingTaskCount
18-
);
19-
}
20-
21-
// 추가된 생성자 (List만 받음)
22-
public TeamStatusResponse(List<TeamTaskResponse> members) {
23-
this(members, 0, 0); // 기본값을 사용하여 생성
24-
}
2511
}

src/main/java/clap/server/application/mapper/response/TeamTaskResponseMapper.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package clap.server.application.mapper.response;
22

3+
import clap.server.adapter.inbound.web.dto.task.response.TeamStatusResponse;
34
import clap.server.adapter.inbound.web.dto.task.response.TeamTaskItemResponse;
45
import clap.server.adapter.inbound.web.dto.task.response.TeamTaskResponse;
5-
import clap.server.adapter.outbound.persistense.entity.task.constant.TaskStatus;
66
import clap.server.domain.model.task.Task;
77

88
import java.util.LinkedHashMap;
@@ -25,10 +25,10 @@ private static TeamTaskResponse toTeamTaskResponse(Map.Entry<Long, List<Task>> e
2525
.map(TeamTaskResponseMapper::toTeamTaskItemResponse)
2626
.collect(Collectors.toList());
2727

28-
int inProgressTaskCount = (int) entry.getValue().stream().filter(t -> t.getTaskStatus() == TaskStatus.IN_PROGRESS).count();
29-
int inReviewingTaskCount = (int) entry.getValue().stream().filter(t -> t.getTaskStatus() == TaskStatus.IN_REVIEWING).count();
30-
3128
Task firstTask = entry.getValue().get(0);
29+
int inProgressTaskCount = firstTask.getProcessor().getInProgressTaskCount();
30+
int inReviewingTaskCount = firstTask.getProcessor().getInReviewingTaskCount();
31+
3232
return new TeamTaskResponse(
3333
entry.getKey(),
3434
firstTask.getProcessor().getNickname(),
@@ -65,4 +65,13 @@ private static TeamTaskItemResponse.LabelInfo toLabelInfo(Task task) {
6565
task.getLabel().getLabelColor()
6666
) : null;
6767
}
68+
69+
public static TeamStatusResponse toTeamStatusResponse(List<TeamTaskResponse> members, int totalInProgressTaskCount, int totalInReviewingTaskCount) {
70+
return new TeamStatusResponse(
71+
(members == null) ? List.of() : members,
72+
totalInProgressTaskCount,
73+
totalInReviewingTaskCount,
74+
totalInProgressTaskCount + totalInReviewingTaskCount
75+
);
76+
}
6877
}

0 commit comments

Comments
 (0)