-
Notifications
You must be signed in to change notification settings - Fork 4
CLAP-72 feat: 팀 현황 조회 API 구현 #206
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
Merged
The head ref may contain hidden characters: "CLAP-72-\uD300-\uD604\uD669-\uC870\uD68C-API"
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/clap/server/adapter/inbound/web/dto/task/request/FilterTeamStatusRequest.java
This file contains hidden or 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,32 @@ | ||
| package clap.server.adapter.inbound.web.dto.task.request; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record FilterTeamStatusRequest( | ||
| @Schema(description = "정렬 기준 (기여도순, 기본)", example = "기여도순") | ||
| String sortBy, | ||
|
|
||
| @Schema(description = "1차 카테고리 ID 목록", example = "[10, 20, 30]") | ||
| List<Long> mainCategoryIds, | ||
|
|
||
| @Schema(description = "2차 카테고리 ID 목록", example = "[1, 2, 3]") | ||
| List<Long> categoryIds, | ||
|
|
||
| @Schema(description = "작업 타이틀 검색", example = "타이틀1") | ||
| String taskTitle | ||
| ) { | ||
| public FilterTeamStatusRequest { | ||
| sortBy = (sortBy == null || sortBy.isEmpty()) ? "기본" : sortBy; | ||
| mainCategoryIds = mainCategoryIds == null ? List.of() : mainCategoryIds; | ||
| categoryIds = categoryIds == null ? List.of() : categoryIds; | ||
| taskTitle = taskTitle == null ? "" : taskTitle; | ||
| } | ||
|
|
||
| // 카테고리 유효성 검사 | ||
| public boolean isValid() { | ||
| // 1차 카테고리가 없으면 2차 카테고리는 선택할 수 없으므로 | ||
| return mainCategoryIds.isEmpty() || !categoryIds.isEmpty(); | ||
| } | ||
| } | ||
21 changes: 21 additions & 0 deletions
21
src/main/java/clap/server/adapter/inbound/web/dto/task/response/TeamMemberTaskResponse.java
This file contains hidden or 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 clap.server.adapter.inbound.web.dto.task.response; | ||
|
|
||
| import com.querydsl.core.annotations.QueryProjection; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record TeamMemberTaskResponse( | ||
| Long processorId, | ||
| String nickname, | ||
| String imageUrl, | ||
| String department, | ||
| int inProgressTaskCount, | ||
| int pendingTaskCount, | ||
| int totalTaskCount, | ||
| List<TaskItemResponse> tasks | ||
| ) { | ||
| @QueryProjection | ||
| public TeamMemberTaskResponse { | ||
| tasks = (tasks == null) ? List.of() : tasks; | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/main/java/clap/server/adapter/inbound/web/dto/task/response/TeamStatusResponse.java
This file contains hidden or 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,11 @@ | ||
| package clap.server.adapter.inbound.web.dto.task.response; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record TeamStatusResponse( | ||
| List<TeamMemberTaskResponse> members | ||
| ) { | ||
| public TeamStatusResponse(List<TeamMemberTaskResponse> members) { | ||
| this.members = (members == null) ? List.of() : members; | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
src/main/java/clap/server/adapter/inbound/web/task/TeamStatusController.java
This file contains hidden or 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,29 @@ | ||
| package clap.server.adapter.inbound.web.task; | ||
|
|
||
| import clap.server.adapter.inbound.web.dto.task.request.FilterTeamStatusRequest; | ||
|
|
||
| import clap.server.adapter.inbound.web.dto.task.response.TeamStatusResponse; | ||
| import clap.server.application.service.task.TeamStatusService; | ||
| import clap.server.common.annotation.architecture.WebAdapter; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import jakarta.validation.Valid; | ||
| import lombok.RequiredArgsConstructor; | ||
| import org.springframework.data.domain.Pageable; | ||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.*; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/team-status") | ||
| @RequiredArgsConstructor | ||
| @Tag(name = "팀 현황 조회 API") | ||
| @WebAdapter | ||
| public class TeamStatusController { | ||
|
|
||
| private final TeamStatusService teamStatusService; | ||
|
|
||
| @GetMapping("/filter") | ||
| public ResponseEntity<TeamStatusResponse> filterTeamStatus(@Valid@ModelAttribute FilterTeamStatusRequest filter) { | ||
| TeamStatusResponse response = teamStatusService.filterTeamStatus(filter); | ||
| return ResponseEntity.ok(response); | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
10 changes: 10 additions & 0 deletions
10
src/main/java/clap/server/application/port/inbound/task/FilterTeamStatusUsecase.java
This file contains hidden or 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,10 @@ | ||
| package clap.server.application.port.inbound.task; | ||
|
|
||
|
|
||
| import clap.server.adapter.inbound.web.dto.task.request.FilterTeamStatusRequest; | ||
| import clap.server.adapter.inbound.web.dto.task.response.TeamStatusResponse; | ||
| import org.springframework.data.domain.Pageable; | ||
|
|
||
| public interface FilterTeamStatusUsecase { | ||
| TeamStatusResponse filterTeamStatus(FilterTeamStatusRequest filter); | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/clap/server/application/port/inbound/task/LoadTeamStatusUsecase.java
This file contains hidden or 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,10 @@ | ||
| package clap.server.application.port.inbound.task; | ||
|
|
||
| import clap.server.adapter.inbound.web.dto.task.request.FilterTeamStatusRequest; | ||
| import clap.server.adapter.inbound.web.dto.task.response.TeamStatusResponse; | ||
| import org.springframework.data.domain.Pageable; | ||
|
|
||
| public interface LoadTeamStatusUsecase { | ||
| TeamStatusResponse getTeamStatus(Long memberId, FilterTeamStatusRequest filter, Pageable pageable); | ||
| } | ||
|
|
This file contains hidden or 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
35 changes: 35 additions & 0 deletions
35
src/main/java/clap/server/application/service/task/TeamStatusService.java
This file contains hidden or 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,35 @@ | ||
| package clap.server.application.service.task; | ||
|
|
||
| import clap.server.adapter.inbound.web.dto.task.request.FilterTeamStatusRequest; | ||
| import clap.server.adapter.inbound.web.dto.task.response.TeamMemberTaskResponse; | ||
| import clap.server.adapter.inbound.web.dto.task.response.TeamStatusResponse; | ||
| import clap.server.application.port.inbound.task.FilterTeamStatusUsecase; | ||
| import clap.server.application.port.inbound.task.LoadTeamStatusUsecase; | ||
| import clap.server.application.port.outbound.task.LoadTaskPort; | ||
| import org.springframework.data.domain.Pageable; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Service | ||
| public class TeamStatusService implements LoadTeamStatusUsecase, FilterTeamStatusUsecase { | ||
|
|
||
| private final LoadTaskPort loadTaskPort; | ||
|
|
||
| public TeamStatusService(LoadTaskPort loadTaskPort) { | ||
| this.loadTaskPort = loadTaskPort; | ||
| } | ||
|
|
||
| @Override | ||
| public TeamStatusResponse getTeamStatus(Long memberId, FilterTeamStatusRequest filter, Pageable pageable) { | ||
| List<TeamMemberTaskResponse> members = loadTaskPort.findTeamStatus(memberId, filter); // 페이징 처리 | ||
| return new TeamStatusResponse(members); | ||
| } | ||
|
|
||
| @Override | ||
| public TeamStatusResponse filterTeamStatus(FilterTeamStatusRequest filter) { | ||
| List<TeamMemberTaskResponse> members = loadTaskPort.findTeamStatus(null, filter); | ||
| return new TeamStatusResponse(members); | ||
| } | ||
|
|
||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
객체의 형태로 직접 파싱하실 경우 java validation을 사용하시면 좋을 것 같습니다.