#region ========================================================================= USING ===================================================================================== using Lumina.Application.Core.MediaLibrary.AudioLibrary.MusicLibrary.Tracks.Commands.AddTrack; using Lumina.Contracts.Requests.MediaLibrary.AudioLibrary.MusicLibrary.Tracks; using System.Collections.Generic; using System.Linq; #endregion namespace Lumina.Application.Common.Mapping.MediaLibrary.AudioLibrary.MusicLibrary.Tracks; /// /// Extension methods for converting . /// public static class AddTrackRequestMapping { /// /// Converts to . /// /// The request to be converted. /// The Id of the library the track belongs to, taken from the route. /// The Id of the artist the track belongs to, taken from the route. /// The Id of the album the track belongs to, taken from the route. /// The converted command. public static AddTrackCommand ToCommand(this AddTrackRequest request, string? libraryId, string? artistId, string? albumId) { return new AddTrackCommand( libraryId, artistId, albumId, request.Path, request.Metadata, request.TrackNumber, request.DiscNumber, request.Script, request.Key, request.Bpm, request.Work, request.MusicBrainzRecordingId, request.MusicBrainzTrackId, request.MusicBrainzWorkId, request.Moods, request.Isrcs, request.Contributors, request.Ratings); } /// /// Converts to a collection of . /// /// The requests to be converted. /// The Id of the library the tracks belong to, taken from the route. /// The Id of the artist the tracks belong to, taken from the route. /// The Id of the album the tracks belong to, taken from the route. /// The converted commands. public static IEnumerable ToCommands(this IEnumerable requests, string? libraryId, string? artistId, string? albumId) { return requests.Select(request => request.ToCommand(libraryId, artistId, albumId)); } }