Album is abstract with UserAlbum as its first table-per-type child, the same split Track already uses, so the YouTube albums can join later without moving anything. Tracks are linked through AlbumHasTrack rather than a column on the track itself: an external track is shared between users and the same song shows up in more than one album.
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using Musify.Domain.Abstractions;
|
|
using Musify.Domain.ValueObjects;
|
|
|
|
namespace Musify.Domain.Entities
|
|
{
|
|
#pragma warning disable CS8618
|
|
public abstract class Track : IAuditable
|
|
{
|
|
[Key]
|
|
public Guid Id { get; set; } = Guid.NewGuid();
|
|
|
|
[Required]
|
|
[MaxLength(200)]
|
|
public required string Title { get; set; }
|
|
|
|
[Required]
|
|
[MaxLength(200)]
|
|
public required string NormalizedTitle { get; set; }
|
|
|
|
[Required]
|
|
public int DurationSeconds { get; set; }
|
|
|
|
[Required]
|
|
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
|
|
|
[Required]
|
|
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
[Required]
|
|
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
|
|
|
public TrackPictures Pictures { get; set; } = new();
|
|
|
|
public TrackAudio Audio { get; set; } = new();
|
|
|
|
public ICollection<UserHasTrack> UserTracks { get; set; } = new List<UserHasTrack>();
|
|
|
|
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
|
|
|
|
public ICollection<AlbumHasTrack> AlbumTracks { get; set; } = new List<AlbumHasTrack>();
|
|
|
|
public ICollection<ListeningHistory> ListeningHistories { get; set; } = new List<ListeningHistory>();
|
|
}
|
|
}
|