Open
Conversation
- PlaylistEntity 내 owner 필드 주석 처리 - H2가 jsonb 타입을 몰라 DDL 생성에 실패하는 오류를 H2 URL에 PostgreSQL 모드 + JSONB 도메인 alias 추가하여 해결
생성자를 외부에서 호출하여 엔티티를 생성하지 않고 create 메서드를 통해서만 생성하도록 하여 일관성 유지
캐릭터 조회 시에 최신 버전 하나의 캐릭터만 조회하기 위해 사용
- 플레이리스트 내 추천 곡 수가 10개 이상일 때를 생성 가능 상태로 정의 - 캐릭터 생성 시 버전 값은 최신 버전 조회 후 +1한 값으로 저장 - 조회/다운로드는 최신 캐릭터 기준으로 응답(추후 이전 버전 추가) - 외부 API 연동 전이라 featureSummaryJson, promptText, imageUrl은 임시 생성 로직 적용 - 클래스 기본값 readOnly=true 트랜잭션 적용, createCharacter는 save() 쓰기 작업을 수행하므로 read-write 트랜잭션으로 override
- PLAYLIST_NOT_FOUND (404) - CHARACTER_NOT_AVAILABLE (400) - CHARACTER_NOT_FOUND (404)
- 책임을 명확화하기 위해서 Character 외부 연동 경계를 인터페이스로 분리
- CharacterService가 직접 하드코딩 로직 대신 포트 호출로 오케스트레이션하도록 변경 - 생성 흐름을 외부 연동 단계별 호출로 정리 - getAvailability에서 available 계산과 createCharacter 생성 가능 조건을 isCreatable(playlist) 공통 메서드로 리팩토링 - createCharacter 외부 연동 구간은 작업이 오래 걸릴 수 도 있으므로 NOT_SUPPORTED를 적용하여 트랜잭션 범위를 축소하고 실제 DB 저장은 TransactionTemplate 블록에서만 트랜잭션 실행
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 관련 이슈
📝 작업 내용
MusicFeatureClient
CharacterAiClient
CharacterImageEditClient
ImageStorageClient
BaseCharacterClient
🔎 고민한 내용
단일 값 wrapper DTO는 과도한 것 같아 일부는 단순 시그니처로 정리했습니다.
createCharacter에서 트랜잭션 범위를 최소화하고 가독성을 위해 저장 구간을 메서드로 분리했습니다. -> 처음 알게된 방식(TransactionTemplate)인데 어떻게 생각하시나요?
💬 기타 참고 사항
stub은 테스트를 위한 임시 구현입니다.