diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..f42a6f5 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,35 @@ +## #️⃣ Issue Number + + +## 📝 요약(Summary) + + +## 🛠️ PR 유형 +어떤 변경 사항이 있나요? + +- [ ] 새로운 기능 추가 +- [ ] 버그 수정 +- [ ] CSS 등 사용자 UI 디자인 변경 +- [ ] 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경) +- [ ] 코드 리팩토링 +- [ ] 주석 추가 및 수정 +- [ ] 문서 수정 +- [ ] 테스트 추가, 테스트 리팩토링 +- [ ] 빌드 부분 혹은 패키지 매니저 수정 +- [ ] 파일 혹은 폴더명 수정 +- [ ] 파일 혹은 폴더 삭제 + +## 📸스크린샷 (선택) + +## 💬 공유사항 to 리뷰어 + + + + + +## ✅ PR Checklist + +PR이 다음 요구 사항을 충족하는지 확인하세요. + +- [ ] 커밋 메시지 컨벤션에 맞게 작성했습니다. +- [ ] 변경 사항에 대한 테스트를 했습니다.(버그 수정/기능에 대한 테스트). diff --git a/resource-server/src/main/java/com/example/web/MBTIController.java b/resource-server/src/main/java/com/example/web/MBTIController.java index 01b597d..e1aa148 100644 --- a/resource-server/src/main/java/com/example/web/MBTIController.java +++ b/resource-server/src/main/java/com/example/web/MBTIController.java @@ -2,29 +2,46 @@ import com.example.web.recommending.usecase.MBTISongService; import com.example.web.recommending.dto.MBTISongResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; - import java.util.Map; @RestController @RequestMapping("/recommendation") public class MBTIController { - @Autowired private MBTISongService songService; + @Operation( + summary = "MBTI 유형별 노래 추천", + description = "입력된 MBTI 유형을 기반으로 10개의 노래를 랜덤으로 추천합니다." + ) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "추천 노래 목록 반환", + content = @Content(schema = @Schema(implementation = MBTISongResponse.class))), + @ApiResponse(responseCode = "400", description = "잘못된 요청", + content = @Content(schema = @Schema(example = "{\"status\": 400, \"message\": \"잘못된 요청입니다.\"}"))) + }) @GetMapping - public ResponseEntity getMBTISongs(@RequestParam(required = false) String mbti) { + public ResponseEntity getMBTISongs ( + @Parameter(description = "사용자의 MBTI 유형 (예: ISFP, ENTJ)", example = "ISTJ") + @RequestParam(required = false) String mbti){ + if (mbti == null || mbti.length() != 4) { return ResponseEntity.badRequest().body(Map.of( "status", 400, "message", "잘못된 요청입니다." )); } - MBTISongResponse response = songService.getRandomSongsByMBTI(mbti); return ResponseEntity.ok(response); } } +