From 1d890b003c17bf9e4085bb3d9c9618d7a6f05ea4 Mon Sep 17 00:00:00 2001 From: Jeongyeon Lee Date: Mon, 20 Nov 2023 17:04:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=BB=A8=ED=85=90=EC=B8=A0=20=EC=A0=84?= =?UTF-8?q?=EC=B2=B4=20=EC=A1=B0=ED=9A=8C=20API=20=ED=97=A4=EB=8D=94?= =?UTF-8?q?=EC=97=90=20=EC=A4=91=EA=B5=AD=EC=96=B4,=20=EC=9D=BC=EB=B3=B8?= =?UTF-8?q?=EC=96=B4=20=EC=B6=94=EA=B0=80=20(#284)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/api/ContentControllerV2.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/com/gsm/blabla/content/api/ContentControllerV2.java diff --git a/src/main/java/com/gsm/blabla/content/api/ContentControllerV2.java b/src/main/java/com/gsm/blabla/content/api/ContentControllerV2.java new file mode 100644 index 00000000..250d6388 --- /dev/null +++ b/src/main/java/com/gsm/blabla/content/api/ContentControllerV2.java @@ -0,0 +1,34 @@ +package com.gsm.blabla.content.api; + +import com.gsm.blabla.content.application.ContentService; +import com.gsm.blabla.content.dto.ContentsResponseDto; +import com.gsm.blabla.global.response.DataResponseDto; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.constraints.Pattern; +import java.util.List; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Validated +@Tag(name = "컨텐츠 관련 API") +@RestController +@RequestMapping("/api/v2/contents") +@RequiredArgsConstructor +public class ContentControllerV2 { + + private final ContentService contentService; + + @Operation(summary = "컨텐츠 전체 조회 API") + @GetMapping("") + public DataResponseDto>> getContents( + @Pattern(regexp = "^(ko|en|cn|jp)$", message = "언어는 ko 또는 en 중 하나여야 합니다.") + @RequestHeader(name="Content-Language") String language) { + return DataResponseDto.of(contentService.getContents(language)); + } +}