Files
Musify/backend/Core/Musify.Domain/Entities/Track.cs
T
Admin 03f5936944 Add track coauthors with invitations, acceptance and coauthor-aware track responses
Owners invite existing users to coauthor a track; invitees accept or reject,
and either side can remove a coauthor. Only accepted coauthors appear in track
responses and in the coauthor's public track list. The owner also receives the
full invitation list with statuses on the user tracks response.
2026-09-25 02:14:23 +02:00

52 lines
1.6 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.Abstractions;
using Musify.Domain.ValueObjects;
namespace Musify.Domain.Entities
{
[Table("Tracks")]
public class Track : IAuditable, IHasLifeCycle, IOwnedEntity
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[MaxLength(200)]
public required string Title { get; set; }
[MaxLength(200)]
public required string NormalizedTitle { get; set; }
public double DurationSeconds { get; set; }
public required long OwnerUserId { get; set; }
[ForeignKey(nameof(OwnerUserId))]
public User Owner { get; set; } = null!;
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
public bool IsExplicit { get; set; }
public bool IsPublished { get; set; }
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public TrackPictures Pictures { get; set; } = new();
public TrackAudio Audio { get; set; } = new();
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>();
public ICollection<TrackTag> Tags { get; set; } = new List<TrackTag>();
public ICollection<TrackCoauthor> Coauthors { get; set; } = new List<TrackCoauthor>();
}
}