Skip to content

feat: video api - #17

Merged
sangwon02 merged 7 commits into
developfrom
feat/15-video-api
Jul 16, 2026
Merged

feat: video api#17
sangwon02 merged 7 commits into
developfrom
feat/15-video-api

Conversation

@young0206

@young0206 young0206 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🔗 관련 이슈 (Related Issue)

Closes #15

📝 작업 내용

  • 영상 목록 조회 API 구현

    • 프로젝트에 등록된 영상 목록을 커서 기반으로 조회
  • 영상 등록 API 구현

    • YouTube URL 기반 영상 등록
  • YouTube URL 검증 API 구현

    • YouTube URL 형식 검증
    • YouTube Data API를 통한 영상 정보 조회
    • 중복 등록 여부 확인
    • 재생 가능 여부 및 썸네일/영상 길이 반환
  • 영상 삭제 API 구현

    • 프로젝트에 등록된 영상 삭제
  • 영상 수정 API 구현

    • 영상 제목, 메모 수정
    • 영상 URL은 수정 대상에서 제외
  • 인증/인가 연동 임시 처리

    • JWT 인증/인가 구현 전까지 테스트용 memberId를 임시 하드코딩
    • 추후 인증/인가 구현 완료 시 JWT에서 memberId를 추출하도록 TODO 주석 추가

✅ PR 체크리스트

  • PR 제목은 커밋 컨벤션을 따랐습니다.
  • 관련 이슈를 연결했습니다.
  • 변경 사항에 대한 테스트를 진행했습니다.

Summary by CodeRabbit

  • 새 기능
    • 유튜브 URL 검증 및 영상 메타데이터 조회 기능을 추가했습니다.
    • 프로젝트별 영상 등록, 목록 조회, 수정, 삭제 API를 제공합니다.
    • 영상 제목, 메모, 썸네일, 재생 시간, 공개 상태 및 진행 상태를 관리합니다.
    • 커서 기반 영상 목록 조회와 페이지 이동 정보를 지원합니다.
    • 유튜브 영상 중복 등록 및 접근 권한을 검증합니다.
    • 요청 값 검증과 영상 상태별 처리를 강화했습니다.

@young0206 young0206 self-assigned this Jul 16, 2026
@young0206 young0206 added the enhancement New feature or request label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d3592fb3-b467-44c4-9025-baaa5e25bf65

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

YouTube URL 검증과 메타데이터 조회, 영상 엔티티·저장소·서비스, 프로젝트별 영상 CRUD 및 목록 API가 추가되었다. 요청 검증, 커서 기반 조회, 진행 상태 매핑, 환경변수 기반 YouTube API 키 설정도 포함된다.

Changes

영상 기능

Layer / File(s) Summary
영상 도메인 및 API 계약
src/main/java/com/slatto/domain/video/entity/Video.java, src/main/java/com/slatto/domain/video/enums/VideoProgressStatus.java, src/main/java/com/slatto/domain/video/dto/...
영상 진행 상태 enum, 생성·수정 로직, 영상 요청·응답 DTO와 엔티티 매핑 팩토리가 추가되었다.
YouTube URL 및 메타데이터 연동
src/main/java/com/slatto/domain/video/util/YoutubeUrlParser.java, src/main/java/com/slatto/domain/video/client/YoutubeApiClient.java, src/main/resources/application.yml
HTTPS YouTube URL에서 ID를 추출하고, YouTube Data API 응답에서 제목·썸네일·재생 시간·공개 상태·임베드 가능 여부를 변환한다. API 키는 환경변수에서 주입된다.
영상 저장소 및 서비스 흐름
src/main/java/com/slatto/domain/video/repository/*.java, src/main/java/com/slatto/domain/video/service/VideoService.java
프로젝트 접근과 영상 중복·조회·저장·삭제·목록 조회를 위한 저장소가 추가되고, YouTube 검증, 영상 생성, 커서 기반 목록 조회, 수정, 삭제 서비스가 구현되었다.
영상 HTTP API 연결
src/main/java/com/slatto/domain/video/controller/VideoController.java, src/main/java/com/slatto/domain/video/controller/YoutubeController.java
프로젝트별 영상 CRUD 및 YouTube URL 검증 엔드포인트가 요청 검증과 ApiResponse 형식으로 노출되었다.

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
Loading
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
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive 제목이 비디오 API 추가와 관련은 있지만 너무 일반적이라 변경 내용을 충분히 드러내지 못합니다. 예: "Add video management APIs"처럼 주요 변경 사항이 드러나도록 더 구체적으로 작성하세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed 관련 이슈와 작업 내용, 체크리스트가 템플릿 구조에 맞게 포함되어 있어 대부분 충족합니다.
Linked Issues check ✅ Passed 직접 이슈 #15의 목록 조회, 등록, URL 검증, 삭제, 수정 요구사항이 변경 내용과 일치합니다.
Out of Scope Changes check ✅ Passed 추가된 유틸, 저장소, 엔티티, 설정은 모두 영상 API 구현을 지원하는 범위 안에 있습니다.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3e89749 and 2cc951d.

📒 Files selected for processing (13)
  • src/main/java/com/slatto/domain/video/client/YoutubeApiClient.java
  • src/main/java/com/slatto/domain/video/controller/VideoController.java
  • src/main/java/com/slatto/domain/video/controller/YoutubeController.java
  • src/main/java/com/slatto/domain/video/dto/request/VideoRequest.java
  • src/main/java/com/slatto/domain/video/dto/response/VideoResponse.java
  • src/main/java/com/slatto/domain/video/entity/Video.java
  • src/main/java/com/slatto/domain/video/enums/VideoProgressStatus.java
  • src/main/java/com/slatto/domain/video/repository/VideoBookmarkRepository.java
  • src/main/java/com/slatto/domain/video/repository/VideoProjectAccessRepository.java
  • src/main/java/com/slatto/domain/video/repository/VideoRepository.java
  • src/main/java/com/slatto/domain/video/service/VideoService.java
  • src/main/java/com/slatto/domain/video/util/YoutubeUrlParser.java
  • src/main/resources/application.yml

Comment thread src/main/java/com/slatto/domain/video/client/YoutubeApiClient.java Outdated
Comment thread src/main/java/com/slatto/domain/video/dto/request/VideoRequest.java
Comment thread src/main/java/com/slatto/domain/video/service/VideoService.java Outdated
Comment thread src/main/java/com/slatto/domain/video/service/VideoService.java Outdated
@sangwon02
sangwon02 merged commit 9726e69 into develop Jul 16, 2026
2 checks passed
@sangwon02 sangwon02 changed the title Feat/15 video api feat: video api Jul 16, 2026
@young0206
young0206 deleted the feat/15-video-api branch July 16, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FEAT: 동영상 목록 API 구현

2 participants