feat(backend): expose track duration and listen count in track response

This commit is contained in:
2026-07-14 13:54:12 +02:00
parent afac7d5dd5
commit 2e866075a2
3 changed files with 13 additions and 1 deletions
+5 -1
View File
@@ -1,7 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics.CodeAnalysis;
using Musify.Domain.Abstractions;
using Musify.Domain.ValueObjects;
@@ -21,6 +20,9 @@ namespace Musify.Domain.Entities
[MaxLength(50)]
public required string NormalizedTitle { get; set; }
[Required]
public int Duration { get; set; }
[Required]
[MaxLength(64)]
public required string OriginalPictureName { get; set; }
@@ -65,6 +67,8 @@ namespace Musify.Domain.Entities
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
public ICollection<ListeningHistory> ListeningHistories { get; set; } = new List<ListeningHistory>();
[NotMapped]
[MemberNotNullWhen(true, nameof(SmallPictureName)) ]
[MemberNotNullWhen(true, nameof(MediumPictureName)) ]
+2
View File
@@ -37,5 +37,7 @@ namespace Musify.Domain.Entities
public ICollection<UserHasTrack> UserTracks { get; set; } = new List<UserHasTrack>();
public ICollection<PlayList> PlayLists { get; set; } = new List<PlayList>();
public ICollection<ListeningHistory> ListeningHistories { get; set; } = new List<ListeningHistory>();
}
}