42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using Musify.Domain.Entities;
|
|
|
|
namespace Musify.Application.Albums.Responses
|
|
{
|
|
public record AlbumApplicationResponse(
|
|
Guid Id,
|
|
string Title,
|
|
string? Description,
|
|
int? ReleaseYear,
|
|
long OwnerUserId,
|
|
int TrackCount,
|
|
string? SmallImageKeyName,
|
|
string? MediumImageKeyName,
|
|
string? LargeImageKeyName,
|
|
DateTime CreatedAt,
|
|
DateTime UpdatedAt,
|
|
IReadOnlyList<Guid> CoverTrackIds)
|
|
{
|
|
public const int CoverTrackCount = AlbumProjections.CoverTrackCount;
|
|
|
|
public static AlbumApplicationResponse FromEntity(
|
|
Album album,
|
|
int trackCount,
|
|
IReadOnlyList<Guid>? coverTrackIds = null)
|
|
{
|
|
return new AlbumApplicationResponse(
|
|
album.Id,
|
|
album.Title,
|
|
album.Description,
|
|
album.ReleaseYear,
|
|
album.OwnerUserId,
|
|
trackCount,
|
|
album.Pictures?.SmallName,
|
|
album.Pictures?.MediumName,
|
|
album.Pictures?.LargeName,
|
|
album.CreatedAt,
|
|
album.UpdatedAt,
|
|
coverTrackIds ?? []);
|
|
}
|
|
}
|
|
}
|