-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
26 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/main/java/com/cabin/plat/domain/playlist/mapper/PlaylistMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,35 @@ | ||
package com.cabin.plat.domain.playlist.mapper; | ||
|
||
import com.cabin.plat.domain.member.entity.Member; | ||
import com.cabin.plat.domain.playlist.dto.PlaylistRequest.PlaylistUpload; | ||
import com.cabin.plat.domain.playlist.dto.PlaylistResponse; | ||
import com.cabin.plat.domain.playlist.entity.Playlist; | ||
import com.cabin.plat.domain.playlist.entity.PlaylistTrack; | ||
import com.cabin.plat.domain.track.entity.Track; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class PlaylistMapper { | ||
|
||
public Playlist toPlaylist(Member member, PlaylistUpload playlistUpload) { | ||
return Playlist.builder() | ||
.member(member) | ||
.title(playlistUpload.getTitle()) | ||
.playlistImageUrl(playlistUpload.getPlaylistImageUrl()) | ||
.build(); | ||
} | ||
|
||
public PlaylistTrack toPlaylistTrack(Playlist playlist, Track track, int orderIndex) { | ||
return PlaylistTrack.builder() | ||
.playlist(playlist) | ||
.track(track) | ||
.orderIndex(orderIndex) | ||
.build(); | ||
} | ||
|
||
public PlaylistResponse.PlayListId toPlaylistId(Long playlistId) { | ||
return PlaylistResponse.PlayListId.builder() | ||
.playlistId(playlistId) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters