Change editor rule
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
namespace Musify.Domain.Abstractions;
|
||||
|
||||
public interface IAuditable
|
||||
namespace Musify.Domain.Abstractions
|
||||
{
|
||||
public DateTime CreatedAt { get; set; }
|
||||
public interface IAuditable
|
||||
{
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Abstractions;
|
||||
|
||||
public interface IHasLifeCycle
|
||||
namespace Musify.Domain.Abstractions
|
||||
{
|
||||
public Guid Id { get; }
|
||||
public interface IHasLifeCycle
|
||||
{
|
||||
public Guid Id { get; }
|
||||
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; }
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
namespace Musify.Domain.Abstractions;
|
||||
|
||||
public interface IOwnedEntity
|
||||
namespace Musify.Domain.Abstractions
|
||||
{
|
||||
public long OwnerUserId { get; }
|
||||
public interface IOwnedEntity
|
||||
{
|
||||
public long OwnerUserId { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,37 +3,38 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Musify.Domain.Abstractions;
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("Albums")]
|
||||
public class Album : IAuditable, IHasLifeCycle, IOwnedEntity
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("Albums")]
|
||||
public class Album : IAuditable, IHasLifeCycle, IOwnedEntity
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[MaxLength(200)]
|
||||
public required string Title { get; set; }
|
||||
[MaxLength(200)]
|
||||
public required string Title { get; set; }
|
||||
|
||||
[MaxLength(200)]
|
||||
public required string NormalizedTitle { get; set; }
|
||||
[MaxLength(200)]
|
||||
public required string NormalizedTitle { get; set; }
|
||||
|
||||
[MaxLength(256)]
|
||||
public string? Description { get; set; }
|
||||
[MaxLength(256)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public int? ReleaseYear { get; set; }
|
||||
public int? ReleaseYear { get; set; }
|
||||
|
||||
public EntityPictures? Pictures { get; set; }
|
||||
public EntityPictures? Pictures { get; set; }
|
||||
|
||||
public required long OwnerUserId { get; set; }
|
||||
public required long OwnerUserId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(OwnerUserId))]
|
||||
public User Owner { get; set; } = null!;
|
||||
[ForeignKey(nameof(OwnerUserId))]
|
||||
public User Owner { get; set; } = null!;
|
||||
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public ICollection<AlbumHasTrack> AlbumTracks { get; set; } = new List<AlbumHasTrack>();
|
||||
public ICollection<AlbumHasTrack> AlbumTracks { get; set; } = new List<AlbumHasTrack>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("AlbumHasTrack")]
|
||||
public class AlbumHasTrack
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("AlbumHasTrack")]
|
||||
public class AlbumHasTrack
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required Guid AlbumId { get; set; }
|
||||
public required Guid AlbumId { get; set; }
|
||||
|
||||
public required Guid TrackId { get; set; }
|
||||
public required Guid TrackId { get; set; }
|
||||
|
||||
public int TrackNumber { get; set; } = 1;
|
||||
public int TrackNumber { get; set; } = 1;
|
||||
|
||||
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[ForeignKey(nameof(AlbumId))]
|
||||
public Album Album { get; set; } = null!;
|
||||
[ForeignKey(nameof(AlbumId))]
|
||||
public Album Album { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("ListeningHistory")]
|
||||
public class ListeningHistory
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("ListeningHistory")]
|
||||
public class ListeningHistory
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required long UserId { get; set; }
|
||||
public required long UserId { get; set; }
|
||||
|
||||
public required Guid TrackId { get; set; }
|
||||
public required Guid TrackId { get; set; }
|
||||
|
||||
public DateTime ListenedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime ListenedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public double? PlayedSeconds { get; set; }
|
||||
public double? PlayedSeconds { get; set; }
|
||||
|
||||
public DateTime? LastProgressAt { get; set; }
|
||||
public DateTime? LastProgressAt { get; set; }
|
||||
|
||||
public bool IsCounted { get; set; }
|
||||
public bool IsCounted { get; set; }
|
||||
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,26 +3,27 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Musify.Domain.Abstractions;
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("Mixes")]
|
||||
public class Mix : IAuditable
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("Mixes")]
|
||||
public class Mix : IAuditable
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required long UserId { get; set; }
|
||||
public required long UserId { get; set; }
|
||||
|
||||
public MixKind Kind { get; set; }
|
||||
public MixKind Kind { get; set; }
|
||||
|
||||
public int Position { get; set; }
|
||||
public int Position { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
public ICollection<MixItem> Items { get; set; } = new List<MixItem>();
|
||||
public ICollection<MixItem> Items { get; set; } = new List<MixItem>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("MixItems")]
|
||||
public class MixItem
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("MixItems")]
|
||||
public class MixItem
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required Guid MixId { get; set; }
|
||||
public required Guid MixId { get; set; }
|
||||
|
||||
public int Position { get; set; }
|
||||
public int Position { get; set; }
|
||||
|
||||
public required Guid TrackId { get; set; }
|
||||
public required Guid TrackId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(MixId))]
|
||||
public Mix Mix { get; set; } = null!;
|
||||
[ForeignKey(nameof(MixId))]
|
||||
public Mix Mix { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,38 +4,39 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Musify.Domain.Abstractions;
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("PlayLists")]
|
||||
public class PlayList : IAuditable, IHasLifeCycle, IOwnedEntity
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("PlayLists")]
|
||||
public class PlayList : IAuditable, IHasLifeCycle, IOwnedEntity
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
[Column("UserId")]
|
||||
public required long OwnerUserId { get; set; }
|
||||
[Column("UserId")]
|
||||
public required long OwnerUserId { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
[MaxLength(50)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[MaxLength(50)]
|
||||
public required string NormalizedName { get; set; }
|
||||
[MaxLength(50)]
|
||||
public required string NormalizedName { get; set; }
|
||||
|
||||
[MaxLength(256)]
|
||||
public string? Description { get; set; }
|
||||
[MaxLength(256)]
|
||||
public string? Description { get; set; }
|
||||
|
||||
public EntityPictures? Pictures { get; set; }
|
||||
public EntityPictures? Pictures { get; set; }
|
||||
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
||||
|
||||
public PlayListVisibility Visibility { get; set; } = PlayListVisibility.Private;
|
||||
public PlayListVisibility Visibility { get; set; } = PlayListVisibility.Private;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[ForeignKey(nameof(OwnerUserId))]
|
||||
public User Owner { get; set; } = null!;
|
||||
[ForeignKey(nameof(OwnerUserId))]
|
||||
public User Owner { get; set; } = null!;
|
||||
|
||||
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
|
||||
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("PlayListHasTrack")]
|
||||
public class PlayListHasTrack
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("PlayListHasTrack")]
|
||||
public class PlayListHasTrack
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required Guid PlayListId { get; set; }
|
||||
public required Guid PlayListId { get; set; }
|
||||
|
||||
public required Guid TrackId { get; set; }
|
||||
public required Guid TrackId { get; set; }
|
||||
|
||||
public int Position { get; set; }
|
||||
public int Position { get; set; }
|
||||
|
||||
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[ForeignKey(nameof(PlayListId))]
|
||||
public PlayList PlayList { get; set; } = null!;
|
||||
[ForeignKey(nameof(PlayListId))]
|
||||
public PlayList PlayList { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,44 +3,45 @@ 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
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[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 Title { get; set; }
|
||||
|
||||
[MaxLength(200)]
|
||||
public required string NormalizedTitle { get; set; }
|
||||
[MaxLength(200)]
|
||||
public required string NormalizedTitle { get; set; }
|
||||
|
||||
public double DurationSeconds { get; set; }
|
||||
public double DurationSeconds { get; set; }
|
||||
|
||||
public required long OwnerUserId { get; set; }
|
||||
public required long OwnerUserId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(OwnerUserId))]
|
||||
public User Owner { get; set; } = null!;
|
||||
[ForeignKey(nameof(OwnerUserId))]
|
||||
public User Owner { get; set; } = null!;
|
||||
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
||||
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
|
||||
|
||||
public bool IsExplicit { get; set; }
|
||||
public bool IsExplicit { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public TrackPictures Pictures { get; set; } = new();
|
||||
public TrackPictures Pictures { get; set; } = new();
|
||||
|
||||
public TrackAudio Audio { get; set; } = new();
|
||||
public TrackAudio Audio { get; set; } = new();
|
||||
|
||||
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
|
||||
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
|
||||
|
||||
public ICollection<AlbumHasTrack> AlbumTracks { get; set; } = new List<AlbumHasTrack>();
|
||||
public ICollection<AlbumHasTrack> AlbumTracks { get; set; } = new List<AlbumHasTrack>();
|
||||
|
||||
public ICollection<ListeningHistory> ListeningHistories { get; set; } = new List<ListeningHistory>();
|
||||
public ICollection<ListeningHistory> ListeningHistories { get; set; } = new List<ListeningHistory>();
|
||||
|
||||
public ICollection<TrackTag> Tags { get; set; } = new List<TrackTag>();
|
||||
public ICollection<TrackTag> Tags { get; set; } = new List<TrackTag>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("TrackLikes")]
|
||||
public class TrackLike
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("TrackLikes")]
|
||||
public class TrackLike
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required long UserId { get; set; }
|
||||
public required long UserId { get; set; }
|
||||
|
||||
public required Guid TrackId { get; set; }
|
||||
public required Guid TrackId { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,19 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("TrackTags")]
|
||||
public class TrackTag
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("TrackTags")]
|
||||
public class TrackTag
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required Guid TrackId { get; set; }
|
||||
public required Guid TrackId { get; set; }
|
||||
|
||||
public required Genre Tag { get; set; }
|
||||
public required Genre Tag { get; set; }
|
||||
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
[ForeignKey(nameof(TrackId))]
|
||||
public Track Track { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,43 +3,44 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
using Musify.Domain.ValueObjects;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("UploadIntents")]
|
||||
public class UploadIntent
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("UploadIntents")]
|
||||
public class UploadIntent
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required long UserId { get; set; }
|
||||
public required long UserId { get; set; }
|
||||
|
||||
[MaxLength(128)]
|
||||
public required string Bucket { get; set; }
|
||||
[MaxLength(128)]
|
||||
public required string Bucket { get; set; }
|
||||
|
||||
[MaxLength(512)]
|
||||
public required string Key { get; set; }
|
||||
[MaxLength(512)]
|
||||
public required string Key { get; set; }
|
||||
|
||||
[MaxLength(128)]
|
||||
public required string ObjectName { get; set; }
|
||||
[MaxLength(128)]
|
||||
public required string ObjectName { get; set; }
|
||||
|
||||
[MaxLength(128)]
|
||||
public required string ContentType { get; set; }
|
||||
[MaxLength(128)]
|
||||
public required string ContentType { get; set; }
|
||||
|
||||
public long? ExpectedSizeBytes { get; set; }
|
||||
public long? ExpectedSizeBytes { get; set; }
|
||||
|
||||
public UploadIntentPurpose Purpose { get; set; }
|
||||
public UploadIntentPurpose Purpose { get; set; }
|
||||
|
||||
public UploadIntentStatus Status { get; set; } = UploadIntentStatus.Issued;
|
||||
public UploadIntentStatus Status { get; set; } = UploadIntentStatus.Issued;
|
||||
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[NotMapped]
|
||||
public bool IsConsumed => Status == UploadIntentStatus.Consumed;
|
||||
[NotMapped]
|
||||
public bool IsConsumed => Status == UploadIntentStatus.Consumed;
|
||||
|
||||
public bool IsExpiredAt(DateTime now) => Status == UploadIntentStatus.Expired || ExpiresAt < now;
|
||||
public bool IsExpiredAt(DateTime now) => Status == UploadIntentStatus.Expired || ExpiresAt < now;
|
||||
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
[ForeignKey(nameof(UserId))]
|
||||
public User User { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,35 +2,36 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Musify.Domain.Abstractions;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("User")]
|
||||
public class User : IAuditable
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public required long Id { get; set; }
|
||||
[Table("User")]
|
||||
public class User : IAuditable
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
public required long Id { get; set; }
|
||||
|
||||
[MaxLength(48)]
|
||||
public required string Name { get; set; }
|
||||
[MaxLength(48)]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[MaxLength(48)]
|
||||
public required string NormalizedName { get; set; }
|
||||
[MaxLength(48)]
|
||||
public required string NormalizedName { get; set; }
|
||||
|
||||
[MaxLength(48)]
|
||||
public string? FirstName { get; set; }
|
||||
[MaxLength(48)]
|
||||
public string? FirstName { get; set; }
|
||||
|
||||
[MaxLength(48)]
|
||||
public string? SecondName { get; set; }
|
||||
[MaxLength(48)]
|
||||
public string? SecondName { get; set; }
|
||||
|
||||
[MaxLength(2048)]
|
||||
public string? ProfilePictureUrl { get; set; }
|
||||
[MaxLength(2048)]
|
||||
public string? ProfilePictureUrl { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
public ICollection<PlayList> PlayLists { get; set; } = new List<PlayList>();
|
||||
public ICollection<PlayList> PlayLists { get; set; } = new List<PlayList>();
|
||||
|
||||
public ICollection<ListeningHistory> ListeningHistories { get; set; } = new List<ListeningHistory>();
|
||||
public ICollection<ListeningHistory> ListeningHistories { get; set; } = new List<ListeningHistory>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Musify.Domain.Entities;
|
||||
|
||||
[Table("UserFollows")]
|
||||
public class UserFollow
|
||||
namespace Musify.Domain.Entities
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[Table("UserFollows")]
|
||||
public class UserFollow
|
||||
{
|
||||
[Key]
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public required long FollowerId { get; set; }
|
||||
public required long FollowerId { get; set; }
|
||||
|
||||
public required long FollowedId { get; set; }
|
||||
public required long FollowedId { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
[ForeignKey(nameof(FollowerId))]
|
||||
public User Follower { get; set; } = null!;
|
||||
[ForeignKey(nameof(FollowerId))]
|
||||
public User Follower { get; set; } = null!;
|
||||
|
||||
[ForeignKey(nameof(FollowedId))]
|
||||
public User Followed { get; set; } = null!;
|
||||
[ForeignKey(nameof(FollowedId))]
|
||||
public User Followed { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
/// <summary>The picture file names of an album or playlist. Resized names stay null until processing finishes.</summary>
|
||||
public class EntityPictures
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
[Required]
|
||||
public required string OriginalName { get; set; }
|
||||
/// <summary>The picture file names of an album or playlist. Resized names stay null until processing finishes.</summary>
|
||||
public class EntityPictures
|
||||
{
|
||||
[Required]
|
||||
public required string OriginalName { get; set; }
|
||||
|
||||
public string? SmallName { get; set; }
|
||||
public string? SmallName { get; set; }
|
||||
|
||||
public string? MediumName { get; set; }
|
||||
public string? MediumName { get; set; }
|
||||
|
||||
public string? LargeName { get; set; }
|
||||
public string? LargeName { get; set; }
|
||||
|
||||
public static EntityPictures Pending(string objectName) => new() { OriginalName = objectName };
|
||||
public static EntityPictures Pending(string objectName) => new() { OriginalName = objectName };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum Genre
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Pop = 0,
|
||||
Rock = 1,
|
||||
HipHop = 2,
|
||||
RnB = 3,
|
||||
Jazz = 4,
|
||||
Blues = 5,
|
||||
Classical = 6,
|
||||
Electronic = 7,
|
||||
House = 8,
|
||||
Techno = 9,
|
||||
Trance = 10,
|
||||
Dubstep = 11,
|
||||
DrumAndBass = 12,
|
||||
Metal = 13,
|
||||
Punk = 14,
|
||||
Reggae = 15,
|
||||
Reggaeton = 16,
|
||||
Country = 17,
|
||||
Folk = 18,
|
||||
Indie = 19,
|
||||
KPop = 20,
|
||||
Latin = 21,
|
||||
Soul = 22,
|
||||
Funk = 23,
|
||||
Ambient = 24,
|
||||
Lofi = 25
|
||||
public enum Genre
|
||||
{
|
||||
Pop = 0,
|
||||
Rock = 1,
|
||||
HipHop = 2,
|
||||
RnB = 3,
|
||||
Jazz = 4,
|
||||
Blues = 5,
|
||||
Classical = 6,
|
||||
Electronic = 7,
|
||||
House = 8,
|
||||
Techno = 9,
|
||||
Trance = 10,
|
||||
Dubstep = 11,
|
||||
DrumAndBass = 12,
|
||||
Metal = 13,
|
||||
Punk = 14,
|
||||
Reggae = 15,
|
||||
Reggaeton = 16,
|
||||
Country = 17,
|
||||
Folk = 18,
|
||||
Indie = 19,
|
||||
KPop = 20,
|
||||
Latin = 21,
|
||||
Soul = 22,
|
||||
Funk = 23,
|
||||
Ambient = 24,
|
||||
Lofi = 25
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,50 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
|
||||
public static class GenreCompatibility
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
private static readonly HashSet<(Genre, Genre)> IncompatiblePairs = BuildIncompatiblePairs();
|
||||
|
||||
private static HashSet<(Genre, Genre)> BuildIncompatiblePairs()
|
||||
public static class GenreCompatibility
|
||||
{
|
||||
var pairs = new HashSet<(Genre, Genre)>();
|
||||
private static readonly HashSet<(Genre, Genre)> IncompatiblePairs = BuildIncompatiblePairs();
|
||||
|
||||
void Add(Genre a, Genre b)
|
||||
private static HashSet<(Genre, Genre)> BuildIncompatiblePairs()
|
||||
{
|
||||
pairs.Add((a, b));
|
||||
pairs.Add((b, a));
|
||||
}
|
||||
var pairs = new HashSet<(Genre, Genre)>();
|
||||
|
||||
var intense = new[] { Genre.Metal, Genre.Punk, Genre.Dubstep, Genre.DrumAndBass };
|
||||
var mellow = new[] { Genre.Classical, Genre.Ambient, Genre.Lofi };
|
||||
|
||||
foreach (var intenseGenre in intense)
|
||||
{
|
||||
foreach (var mellowGenre in mellow)
|
||||
Add(intenseGenre, mellowGenre);
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
|
||||
public static bool AreCompatible(Genre a, Genre b) =>
|
||||
a == b || !IncompatiblePairs.Contains((a, b));
|
||||
|
||||
public static IReadOnlyCollection<(Genre First, Genre Second)> FindConflicts(IEnumerable<Genre> tags)
|
||||
{
|
||||
var distinctTags = tags.Distinct().ToList();
|
||||
var conflicts = new List<(Genre, Genre)>();
|
||||
|
||||
for (var i = 0; i < distinctTags.Count; i++)
|
||||
{
|
||||
for (var j = i + 1; j < distinctTags.Count; j++)
|
||||
void Add(Genre a, Genre b)
|
||||
{
|
||||
if (!AreCompatible(distinctTags[i], distinctTags[j]))
|
||||
conflicts.Add((distinctTags[i], distinctTags[j]));
|
||||
pairs.Add((a, b));
|
||||
pairs.Add((b, a));
|
||||
}
|
||||
|
||||
var intense = new[] { Genre.Metal, Genre.Punk, Genre.Dubstep, Genre.DrumAndBass };
|
||||
var mellow = new[] { Genre.Classical, Genre.Ambient, Genre.Lofi };
|
||||
|
||||
foreach (var intenseGenre in intense)
|
||||
{
|
||||
foreach (var mellowGenre in mellow)
|
||||
Add(intenseGenre, mellowGenre);
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
|
||||
return conflicts;
|
||||
public static bool AreCompatible(Genre a, Genre b) =>
|
||||
a == b || !IncompatiblePairs.Contains((a, b));
|
||||
|
||||
public static IReadOnlyCollection<(Genre First, Genre Second)> FindConflicts(IEnumerable<Genre> tags)
|
||||
{
|
||||
var distinctTags = tags.Distinct().ToList();
|
||||
var conflicts = new List<(Genre, Genre)>();
|
||||
|
||||
for (var i = 0; i < distinctTags.Count; i++)
|
||||
{
|
||||
for (var j = i + 1; j < distinctTags.Count; j++)
|
||||
{
|
||||
if (!AreCompatible(distinctTags[i], distinctTags[j]))
|
||||
conflicts.Add((distinctTags[i], distinctTags[j]));
|
||||
}
|
||||
}
|
||||
|
||||
return conflicts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum LifeCycleStatus
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Active = 0,
|
||||
Removing = 1,
|
||||
Failed = 2
|
||||
public enum LifeCycleStatus
|
||||
{
|
||||
Active = 0,
|
||||
Removing = 1,
|
||||
Failed = 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum MixKind
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Discovery = 0,
|
||||
Daily = 1
|
||||
public enum MixKind
|
||||
{
|
||||
Discovery = 0,
|
||||
Daily = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum PlayListVisibility
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Private = 0,
|
||||
Public = 1
|
||||
public enum PlayListVisibility
|
||||
{
|
||||
Private = 0,
|
||||
Public = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum ProcessingStatus
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Pending = 0,
|
||||
Processing = 1,
|
||||
Completed = 2,
|
||||
Failed = 3
|
||||
public enum ProcessingStatus
|
||||
{
|
||||
Pending = 0,
|
||||
Processing = 1,
|
||||
Completed = 2,
|
||||
Failed = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public class TrackAudio
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
public class TrackAudio
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
|
||||
public string? FolderName { get; set; }
|
||||
public string? FolderName { get; set; }
|
||||
|
||||
public ProcessingStatus TranscodeStatus { get; set; } = ProcessingStatus.Pending;
|
||||
public ProcessingStatus TranscodeStatus { get; set; } = ProcessingStatus.Pending;
|
||||
|
||||
[MemberNotNullWhen(true, nameof(FolderName))]
|
||||
public bool IsProcessed => TranscodeStatus == ProcessingStatus.Completed;
|
||||
[MemberNotNullWhen(true, nameof(FolderName))]
|
||||
public bool IsProcessed => TranscodeStatus == ProcessingStatus.Completed;
|
||||
|
||||
public bool IsFailed => TranscodeStatus == ProcessingStatus.Failed;
|
||||
public bool IsFailed => TranscodeStatus == ProcessingStatus.Failed;
|
||||
|
||||
public bool IsInProgress => TranscodeStatus is ProcessingStatus.Pending or ProcessingStatus.Processing;
|
||||
public bool IsInProgress => TranscodeStatus is ProcessingStatus.Pending or ProcessingStatus.Processing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public class TrackPictures
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
public class TrackPictures
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
|
||||
public string? SmallName { get; set; }
|
||||
public string? SmallName { get; set; }
|
||||
|
||||
public string? MediumName { get; set; }
|
||||
public string? MediumName { get; set; }
|
||||
|
||||
public string? LargeName { get; set; }
|
||||
public string? LargeName { get; set; }
|
||||
|
||||
public ProcessingStatus ProcessingStatus { get; set; } = ProcessingStatus.Pending;
|
||||
public ProcessingStatus ProcessingStatus { get; set; } = ProcessingStatus.Pending;
|
||||
|
||||
[MemberNotNullWhen(true, nameof(SmallName))]
|
||||
[MemberNotNullWhen(true, nameof(MediumName))]
|
||||
[MemberNotNullWhen(true, nameof(LargeName))]
|
||||
public bool IsProcessed => ProcessingStatus == ProcessingStatus.Completed;
|
||||
[MemberNotNullWhen(true, nameof(SmallName))]
|
||||
[MemberNotNullWhen(true, nameof(MediumName))]
|
||||
[MemberNotNullWhen(true, nameof(LargeName))]
|
||||
public bool IsProcessed => ProcessingStatus == ProcessingStatus.Completed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum UploadIntentPurpose
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
PlayListPicture,
|
||||
TrackPicture,
|
||||
TrackAudio,
|
||||
AlbumPicture,
|
||||
public enum UploadIntentPurpose
|
||||
{
|
||||
PlayListPicture,
|
||||
TrackPicture,
|
||||
TrackAudio,
|
||||
AlbumPicture,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum UploadIntentStatus
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Issued,
|
||||
Consumed,
|
||||
Expired,
|
||||
public enum UploadIntentStatus
|
||||
{
|
||||
Issued,
|
||||
Consumed,
|
||||
Expired,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user