Skip to content

Commit

Permalink
[fix] 플레이리스트 영화 삭제 request dto 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
syyling committed May 29, 2024
1 parent 46e444e commit fdd90f9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public MovieInPlaylistCreateRequest(String tmdbId, Long playlistId) {
@NoArgsConstructor
public static class MovieInPlaylistDeleteRequest {

private List<Long> movieIdList;
private List<String> tmdbIdList;
private Long playlistId;

@Builder
public MovieInPlaylistDeleteRequest(List<Long> movieIdList, Long playlistId) {
this.movieIdList = movieIdList;
public MovieInPlaylistDeleteRequest(List<String> tmdbIdList, Long playlistId) {
this.tmdbIdList = tmdbIdList;
this.playlistId = playlistId;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mookive.mookive_backend.movieInPlaylist.application.service;

import com.mookive.mookive_backend.movie.domain.entity.Movie;
import com.mookive.mookive_backend.movie.domain.service.MovieQueryService;
import com.mookive.mookive_backend.movieInPlaylist.application.dto.request.MovieInPlaylistRequest;
import com.mookive.mookive_backend.movieInPlaylist.domain.service.MovieInPlaylistDeleteDomainService;
import jakarta.transaction.Transactional;
Expand All @@ -14,12 +16,14 @@
public class MovieInPlaylistDeleteService {

private final MovieInPlaylistDeleteDomainService movieInPlaylistDeleteService;
private final MovieQueryService movieQueryService;

public void deleteMovieInPlayList(MovieInPlaylistRequest.MovieInPlaylistDeleteRequest movieInPlaylistDeleteRequest) {
Long playlistId = movieInPlaylistDeleteRequest.getPlaylistId();
List<Long> movieIdList = movieInPlaylistDeleteRequest.getMovieIdList();
for(Long movieId : movieIdList) {
movieInPlaylistDeleteService.deleteByPlaylistIdAndMovieId(playlistId, movieId);
List<String> tmdbIdList = movieInPlaylistDeleteRequest.getTmdbIdList();
for(String tmdbId : tmdbIdList) {
Movie movie = movieQueryService.findByTmdbId(tmdbId);
movieInPlaylistDeleteService.deleteByPlaylistIdAndMovieId(playlistId, movie.getId());
}
}
}

0 comments on commit fdd90f9

Please sign in to comment.