feat(backend): expose the first cover track ids of playlists and albums

This commit is contained in:
2026-07-21 18:13:18 +02:00
parent 90e842d084
commit e87d379ddb
11 changed files with 125 additions and 29 deletions
@@ -93,8 +93,16 @@ namespace Musify.Application.PlayLists
return Error.Failure(description: $"Failed to update playlist {playListEntity.Id}");
}
var coverTrackIds = await database.PlayListHasTracks
.AsNoTracking()
.Where(plt => plt.PlayListId == playListEntity.Id)
.OrderBy(plt => plt.Position)
.Take(PlayListApplicationResponse.CoverTrackCount)
.Select(plt => plt.TrackId)
.ToListAsync(cancellationToken);
logger.LogInformation("Updated playlist {PlayListId}", playListEntity.Id);
return PlayListApplicationResponse.FromEntity(playListEntity);
return PlayListApplicationResponse.FromEntity(playListEntity, coverTrackIds);
}
async Task<ErrorOr<Success>> PublishUpdatePlayListPictureSourceEventAsync(