Skip to content
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 @@ -15,7 +15,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Tag(name = "카테고리 추가")
@Tag(name = "05. Admin")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api/managements")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Tag(name = "회원 관리 - 수정/ 삭제")
@Tag(name = "05. Admin")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api/managements/members")
public class ManageMemberController {
private final ManageMemberUsecase manageMemberUsecase;

@Operation(summary = "단일 회원 등록 API")
@Operation(summary = "회원 정보 수정 API")
@PostMapping("/{memberId}")
@Secured("ROLE_ADMIN")
public void registerMember(@AuthenticationPrincipal SecurityUserDetails userInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Tag(name = "회원 관리 - 등록")
@Tag(name = "05. Admin")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api/managements")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import static clap.server.common.utils.ClientIpParseUtil.getClientIp;

@Slf4j
@Tag(name = "로그인 / 로그아웃")
@Tag(name = "00. Auth", description = "로그인, 로그아웃, 토큰 재발급 API")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api/auths")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;

@Tag(name = "토큰 재발급")
@Tag(name = "00. Auth")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api/auths")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package clap.server.adapter.inbound.web.dto.statistics;

public record StatisticsResponse(String key, long count) {
public record StatisticsResponse(
String key,
long count) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Tag(name = "회원 정보 조회/수정")
@Tag(name = "01. Member", description = "회원 정보 조회 및 수정 API")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api/members")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Tag(name = "비밀번호 재설정")
@Tag(name = "01. Member")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "알림 관리 - 조회")
@Tag(name = "04. Notification")
@WebAdapter
@RestController
@RequestMapping("/api/notifications")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "알림 읽음 처리")
@Tag(name = "04. Notification")
@WebAdapter
@RestController
@RequestMapping("/api/notification")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
import static clap.server.exception.code.StatisticsErrorCode.STATISTICS_BAD_REQUEST;
import static io.swagger.v3.oas.annotations.enums.ParameterIn.QUERY;

@Tag(name = "작업 관련 통계")
@Tag(name = "02. Task [담당자]", description = "작업 통계 API")
@WebAdapter
@RequiredArgsConstructor
@RequestMapping("/api/tasks/statistics")
public class FindStatisticsController {
private final FindPeriodTaskRequestUsecase findPeriodTaskRequestUsecase;
private final FindPeriodTaskProcessUsecase findPeriodTaskProcessUsecase;
private final FindCategoryTaskRequestUsecase findCategoryTaskRequestUsecase;
private final FindTaskProcessUsecase findTaskProcessUsecase;
private final FindSubCategoryTaskRequestUsecase findSubCategoryTaskRequestUsecase;
private final FindManagerTaskProcessUsecase findManagerTaskProcessUsecase;


@Operation(summary = "기본 통계 API")
@Parameter(name = "periodType", description = "day, week, month", required = true, in = QUERY)
Expand All @@ -38,32 +36,13 @@ public class FindStatisticsController {
public ResponseEntity<List<StatisticsResponse>> aggregateTaskStatistics(@RequestParam PeriodType periodType, @RequestParam StatisticsType statisticsType) {
switch (statisticsType) {
case REQUEST_BY_PERIOD ->
ResponseEntity.ok(findPeriodTaskRequestUsecase
.aggregatePeriodTaskRequest(periodType.getType())
.entrySet()
.stream()
.map(result -> new StatisticsResponse(result.getKey(), result.getValue()))
.toList());
case PROCESS_BY_PERIOD ->
ResponseEntity.ok(findPeriodTaskProcessUsecase
.aggregatePeriodTaskProcess(periodType.getType())
.entrySet()
.stream()
.map(result -> new StatisticsResponse(result.getKey(), result.getValue()))
.toList());
ResponseEntity.ok(findTaskProcessUsecase.aggregatePeriodTaskRequest(periodType.getType()));
case PROCESS_BY_PERIOD -> ResponseEntity.ok(findTaskProcessUsecase
.aggregatePeriodTaskProcess(periodType.getType()));
case REQUEST_BY_CATEGORY ->
ResponseEntity.ok(findCategoryTaskRequestUsecase.aggregateCategoryTaskRequest(periodType.getType())
.entrySet()
.stream()
.map(result -> new StatisticsResponse(result.getKey(), result.getValue()))
.toList());
case PROCESS_BY_MANAGER ->
ResponseEntity.ok(findManagerTaskProcessUsecase
.aggregateManagerTaskProcess(periodType.getType())
.entrySet()
.stream()
.map(result -> new StatisticsResponse(result.getKey(), result.getValue()))
.toList());
ResponseEntity.ok(findTaskProcessUsecase.aggregateCategoryTaskRequest(periodType.getType()));
case PROCESS_BY_MANAGER -> ResponseEntity.ok(findTaskProcessUsecase
.aggregateManagerTaskProcess(periodType.getType()));
}
throw new StatisticsException(STATISTICS_BAD_REQUEST);
}
Expand All @@ -74,10 +53,6 @@ public ResponseEntity<List<StatisticsResponse>> aggregateTaskStatistics(@Request
@GetMapping("/subcategory")
public ResponseEntity<List<StatisticsResponse>> aggregateSubCategoryTaskRequest(@RequestParam PeriodType periodType, @RequestParam String mainCategory) {
return ResponseEntity.ok(findSubCategoryTaskRequestUsecase
.aggregateSubCategoryTaskRequest(periodType.getType(), mainCategory)
.entrySet()
.stream()
.map(result -> new StatisticsResponse(result.getKey(), result.getValue()))
.toList());
.aggregateSubCategoryTaskRequest(periodType.getType(), mainCategory));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.List;


@Tag(name = "작업 생성 및 수정")
@Tag(name = "02. Task", description = "작업 생성/수정 API")
@WebAdapter
@RestController
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import java.time.LocalDate;

@Tag(name = "작업 보드 조회 및 순서 변경")
@Tag(name = "02. Task [담당자]", description = " 작업 보드 API")
@WebAdapter
@RestController
@RequiredArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package clap.server.application.mapper.response;

import clap.server.adapter.inbound.web.dto.statistics.StatisticsResponse;

import java.util.List;
import java.util.Map;

public class FindTaskStatisticsMapper {
private FindTaskStatisticsMapper() {
throw new IllegalArgumentException();
}

public static List<StatisticsResponse> toStatisticsResponse(Map<String, Long> map){
return map.entrySet()
.stream()
.map(result -> new StatisticsResponse(result.getKey(), result.getValue()))
.toList();
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package clap.server.application.port.inbound.statistics;

import java.util.Map;
import clap.server.adapter.inbound.web.dto.statistics.StatisticsResponse;

import java.util.List;

public interface FindSubCategoryTaskRequestUsecase {
Map<String, Long> aggregateSubCategoryTaskRequest(String period, String mainCategory);
List<StatisticsResponse> aggregateSubCategoryTaskRequest(String period, String mainCategory);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package clap.server.application.port.inbound.statistics;

import clap.server.adapter.inbound.web.dto.statistics.StatisticsResponse;

import java.util.List;

public interface FindTaskProcessUsecase {
List<StatisticsResponse> aggregateCategoryTaskRequest(String period);
List<StatisticsResponse> aggregateManagerTaskProcess(String period);
List<StatisticsResponse> aggregatePeriodTaskProcess(String period);
List<StatisticsResponse> aggregatePeriodTaskRequest(String period);
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package clap.server.application.statistics;

import clap.server.adapter.inbound.web.dto.statistics.StatisticsResponse;
import clap.server.application.mapper.response.FindTaskStatisticsMapper;
import clap.server.application.port.inbound.statistics.FindSubCategoryTaskRequestUsecase;
import clap.server.application.port.outbound.task.TaskDocumentPort;
import clap.server.common.annotation.architecture.ApplicationService;
import lombok.RequiredArgsConstructor;

import java.util.List;
import java.util.Map;

@ApplicationService
Expand All @@ -13,7 +16,7 @@ public class FindSubCategoryTaskRequestService implements FindSubCategoryTaskReq
private final TaskDocumentPort taskDocumentPort;

@Override
public Map<String, Long> aggregateSubCategoryTaskRequest(String period, String mainCategory) {
return taskDocumentPort.findSubCategoryTaskRequestByPeriod(period, mainCategory);
public List<StatisticsResponse> aggregateSubCategoryTaskRequest(String period, String mainCategory) {
return FindTaskStatisticsMapper.toStatisticsResponse(taskDocumentPort.findSubCategoryTaskRequestByPeriod(period, mainCategory));
}
}
Loading
Loading