Skip to content

Commit

Permalink
feat: 컨텐츠 전체 조회 API 헤더에 중국어, 일본어 추가 (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
leeeeeyeon authored Nov 20, 2023
1 parent 83ecef5 commit 1d890b0
Showing 1 changed file with 34 additions and 0 deletions.
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));
}
}

0 comments on commit 1d890b0

Please sign in to comment.