File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
src/main/java/com/rtu/chalkac/domain/video Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -15,4 +15,6 @@ Page<Video> findByTitleContainingIgnoreCaseOrCategoryNameContainingIgnoreCaseOrU
1515 );
1616
1717 Page <Video > findByUser (Pageable pageable , Users user );
18+
19+ boolean existsByTitle (String title );
1820}
Original file line number Diff line number Diff line change @@ -60,6 +60,10 @@ public VideoResponseDto createVideo(CreateVideoRequestDto requestDto) {
6060 Category category = categoryService .getCategory (Long .parseLong (requestDto .getCategoryId ()));
6161 Users user = usersService .getUser (requestDto .getUserId ());
6262
63+ if (videoRepository .existsByTitle (requestDto .getTitle ())) {
64+ throw new IllegalArgumentException ("Title already exists" );
65+ }
66+
6367 Video video = Video .builder ()
6468 .videoId (generateVideoId ()) // 별도의 ID 생성 로직 필요
6569 .category (category )
You can’t perform that action at this time.
0 commit comments