feat: add album and miscellaneous controllers with album mapping
All checks were successful
Update changelog / changelog (push) Successful in 26s
All checks were successful
Update changelog / changelog (push) Successful in 26s
This commit is contained in:
27
Mapping/AlbumMapping.cs
Normal file
27
Mapping/AlbumMapping.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Shadow.DTOs;
|
||||
using Shadow.Entities;
|
||||
|
||||
namespace Shadow.Mapping;
|
||||
|
||||
public static class AlbumMapping
|
||||
{
|
||||
public static AlbumViewShortDTO ToAlbumViewShort(Album album)
|
||||
{
|
||||
AlbumViewShortDTO dto = new AlbumViewShortDTO
|
||||
{
|
||||
id = $"{album.Id}",
|
||||
name = album.Name,
|
||||
artist = album.Artist?.Name ?? "[Unknown Artist]",
|
||||
artistId = $"{album.ArtistId}",
|
||||
coverArt = "default.png",
|
||||
songCount = album.Songs.Count,
|
||||
duration = album.Songs.Sum(s => s.Duration),
|
||||
playCount = 0,
|
||||
year = 0,
|
||||
genre = "unknown",
|
||||
// played = "never"
|
||||
};
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user