public async Task <List <PlaylistOverview> > GetAllByUserIdAsync(string userId) { if (string.IsNullOrWhiteSpace(userId)) { return(new List <PlaylistOverview>()); } User user = await _userRepo.GetByIdAsync(userId); List <PlaylistDefinition> definitions = await _playlistDefRepo.GetAllByUserIdAsync(user.Id); ISpotifyClient client = await _spotifyClientFactory.CreateClientAsync(user.RefreshToken); return(await definitions .ToAsyncEnumerable() .SelectAwait(async o => new { Def = o, Playlist = await client.Playlists.Get(o.TargetPlaylistId) }) .Select(o => new PlaylistOverview { Definition = o.Def, Name = o.Playlist.Name, Description = HttpUtility.HtmlDecode(o.Playlist.Description), IsGenerating = false, ErrorMessage = null }) .ToListAsync()); }
public async Task <List <PlaylistDefinition> > GetAllByUserIdAsync(string userId) { return(await _playlistDefinitionRepo.GetAllByUserIdAsync(userId)); }