public async Task <PlaylistDetailsDto> GetPlaylistDetails(Guid playlistId, CancellationToken ct) { var playlist = await _playlistRepository.GetByIdAsync(playlistId, ct); if (playlist == null) { return(null); } var audios = await _audioRepository.GetAudioEntriesByPlaylistAsync(playlistId, ct); var owner = await _userRepository.FindByIdAsync(playlist.OwnerId.ToString(), ct); var playlistDto = _mapper.Map <PlaylistDetailsDto>(playlist); playlistDto.AudioEntries = audios; playlistDto.OwnerUsername = owner?.UserName; return(playlistDto); }
public Task <Playlist> GetPlaylistAsync(Guid playlistId, CancellationToken ct) { return(_playlistRepository.GetByIdAsync(playlistId, ct)); }