From fdd90f9b28f6065ae2980405db5774c365f299a2 Mon Sep 17 00:00:00 2001 From: syyling Date: Thu, 30 May 2024 02:23:01 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=ED=94=8C=EB=A0=88=EC=9D=B4=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EC=98=81=ED=99=94=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?request=20dto=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/MovieInPlaylistRequest.java | 6 +++--- .../service/MovieInPlaylistDeleteService.java | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/dto/request/MovieInPlaylistRequest.java b/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/dto/request/MovieInPlaylistRequest.java index f6cffe3..14e9a63 100644 --- a/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/dto/request/MovieInPlaylistRequest.java +++ b/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/dto/request/MovieInPlaylistRequest.java @@ -26,12 +26,12 @@ public MovieInPlaylistCreateRequest(String tmdbId, Long playlistId) { @NoArgsConstructor public static class MovieInPlaylistDeleteRequest { - private List movieIdList; + private List tmdbIdList; private Long playlistId; @Builder - public MovieInPlaylistDeleteRequest(List movieIdList, Long playlistId) { - this.movieIdList = movieIdList; + public MovieInPlaylistDeleteRequest(List tmdbIdList, Long playlistId) { + this.tmdbIdList = tmdbIdList; this.playlistId = playlistId; } } diff --git a/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/service/MovieInPlaylistDeleteService.java b/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/service/MovieInPlaylistDeleteService.java index b06c123..05adeff 100644 --- a/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/service/MovieInPlaylistDeleteService.java +++ b/src/main/java/com/mookive/mookive_backend/movieInPlaylist/application/service/MovieInPlaylistDeleteService.java @@ -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; @@ -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 movieIdList = movieInPlaylistDeleteRequest.getMovieIdList(); - for(Long movieId : movieIdList) { - movieInPlaylistDeleteService.deleteByPlaylistIdAndMovieId(playlistId, movieId); + List tmdbIdList = movieInPlaylistDeleteRequest.getTmdbIdList(); + for(String tmdbId : tmdbIdList) { + Movie movie = movieQueryService.findByTmdbId(tmdbId); + movieInPlaylistDeleteService.deleteByPlaylistIdAndMovieId(playlistId, movie.getId()); } } }