[FEAT] 백킹트랙 생성 및 수정 api 구현 - #51
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough백킹트랙 생성·수정 API와 요청 검증, 오류 상태, 엔티티 연관관계, 저장소 및 트랜잭션 서비스가 추가되었습니다. 학습 진행 DTO 자리표시자와 로컬 설정 무시 규칙도 함께 추가되었습니다. Changes백킹트랙 생성·수정 기능
학습 진행 DTO 기반
로컬 설정 정리
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/mr/domain/backingTrack/dto/req/BackingTrackCreateRequestDTO.java`:
- Around line 36-38: Update the timeSignature validation on
BackingTrackCreateRequestDTO to accept only supported musical time signatures:
require a positive numerator and restrict the denominator to the supported set,
rejecting values such as 0/0 and 4/3. Use the existing Pattern constraint or a
Jakarta Bean Validation custom constraint while preserving the current
required-field validation and messages.
- Around line 61-63: BackingTrackCreateRequestDTO의 chordProgression 목록에서 동일한
(measureNo, sequenceNo) 복합 키가 중복되지 않도록 저장 전에 전체 목록을 검증하세요. DTO 커스텀 검증 또는 생성 서비스의
선검사를 추가하고, 중복 발견 시 전용 400 오류 코드로 반환되게 하여 ChordProgression 저장 과정의
DataIntegrityViolationException 및 500 응답을 방지하세요.
- Around line 67-71: Update the validation annotations on measureNo and
sequenceNo in BackingTrackCreateRequestDTO to include `@Min`(1), while preserving
the existing `@NotNull` constraints and messages.
In
`@src/main/java/com/mr/domain/backingTrack/exception/BackingTrackErrorStatus.java`:
- Line 14: Update TITLE_TOO_LONG in BackingTrackErrorStatus to state that the
backing track title must be within 50 characters, matching the creation DTO and
BackingTrack.title column constraints.
In `@src/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java`:
- Line 35: Update the academyId assignment in BackingTrackService so it is not
hardcoded to 1L; resolve it from the authenticated user’s academy membership or
a permission-validated academy context and pass that value through all creation
requests, preserving authorization and ownership boundaries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 48b5b9b7-a1ed-46ce-a60b-2fe84e2a5f1b
📒 Files selected for processing (11)
src/main/java/com/mr/domain/backingTrack/controller/BackingTrackController.javasrc/main/java/com/mr/domain/backingTrack/dto/req/BackingTrackCreateRequestDTO.javasrc/main/java/com/mr/domain/backingTrack/dto/res/BackingTrackCreateResponseDTO.javasrc/main/java/com/mr/domain/backingTrack/entity/BackingTrack.javasrc/main/java/com/mr/domain/backingTrack/entity/ChordProgression.javasrc/main/java/com/mr/domain/backingTrack/exception/BackingTrackErrorStatus.javasrc/main/java/com/mr/domain/backingTrack/repository/BackingTrackRepository.javasrc/main/java/com/mr/domain/backingTrack/repository/ChordProgressionRepository.javasrc/main/java/com/mr/domain/backingTrack/service/BackingTrackService.javasrc/main/java/com/mr/domain/learning/dto/req/LearningProgressUpdateRequestDTO.javasrc/main/java/com/mr/domain/learning/dto/res/LearningProgressUpdateResponseDTO.java
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
src/main/resources/application.yml (2)
27-29: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winJWT 키의 Base64 형식 안내를 두 설정 파일에서 통일하세요.
application.example.yml은Decoders.BASE64.decode사용을 전제로 하지만, 이 파일의 예시는 일반 문자열처럼 보이며 하이픈도 포함합니다. 사용자가 이 값을 그대로 복사하면 JWT 초기화가 실패할 수 있으므로 Base64 예시와 동일한 안내를 사용하세요.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/resources/application.yml` around lines 27 - 29, Update the JWT secret guidance and example value in application.yml to match application.example.yml: document that the secret must be Base64-encoded for Decoders.BASE64.decode and use a valid Base64 example without hyphens. Keep the HS256 requirement and minimum 256-bit key strength clear.
17-23: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win로컬 설정 파일이 운영 프로필과 충돌하지 않도록 프로필 적용 범위를 명확히 해주세요.
application.yml은 Spring Boot에서 기본 프로필로 로드되는 파일이라, 개발자가 이를 local/profile과 구분 없이 사용하거나 실행에서 dev/prod 프로필이 적용되지 않으면application-dev.yml/application-prod.yml의 설정이 무시될 수 있습니다. 기본 파일은 공통 설정만 남기고, JDBC 비밀번호·jwt secret·ddl-auto: update·localhostOAuth redirect 같은 로컬 전용 설정은application-local.yml처럼 별도 프로필로 이동해 보세요. 운영값은 계속application-prod.yml에서validate·수변 OAuth 설정으로 유지하면 좋습니다. Spring Profiles 문서: https://docs.spring.io/spring-boot/reference/features/profiles.html🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/resources/application.yml` around lines 17 - 23, Restrict application.yml to shared, profile-independent settings and move local-only values—JDBC credentials, JWT secret, hibernate.ddl-auto: update, and localhost OAuth redirects—into an explicitly activated application-local.yml profile. Ensure dev and prod settings remain in their respective profile files, with production retaining validate and production OAuth configuration, and verify startup selects the intended profile so profile-specific settings are not bypassed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/resources/application.yml`:
- Around line 1-6: Move the Korean example-file setup notice from
application.yml to application.example.yml, including the instruction to rename
the file. Replace the notice in application.yml with only a concise explanation
that it contains local-only settings, keeping the example and active
configuration roles separate.
- Line 13: Remove the plaintext PostgreSQL password at
src/main/resources/application.yml:13-13 and reference an environment variable
instead, then rotate the exposed database credential. At
src/main/resources/application.yml:29-29, replace the JWT signing key with an
environment variable and rotate the key, invalidating tokens issued with the old
key. At .gitignore:67-68, verify whether application.yml is tracked and remove
it from the Git index if necessary; ensure exposed credentials are removed from
history where applicable.
- Around line 33-42: AiServerProperties가 요구하는 ai.internal 설정을 application.yml에
복구하고, aiAnalysisRequest()와 baseUri()가 참조하는 값과 일치하도록 구성하세요. 외부 호출이 개발/러닝용 프로필에서만
필요하다면 해당 프로필 설정으로 분리하되 애플리케이션 시작 시 필수 속성이 누락되지 않게 하세요.
---
Nitpick comments:
In `@src/main/resources/application.yml`:
- Around line 27-29: Update the JWT secret guidance and example value in
application.yml to match application.example.yml: document that the secret must
be Base64-encoded for Decoders.BASE64.decode and use a valid Base64 example
without hyphens. Keep the HS256 requirement and minimum 256-bit key strength
clear.
- Around line 17-23: Restrict application.yml to shared, profile-independent
settings and move local-only values—JDBC credentials, JWT secret,
hibernate.ddl-auto: update, and localhost OAuth redirects—into an explicitly
activated application-local.yml profile. Ensure dev and prod settings remain in
their respective profile files, with production retaining validate and
production OAuth configuration, and verify startup selects the intended profile
so profile-specific settings are not bypassed.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: cc582b78-12bf-49b3-abb7-f40c5eafe3b4
📒 Files selected for processing (6)
.gitignoresrc/main/java/com/mr/domain/backingTrack/dto/req/BackingTrackCreateRequestDTO.javasrc/main/java/com/mr/domain/backingTrack/exception/BackingTrackErrorStatus.javasrc/main/java/com/mr/domain/backingTrack/service/BackingTrackService.javasrc/main/resources/application.example.ymlsrc/main/resources/application.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/mr/domain/backingTrack/exception/BackingTrackErrorStatus.java
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java`:
- Around line 123-126: Update the SaveResultDTO construction in
BackingTrackService to pass the backing track’s creation timestamp via
getCreatedAt() instead of getUpdatedAt(), preserving the DTO’s createdAt
response contract.
- Around line 97-110: Update the backing-track modification flow around
BackingTrackService and updateTrackInfo to persist both request.audioFileUrl()
and the already-created midiNode. Pass both values into the entity update method
and ensure updateTrackInfo assigns them along with the existing track fields, so
edited audio and MIDI data replace the stored values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 53cf8fd4-6dbb-453d-b090-e8362ec4c3c9
📒 Files selected for processing (5)
src/main/java/com/mr/domain/backingTrack/controller/BackingTrackController.javasrc/main/java/com/mr/domain/backingTrack/dto/req/BackingTrackSaveRequestDTO.javasrc/main/java/com/mr/domain/backingTrack/dto/res/BackingTrackSaveResponseDTO.javasrc/main/java/com/mr/domain/backingTrack/exception/BackingTrackErrorStatus.javasrc/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/mr/domain/backingTrack/exception/BackingTrackErrorStatus.java
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java (1)
83-90: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win백킹트랙 조회·권한 검증을 중복 검사보다 먼저 수행하세요.
현재는
chordProgression중복 여부를 먼저 검사하므로, 존재하지 않거나 권한이 없는 백킹트랙에 중복 요청을 보내면BACKING_TRACK_NOT_FOUND또는FORBIDDEN_UPDATE대신DUPLICATE_CHORD_POSITION이 반환됩니다.findById→ 작성자 검증 → 요청별 중복 검사 순서로 변경해 예외 계약을 일관되게 유지하세요.수정 예시
- validateChordDuplicates(request.chordProgression()); - BackingTrack backingTrack = backingTrackRepository.findById(backingTrackId) .orElseThrow(() -> new GeneralException(BackingTrackErrorStatus.BACKING_TRACK_NOT_FOUND)); if (!backingTrack.getUser().getUserId().equals(userId)) { throw new GeneralException(BackingTrackErrorStatus.FORBIDDEN_UPDATE); } + validateChordDuplicates(request.chordProgression());🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java` around lines 83 - 90, Update the backing-track update flow in BackingTrackService so findById and the backingTrack owner check occur before validateChordDuplicates(request.chordProgression()). Preserve the existing not-found and forbidden exceptions, then run the request-specific duplicate validation only after authorization succeeds.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java`:
- Around line 83-90: Update the backing-track update flow in BackingTrackService
so findById and the backingTrack owner check occur before
validateChordDuplicates(request.chordProgression()). Preserve the existing
not-found and forbidden exceptions, then run the request-specific duplicate
validation only after authorization succeeds.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e48ab362-0c6d-4ae0-9edc-b9d6515e2363
📒 Files selected for processing (4)
.gitignoresrc/main/java/com/mr/domain/backingTrack/dto/req/BackingTrackSaveRequestDTO.javasrc/main/java/com/mr/domain/backingTrack/entity/BackingTrack.javasrc/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java
💤 Files with no reviewable changes (1)
- src/main/java/com/mr/domain/backingTrack/dto/req/BackingTrackSaveRequestDTO.java
🚧 Files skipped from review as they are similar to previous changes (2)
- .gitignore
- src/main/java/com/mr/domain/backingTrack/entity/BackingTrack.java
on1yoneprivate
left a comment
There was a problem hiding this comment.
수고 많으셨어요~
추가로 생성/수정 API가 로컬 환경에서 정상적으로 동작하는지도 한 번 테스트해 주시면 좋을 것 같습니다!
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java`:
- Around line 57-65: ChordProgression 객체가 컬렉션에 중복 추가되지 않도록 BackingTrackService의
두 코드 진행 생성 흐름에서 backingTrack.addChordProgression(chord) 호출을 제거하세요. 적용 위치는
src/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java의
57-65행과 110-118행이며, ChordProgression.create(...)가 연관관계 추가를 계속 담당하도록 유지하세요.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a370670a-1a48-4922-821a-29abff9222d0
📒 Files selected for processing (5)
src/main/java/com/mr/domain/backingTrack/controller/BackingTrackController.javasrc/main/java/com/mr/domain/backingTrack/dto/res/BackingTrackCreateResponseDTO.javasrc/main/java/com/mr/domain/backingTrack/dto/res/BackingTrackUpdateResponseDTO.javasrc/main/java/com/mr/domain/backingTrack/repository/BackingTrackRepository.javasrc/main/java/com/mr/domain/backingTrack/service/BackingTrackService.java
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/mr/domain/backingTrack/repository/BackingTrackRepository.java
p1001q
left a comment
There was a problem hiding this comment.
꼭 수정해야만 하는 오류는 아닌 것 같아 승인 남겨드립니다! 고생하셨어요!
|
로컬에서 테스트도 완료했습니다! |
📍 개요
⛓️💥 관련 이슈
🛠️ 작업 내용
🔥 리뷰 요청 사항
✅ 체크리스트
📎 참고 사항
Summary by CodeRabbit
새 기능
버그 수정