Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 컨텐츠 전체 조회 API 헤더에 중국어, 일본어 추가 #284

Merged
merged 1 commit into from
Nov 20, 2023
Merged
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
34 changes: 34 additions & 0 deletions src/main/java/com/gsm/blabla/content/api/ContentControllerV2.java
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));
}
}