test #248
| @@ -7,6 +7,7 @@ import kr.co.vividnext.sodalive.live.roulette.RedisIdGenerator | ||||
| import kr.co.vividnext.sodalive.member.Member | ||||
| import org.springframework.data.repository.findByIdOrNull | ||||
| import org.springframework.stereotype.Service | ||||
| import java.time.LocalDateTime | ||||
| import java.time.ZoneId | ||||
| import java.time.format.DateTimeFormatter | ||||
|  | ||||
| @@ -119,18 +120,22 @@ class AudioContentPlaylistService( | ||||
|  | ||||
|         return GetPlaylistsResponse( | ||||
|             totalCount = playlists.size, | ||||
|             items = playlists.map { | ||||
|                 val contentCount = it.contentIdAndOrderList.size | ||||
|             items = playlists.map { playlist -> | ||||
|                 val contentIdAndOrderList = playlist.contentIdAndOrderList.filter { | ||||
|                     it.endDate == null || it.endDate!! > LocalDateTime.now() | ||||
|                 } | ||||
|  | ||||
|                 val contentCount = contentIdAndOrderList.size | ||||
|                 val coverImageUrl = if (contentCount > 0) { | ||||
|                     audioContentRepository.getCoverImageById(id = it.contentIdAndOrderList[0].contentId) | ||||
|                     audioContentRepository.getCoverImageById(id = contentIdAndOrderList[0].contentId) | ||||
|                         ?: "" | ||||
|                 } else { | ||||
|                     "" | ||||
|                 } | ||||
|                 GetPlaylistsItem( | ||||
|                     id = it.id, | ||||
|                     title = it.title, | ||||
|                     desc = it.desc ?: "", | ||||
|                     id = playlist.id, | ||||
|                     title = playlist.title, | ||||
|                     desc = playlist.desc ?: "", | ||||
|                     contentCount = contentCount, | ||||
|                     coverImageUrl = coverImageUrl | ||||
|                 ) | ||||
| @@ -163,11 +168,15 @@ class AudioContentPlaylistService( | ||||
|             .withZoneSameInstant(ZoneId.of("Asia/Seoul")) | ||||
|             .format(dateTimeFormatter) | ||||
|  | ||||
|         val contentIdAndOrderList = playlist.contentIdAndOrderList.filter { | ||||
|             it.endDate == null || it.endDate!! > LocalDateTime.now() | ||||
|         } | ||||
|  | ||||
|         val contentList = audioContentRepository.fetchContentForPlaylist( | ||||
|             contentIdList = playlist.contentIdAndOrderList.map { it.contentId } | ||||
|             contentIdList = contentIdAndOrderList.map { it.contentId } | ||||
|         ) | ||||
|  | ||||
|         val orderMap = playlist.contentIdAndOrderList.sortedBy { it.order } | ||||
|         val orderMap = contentIdAndOrderList.sortedBy { it.order } | ||||
|             .mapIndexed { index, item -> item.contentId to index } | ||||
|             .toMap() | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user