-
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.
feat: 컨텐츠 전체 조회 API 헤더에 중국어, 일본어 추가 (#284)
- Loading branch information
1 parent
83ecef5
commit 1d890b0
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/com/gsm/blabla/content/api/ContentControllerV2.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,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<Map<String, List<ContentsResponseDto>>> getContents( | ||
@Pattern(regexp = "^(ko|en|cn|jp)$", message = "언어는 ko 또는 en 중 하나여야 합니다.") | ||
@RequestHeader(name="Content-Language") String language) { | ||
return DataResponseDto.of(contentService.getContents(language)); | ||
} | ||
} |