feat: video api - #17
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughYouTube URL 검증과 메타데이터 조회, 영상 엔티티·저장소·서비스, 프로젝트별 영상 CRUD 및 목록 API가 추가되었다. 요청 검증, 커서 기반 조회, 진행 상태 매핑, 환경변수 기반 YouTube API 키 설정도 포함된다. Changes영상 기능
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant YoutubeController
participant VideoService
participant YoutubeUrlParser
participant YoutubeApiClient
YoutubeController->>VideoService: validateYoutubeUrl(request)
VideoService->>YoutubeUrlParser: extractVideoId(youtubeUrl)
YoutubeUrlParser-->>VideoService: youtubeVideoId
VideoService->>YoutubeApiClient: getVideo(youtubeVideoId)
YoutubeApiClient-->>VideoService: YoutubeVideoInfo
VideoService-->>YoutubeController: YoutubeValidateResDTO
sequenceDiagram
participant VideoController
participant VideoService
participant VideoProjectAccessRepository
participant VideoRepository
VideoController->>VideoService: createVideo(projectId, request)
VideoService->>VideoProjectAccessRepository: findProjectById(projectId)
VideoService->>VideoRepository: save(video)
VideoRepository-->>VideoService: Video
VideoService-->>VideoController: VideoCreateResDTO
VideoController->>VideoService: getVideos(projectId, cursor, size)
VideoService->>VideoRepository: findByProjectIdAndIdLessThanOrderByIdDesc(...)
VideoRepository-->>VideoService: List<Video>
VideoService-->>VideoController: VideoListResDTO
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
🤖 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/slatto/domain/video/client/YoutubeApiClient.java`:
- Around line 28-37: Update YoutubeApiClient and its RestClient.Builder
configuration to apply explicit connection and read timeouts for YouTube
requests, then add status-specific retrieve() mappings that translate 4xx and
5xx responses into the appropriate domain exceptions instead of relying on
generic Exception handling.
In `@src/main/java/com/slatto/domain/video/controller/VideoController.java`:
- Around line 48-52: 고정된 memberId = 1L을 제거하고 중앙화된 인증 주체에서 실제 사용자 ID를 주입받도록
변경하세요. VideoController.java의 48-52행 수정, 62-66행 삭제, 77-81행 생성, 92-96행 목록 API와
YoutubeController.java의 28-32행 URL 검증 API 모두에서 해당 인증 사용자 ID를 각 서비스 호출에 전달하고, 미인증
요청은 허용하지 않도록 기존 인증 흐름을 재사용하세요.
In `@src/main/java/com/slatto/domain/video/dto/request/VideoRequest.java`:
- Around line 13-15: Update the title field in VideoRequest so null remains
valid for “no change,” while any non-null value must be non-blank, including
rejecting empty and whitespace-only strings; retain the existing 255-character
maximum and schema metadata.
In
`@src/main/java/com/slatto/domain/video/repository/VideoProjectAccessRepository.java`:
- Around line 39-43: Update VideoProjectAccessRepository.projectExistsById to
include a project.deletedAt is null predicate in the Project existence query, so
soft-deleted projects return false while active projects retain the current
behavior.
In `@src/main/java/com/slatto/domain/video/service/VideoService.java`:
- Around line 125-130: Update the video list mapping in VideoService to
eliminate the per-video bookmark query from
videoBookmarkRepository.existsByVideoIdAndUserId. Collect the page’s video IDs,
fetch the current user’s bookmarked video IDs in one batch, and map them to a
Set; use membership in that set when constructing each VideoItemResDTO via
VideoItemResDTO.from.
- Around line 84-108: Add a composite unique constraint on the video persistence
mapping for project_id and youtube_video_id, and update the save flow in
VideoService to translate any resulting constraint violation into
CommonErrorCode.CONFLICT. Keep the existing pre-check while ensuring concurrent
duplicate registrations are handled by the database constraint and mapped
consistently.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f54eaff1-418c-4bf2-899e-a0234f4ff0ce
📒 Files selected for processing (13)
src/main/java/com/slatto/domain/video/client/YoutubeApiClient.javasrc/main/java/com/slatto/domain/video/controller/VideoController.javasrc/main/java/com/slatto/domain/video/controller/YoutubeController.javasrc/main/java/com/slatto/domain/video/dto/request/VideoRequest.javasrc/main/java/com/slatto/domain/video/dto/response/VideoResponse.javasrc/main/java/com/slatto/domain/video/entity/Video.javasrc/main/java/com/slatto/domain/video/enums/VideoProgressStatus.javasrc/main/java/com/slatto/domain/video/repository/VideoBookmarkRepository.javasrc/main/java/com/slatto/domain/video/repository/VideoProjectAccessRepository.javasrc/main/java/com/slatto/domain/video/repository/VideoRepository.javasrc/main/java/com/slatto/domain/video/service/VideoService.javasrc/main/java/com/slatto/domain/video/util/YoutubeUrlParser.javasrc/main/resources/application.yml
🔗 관련 이슈 (Related Issue)
Closes #15
📝 작업 내용
영상 목록 조회 API 구현
영상 등록 API 구현
YouTube URL 검증 API 구현
영상 삭제 API 구현
영상 수정 API 구현
인증/인가 연동 임시 처리
✅ PR 체크리스트
Summary by CodeRabbit