Skip to content

Commit

Permalink
#330 [feat] presentation 기능 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
KWY0218 committed Aug 30, 2024
1 parent 22a34f0 commit 8acc974
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
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);
}
}
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
);
}

0 comments on commit 8acc974

Please sign in to comment.