Add editorconfig and analyzers, format backend code

This commit is contained in:
2026-09-24 04:54:17 +02:00
parent 87c3f97529
commit c8fe28b07b
367 changed files with 12179 additions and 12459 deletions
@@ -1,9 +1,8 @@
namespace Musify.Domain.Abstractions
{
public interface IAuditable
{
DateTime CreatedAt { get; set; }
namespace Musify.Domain.Abstractions;
DateTime UpdatedAt { get; set; }
}
public interface IAuditable
{
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
}
+27 -28
View File
@@ -3,44 +3,43 @@ using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.Abstractions;
using Musify.Domain.ValueObjects;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
public class Album : IAuditable
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
public class Album : IAuditable
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
[MaxLength(200)]
public required string Title { get; set; }
[Required]
[MaxLength(200)]
public required string Title { get; set; }
[Required]
[MaxLength(200)]
public required string NormalizedTitle { get; set; }
[Required]
[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 AlbumPictures? Pictures { get; set; }
public AlbumPictures? Pictures { get; set; }
[Required]
public required long OwnerUserId { get; set; }
[Required]
public required long OwnerUserId { get; set; }
[ForeignKey(nameof(OwnerUserId))]
public User Owner { get; set; }
[ForeignKey(nameof(OwnerUserId))]
public User Owner { get; set; }
[Required]
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
[Required]
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
[Required]
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,30 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("AlbumHasTrack")]
public class AlbumHasTrack
{
public Guid Id { get; set; } = Guid.NewGuid();
[Table("AlbumHasTrack")]
public class AlbumHasTrack
{
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required Guid AlbumId { get; set; }
[Required]
public required Guid AlbumId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public int TrackNumber { get; set; } = 1;
[Required]
public int TrackNumber { get; set; } = 1;
[Required]
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(AlbumId))]
public Album Album { get; set; }
[ForeignKey(nameof(AlbumId))]
public Album Album { get; set; }
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
@@ -1,34 +1,33 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("ListeningHistory")]
public class ListeningHistory
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Table("ListeningHistory")]
public class ListeningHistory
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long UserId { get; set; }
[Required]
public required long UserId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public DateTime ListenedAt { get; set; } = DateTime.UtcNow;
[Required]
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; }
[ForeignKey(nameof(UserId))]
public User User { get; set; }
[ForeignKey(nameof(TrackId)) ]
public Track Track { get; set; }
}
}
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
+23 -24
View File
@@ -3,37 +3,36 @@ using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.Abstractions;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("Mixes")]
public class Mix : IAuditable
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Table("Mixes")]
public class Mix : IAuditable
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long UserId { get; set; }
[Required]
public required long UserId { get; set; }
[Required]
[MaxLength(100)]
public required string Title { get; set; }
[Required]
[MaxLength(100)]
public required string Title { get; set; }
[MaxLength(256)]
public string? Subtitle { get; set; }
[MaxLength(256)]
public string? Subtitle { get; set; }
[Required]
public int Position { get; set; } = 0;
[Required]
public int Position { get; set; } = 0;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(UserId))]
public User User { get; set; }
[ForeignKey(nameof(UserId))]
public User User { get; set; }
public ICollection<MixItem> Items { get; set; } = new List<MixItem>();
}
public ICollection<MixItem> Items { get; set; } = new List<MixItem>();
}
+17 -18
View File
@@ -1,28 +1,27 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("MixItems")]
public class MixItem
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Table("MixItems")]
public class MixItem
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required Guid MixId { get; set; }
[Required]
public required Guid MixId { get; set; }
[Required]
public int Position { get; set; } = 0;
[Required]
public int Position { get; set; } = 0;
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[ForeignKey(nameof(MixId))]
public Mix Mix { get; set; }
[ForeignKey(nameof(MixId))]
public Mix Mix { get; set; }
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
+30 -31
View File
@@ -4,46 +4,45 @@ using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.Abstractions;
using Musify.Domain.ValueObjects;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("PlayLists")]
public class PlayList : IAuditable
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Table("PlayLists")]
public class PlayList : IAuditable
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long UserId { get; set; }
[Required]
public required long UserId { get; set; }
[Required]
[MaxLength(50)]
public required string Name { get; set; }
[Required]
[MaxLength(50)]
public required string Name { get; set; }
[Required]
[MaxLength(50)]
public required string NormalizedName { get; set; }
[Required]
[MaxLength(50)]
public required string NormalizedName { get; set; }
[MaxLength(256)]
public string? Description { get; set; }
[MaxLength(256)]
public string? Description { get; set; }
public PlayListPictures? Pictures { get; set; }
public PlayListPictures? Pictures { get; set; }
[Required]
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
[Required]
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
[Required]
public PlaylistVisibility Visibility { get; set; } = PlaylistVisibility.Private;
[Required]
public PlaylistVisibility Visibility { get; set; } = PlaylistVisibility.Private;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(UserId)) ]
public User User { get; set; }
[ForeignKey(nameof(UserId))]
public User User { get; set; }
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
}
}
public ICollection<PlayListHasTrack> PlayListTracks { get; set; } = new List<PlayListHasTrack>();
}
@@ -1,30 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("PlayListHasTrack")]
public class PlayListHasTrack
{
public Guid Id { get; set; } = Guid.NewGuid();
[Table("PlayListHasTrack")]
public class PlayListHasTrack
{
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required Guid PlayListId { get; set; }
[Required]
public required Guid PlayListId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public int Position { get; set; } = 0;
[Required]
public int Position { get; set; } = 0;
[Required]
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime AddedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(PlayListId)) ]
public PlayList PlayList { get; set; }
[ForeignKey(nameof(PlayListId))]
public PlayList PlayList { get; set; }
[ForeignKey(nameof(TrackId)) ]
public Track Track { get; set; }
}
}
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
+33 -34
View File
@@ -3,55 +3,54 @@ using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.Abstractions;
using Musify.Domain.ValueObjects;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
public class Track : IAuditable
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
public 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 Title { get; set; }
[Required]
[MaxLength(200)]
public required string NormalizedTitle { get; set; }
[Required]
[MaxLength(200)]
public required string NormalizedTitle { get; set; }
[Required]
public double DurationSeconds { get; set; }
[Required]
public double DurationSeconds { get; set; }
[Required]
public required long OwnerUserId { get; set; }
[Required]
public required long OwnerUserId { get; set; }
[ForeignKey(nameof(OwnerUserId))]
public required User Owner { get; set; }
[ForeignKey(nameof(OwnerUserId))]
public required User Owner { get; set; }
[Required]
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
[Required]
public LifeCycleStatus LifeCycleStatus { get; set; } = LifeCycleStatus.Active;
[Required]
public bool IsExplicit { get; set; }
[Required]
public bool IsExplicit { get; set; }
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
[Required]
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<UserHasTrack> UserTracks { get; set; } = new List<UserHasTrack>();
public ICollection<UserHasTrack> UserTracks { get; set; } = new List<UserHasTrack>();
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,28 +1,27 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("TrackLikes")]
public class TrackLike
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Table("TrackLikes")]
public class TrackLike
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long UserId { get; set; }
[Required]
public required long UserId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(UserId))]
public User User { get; set; }
[ForeignKey(nameof(UserId))]
public User User { get; set; }
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
+12 -13
View File
@@ -2,21 +2,20 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.ValueObjects;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
public class TrackTag
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
public class TrackTag
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Genre Tag { get; set; }
[Required]
public required Genre Tag { get; set; }
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
+18 -19
View File
@@ -1,29 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.ValueObjects;
namespace Musify.Domain.Entities
namespace Musify.Domain.Entities;
[Table("Upload")]
public class Upload
{
[Table("Upload")]
public class Upload
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required string Bucket { get; set; }
[Required]
public required string Bucket { get; set; }
[Required]
public required string Key { get; set; }
[Required]
public required string Key { get; set; }
[Required]
public required string ContentType { get; set; }
[Required]
public required string ContentType { get; set; }
[Required]
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
[Required]
public UploadState State { get; set; } = UploadState.Pending;
}
}
[Required]
public UploadState State { get; set; } = UploadState.Pending;
}
@@ -3,50 +3,49 @@ using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.ValueObjects;
namespace Musify.Domain.Entities
namespace Musify.Domain.Entities;
[Table("UploadIntents")]
public class UploadIntent
{
[Table("UploadIntents")]
public class UploadIntent
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long UserId { get; set; }
[Required]
public required long UserId { get; set; }
[Required, MaxLength(128)]
public required string Bucket { get; set; }
[Required, MaxLength(128)]
public required string Bucket { get; set; }
[Required, MaxLength(512)]
public required string Key { get; set; }
[Required, MaxLength(512)]
public required string Key { get; set; }
[Required, MaxLength(128)]
public required string ObjectName { get; set; }
[Required, MaxLength(128)]
public required string ObjectName { get; set; }
[Required, MaxLength(128)]
public required string ContentType { get; set; }
[Required, MaxLength(128)]
public required string ContentType { get; set; }
public long? ExpectedSizeBytes { get; set; }
public long? ExpectedSizeBytes { get; set; }
[Required]
public UploadIntentPurpose Purpose { get; set; }
[Required]
public UploadIntentPurpose Purpose { get; set; }
[Required]
public UploadIntentStatus Status { get; set; } = UploadIntentStatus.Issued;
[Required]
public UploadIntentStatus Status { get; set; } = UploadIntentStatus.Issued;
[Required]
public DateTime ExpiresAt { get; set; }
[Required]
public DateTime ExpiresAt { get; set; }
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[NotMapped]
public bool IsConsumed => Status == UploadIntentStatus.Consumed;
[NotMapped]
public bool IsConsumed => Status == UploadIntentStatus.Consumed;
[NotMapped]
public bool IsExpired => Status == UploadIntentStatus.Expired || ExpiresAt < DateTime.UtcNow;
[NotMapped]
public bool IsExpired => Status == UploadIntentStatus.Expired || ExpiresAt < DateTime.UtcNow;
[ForeignKey(nameof(UserId)) ]
public User User { get; set; } = null!;
}
[ForeignKey(nameof(UserId))]
public User User { get; set; } = null!;
}
+28 -29
View File
@@ -1,43 +1,42 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Musify.Domain.Abstractions;
namespace Musify.Domain.Entities
namespace Musify.Domain.Entities;
[Table("User")]
public class User : IAuditable
{
[Table("User")]
public class User : IAuditable
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public required long Id { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public required long Id { get; set; }
[Required]
[MaxLength(48)]
public required string Name { get; set; }
[Required]
[MaxLength(48)]
public required string Name { get; set; }
[Required]
[MaxLength(48)]
public required string NormalizedName { get; set; }
[Required]
[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; }
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
public ICollection<UserHasTrack> UserTracks { get; set; } = new List<UserHasTrack>();
public ICollection<UserHasTrack> UserTracks { get; set; } = new List<UserHasTrack>();
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,28 +1,27 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("UserFollows")]
public class UserFollow
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Table("UserFollows")]
public class UserFollow
{
[Key]
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long FollowerId { get; set; }
[Required]
public required long FollowerId { get; set; }
[Required]
public required long FollowedId { get; set; }
[Required]
public required long FollowedId { get; set; }
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[Required]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[ForeignKey(nameof(FollowerId))]
public User Follower { get; set; }
[ForeignKey(nameof(FollowerId))]
public User Follower { get; set; }
[ForeignKey(nameof(FollowedId))]
public User Followed { get; set; }
}
[ForeignKey(nameof(FollowedId))]
public User Followed { get; set; }
}
@@ -1,24 +1,23 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Musify.Domain.Entities
{
namespace Musify.Domain.Entities;
#pragma warning disable CS8618
[Table("UserHasTrack")]
public class UserHasTrack
{
public Guid Id { get; set; } = Guid.NewGuid();
[Table("UserHasTrack")]
public class UserHasTrack
{
public Guid Id { get; set; } = Guid.NewGuid();
[Required]
public required long UserId { get; set; }
[Required]
public required long UserId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[Required]
public required Guid TrackId { get; set; }
[ForeignKey(nameof(UserId)) ]
public User User { get; set; }
[ForeignKey(nameof(UserId))]
public User User { get; set; }
[ForeignKey(nameof(TrackId)) ]
public Track Track { get; set; }
}
}
[ForeignKey(nameof(TrackId))]
public Track Track { get; set; }
}
@@ -1,19 +1,18 @@
using System.ComponentModel.DataAnnotations;
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public class AlbumPictures
{
public class AlbumPictures
{
[Required]
public required string OriginalName { get; set; }
[Required]
public required string OriginalName { get; set; }
[Required]
public required string SmallName { get; set; }
[Required]
public required string SmallName { get; set; }
[Required]
public required string MediumName { get; set; }
[Required]
public required string MediumName { get; set; }
[Required]
public required string LargeName { get; set; }
}
[Required]
public required string LargeName { get; set; }
}
@@ -1,32 +1,31 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public enum Genre
{
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
}
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,48 +1,49 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public static class GenreCompatibility
{
private static readonly HashSet<(Genre, Genre)> IncompatiblePairs = BuildIncompatiblePairs();
public static class GenreCompatibility
private static HashSet<(Genre, Genre)> BuildIncompatiblePairs()
{
private static readonly HashSet<(Genre, Genre)> IncompatiblePairs = BuildIncompatiblePairs();
var pairs = new HashSet<(Genre, Genre)>();
private static HashSet<(Genre, Genre)> BuildIncompatiblePairs()
void Add(Genre a, Genre b)
{
var pairs = new HashSet<(Genre, Genre)>();
void Add(Genre a, Genre b)
{
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;
pairs.Add((a, b));
pairs.Add((b, a));
}
public static bool AreCompatible(Genre a, Genre b) =>
a == b || !IncompatiblePairs.Contains((a, b));
var intense = new[] { Genre.Metal, Genre.Punk, Genre.Dubstep, Genre.DrumAndBass };
var mellow = new[] { Genre.Classical, Genre.Ambient, Genre.Lofi };
public static IReadOnlyCollection<(Genre First, Genre Second)> FindConflicts(IEnumerable<Genre> tags)
foreach (var intenseGenre in intense)
{
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;
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++)
{
if (!AreCompatible(distinctTags[i], distinctTags[j]))
conflicts.Add((distinctTags[i], distinctTags[j]));
}
}
return conflicts;
}
}
@@ -1,9 +1,8 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public enum LifeCycleStatus
{
public enum LifeCycleStatus
{
Active = 0,
Removing = 1,
Failed = 2
}
Active = 0,
Removing = 1,
Failed = 2
}
@@ -1,19 +1,18 @@
using System.ComponentModel.DataAnnotations;
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public class PlayListPictures
{
public class PlayListPictures
{
[Required]
public required string OriginalName { get; set; }
[Required]
public required string OriginalName { get; set; }
[Required]
public required string SmallName { get; set; }
[Required]
public required string SmallName { get; set; }
[Required]
public required string MediumName { get; set; }
[Required]
public required string MediumName { get; set; }
[Required]
public required string LargeName { get; set; }
}
[Required]
public required string LargeName { get; set; }
}
@@ -1,8 +1,7 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public enum PlaylistVisibility
{
public enum PlaylistVisibility
{
Private = 0,
Public = 1
}
Private = 0,
Public = 1
}
@@ -1,10 +1,9 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public enum ProcessingStatus
{
public enum ProcessingStatus
{
Pending = 0,
Processing = 1,
Completed = 2,
Failed = 3
}
}
Pending = 0,
Processing = 1,
Completed = 2,
Failed = 3
}
@@ -1,27 +1,26 @@
using System.Diagnostics.CodeAnalysis;
namespace Musify.Domain.ValueObjects
{
namespace Musify.Domain.ValueObjects;
#pragma warning disable CS8618
public class TrackAudio
{
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;
public bool DownloadRequested { get; set; }
public bool DownloadRequested { get; set; }
public int RetryCount { get; set; }
public int RetryCount { get; set; }
public DateTime? LastRetryAt { get; set; }
public DateTime? LastRetryAt { get; set; }
[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,23 +1,22 @@
using System.Diagnostics.CodeAnalysis;
namespace Musify.Domain.ValueObjects
{
namespace Musify.Domain.ValueObjects;
#pragma warning disable CS8618
public class TrackPictures
{
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,10 +1,9 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public enum UploadIntentPurpose
{
public enum UploadIntentPurpose
{
PlayListPicture,
TrackPicture,
TrackAudio,
AlbumPicture,
}
PlayListPicture,
TrackPicture,
TrackAudio,
AlbumPicture,
}
@@ -1,9 +1,8 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public enum UploadIntentStatus
{
public enum UploadIntentStatus
{
Issued,
Consumed,
Expired,
}
Issued,
Consumed,
Expired,
}
@@ -1,9 +1,8 @@
namespace Musify.Domain.ValueObjects
namespace Musify.Domain.ValueObjects;
public enum UploadState
{
public enum UploadState
{
Pending,
Failed,
Successful,
}
}
Pending,
Failed,
Successful,
}