Files
Musify/backend/Musify.Domain/Entities/AlbumHasTrack.cs
T
Admin 67805062ca feat(backend): model albums in the domain
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.
2026-07-20 20:08:21 +02:00

31 lines
750 B
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
#pragma warning disable CS8618
[Table("AlbumHasTrack")]
public class AlbumHasTrack
{
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required Guid AlbumId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public int TrackNumber { get; set; } = 1;
[Required]
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(AlbumId))]
public Album Album { get; set; }
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
}