-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/asap/server/presentation/controller/internal/MetricsController.java
This file contains 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,27 @@ | ||
package com.asap.server.presentation.controller.internal; | ||
|
||
import com.asap.server.common.exception.Success; | ||
import com.asap.server.presentation.common.dto.SuccessResponse; | ||
import com.asap.server.presentation.controller.internal.docs.MetricsControllerDocs; | ||
import com.asap.server.service.internal.MetricsService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RequestMapping("/internal") | ||
@RestController | ||
@RequiredArgsConstructor | ||
public class MetricsController implements MetricsControllerDocs { | ||
private final MetricsService metricsService; | ||
|
||
@GetMapping("/metrics") | ||
public SuccessResponse sendMetrics( | ||
@RequestParam("from") final String from, | ||
@RequestParam("to") final String to | ||
) { | ||
metricsService.sendMetrics(from.trim(), to.trim()); | ||
return SuccessResponse.success(Success.GET_METRICS_SUCCESS); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ain/java/com/asap/server/presentation/controller/internal/docs/MetricsControllerDocs.java
This file contains 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 com.asap.server.presentation.controller.internal.docs; | ||
|
||
import com.asap.server.presentation.common.dto.ErrorResponse; | ||
import com.asap.server.presentation.common.dto.SuccessResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
|
||
@Tag(name = "ASAP 내부 API", description = "ASAP 내부에서 사용하는 API입니다.") | ||
public interface MetricsControllerDocs { | ||
@Operation(summary = "[메트릭 조회] ASAP에 등록된 메트릭 정보 조회 API") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "메트릭 정보 조회 성공입니다."), | ||
@ApiResponse( | ||
responseCode = "400", | ||
description = "유효하지 않은 날짜를 입력했습니다.", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class)) | ||
), | ||
@ApiResponse(responseCode = "500", description = "서버 내부 오류", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) | ||
}) | ||
SuccessResponse sendMetrics( | ||
@Parameter(example = "2024-08-12", required = true) final String from, | ||
@Parameter(example = "2024-08-15", required = true) final String to | ||
); | ||
} |