Skip to content
Merged
Show file tree
Hide file tree
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
35 changes: 35 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## #️⃣ Issue Number
<!--- ex) #이슈번호, #이슈번호 -->

## 📝 요약(Summary)
<!--- 변경 사항 및 관련 이슈에 대해 간단하게 작성해주세요. 어떻게보다 무엇을 왜 수정했는지 설명해주세요. -->

## 🛠️ PR 유형
어떤 변경 사항이 있나요?

- [ ] 새로운 기능 추가
- [ ] 버그 수정
- [ ] CSS 등 사용자 UI 디자인 변경
- [ ] 코드에 영향을 주지 않는 변경사항(오타 수정, 탭 사이즈 변경, 변수명 변경)
- [ ] 코드 리팩토링
- [ ] 주석 추가 및 수정
- [ ] 문서 수정
- [ ] 테스트 추가, 테스트 리팩토링
- [ ] 빌드 부분 혹은 패키지 매니저 수정
- [ ] 파일 혹은 폴더명 수정
- [ ] 파일 혹은 폴더 삭제

## 📸스크린샷 (선택)

## 💬 공유사항 to 리뷰어

<!--- 리뷰어가 중점적으로 봐줬으면 좋겠는 부분이 있으면 적어주세요. -->
<!--- 논의해야할 부분이 있다면 적어주세요.-->
<!--- ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요? -->

## ✅ PR Checklist

PR이 다음 요구 사항을 충족하는지 확인하세요.

- [ ] 커밋 메시지 컨벤션에 맞게 작성했습니다.
- [ ] 변경 사항에 대한 테스트를 했습니다.(버그 수정/기능에 대한 테스트).
25 changes: 21 additions & 4 deletions resource-server/src/main/java/com/example/web/MBTIController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object> getMBTISongs(@RequestParam(required = false) String mbti) {
public ResponseEntity<Object> 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);
}
}