[CHANGE] Reworked entities and contexts
This commit is contained in:
13
Manager.Data/Entities/LibraryContext/CaptionEntity.cs
Normal file
13
Manager.Data/Entities/LibraryContext/CaptionEntity.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext;
|
||||
|
||||
public class CaptionEntity
|
||||
{
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string MediaId { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string Name { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? LanguageCode { get; set; }
|
||||
}
|
17
Manager.Data/Entities/LibraryContext/ChannelEntity.cs
Normal file
17
Manager.Data/Entities/LibraryContext/ChannelEntity.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext;
|
||||
|
||||
public class ChannelEntity : DateTimeBase
|
||||
{
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string Id { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? Name { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbDescriptionStringSize)]
|
||||
public string? Description { get; set; }
|
||||
public DateTime JoinedDate { get; set; }
|
||||
public long Subscribers { get; set; }
|
||||
public long TotalVideos { get; set; }
|
||||
public long TotalViews { get; set; }
|
||||
}
|
12
Manager.Data/Entities/LibraryContext/ClientAccountEntity.cs
Normal file
12
Manager.Data/Entities/LibraryContext/ClientAccountEntity.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext;
|
||||
|
||||
public class ClientAccountEntity : DateTimeBase
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string Name { get; set; } = "";
|
||||
public List<PlaylistEntity> Playlists { get; set; } = [];
|
||||
public List<HttpCookieEntity> HttpCookies { get; set; } = [];
|
||||
}
|
22
Manager.Data/Entities/LibraryContext/HttpCookieEntity.cs
Normal file
22
Manager.Data/Entities/LibraryContext/HttpCookieEntity.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext;
|
||||
|
||||
public class HttpCookieEntity : DateTimeBase
|
||||
{
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string Name { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? Value { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? Domain { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? Path { get; set; }
|
||||
public DateTimeOffset? ExpiresUtc { get; set; }
|
||||
public bool Secure { get; set; }
|
||||
public bool HttpOnly { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? SameSite { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string ClientId { get; set; }
|
||||
}
|
14
Manager.Data/Entities/LibraryContext/Join/PlaylistMedia.cs
Normal file
14
Manager.Data/Entities/LibraryContext/Join/PlaylistMedia.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext.Join;
|
||||
|
||||
public class PlaylistMedia
|
||||
{
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string PlaylistId { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string MediaId { get; set; }
|
||||
|
||||
public DateTime DateAddedUtc { get; set; }
|
||||
public DateTime DateModifiedUtc { get; set; }
|
||||
}
|
43
Manager.Data/Entities/LibraryContext/MediaEntity.cs
Normal file
43
Manager.Data/Entities/LibraryContext/MediaEntity.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Manager.Data.Entities.LibraryContext.Join;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext;
|
||||
|
||||
public class MediaEntity : DateTimeBase
|
||||
{
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string Id { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? Title { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbDescriptionStringSize)]
|
||||
public string? Description { get; set; }
|
||||
public DateTime UploadDateUtc { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string ChannelId { get; set; }
|
||||
public List<MediaFormatEntity> Formats { get; set; } = [];
|
||||
public List<CaptionEntity> Captions { get; set; } = [];
|
||||
public List<PlaylistMedia> PlaylistMedias { get; set; } = [];
|
||||
|
||||
public MediaExternalState ExternalState { get; set; } = MediaExternalState.Online;
|
||||
public bool IsDownloaded { get; set; }
|
||||
public MediaState State { get; set; } = MediaState.Indexed;
|
||||
}
|
||||
|
||||
public enum MediaExternalState
|
||||
{
|
||||
Online,
|
||||
Offline,
|
||||
Limited,
|
||||
Removed
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum MediaState
|
||||
{
|
||||
None = 0,
|
||||
Indexed = 1 << 0,
|
||||
Downloading = 1 << 1,
|
||||
Downloaded = 1 << 2,
|
||||
Remove = 1 << 3,
|
||||
Failed = 1 << 4,
|
||||
}
|
29
Manager.Data/Entities/LibraryContext/MediaFormatEntity.cs
Normal file
29
Manager.Data/Entities/LibraryContext/MediaFormatEntity.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext;
|
||||
|
||||
public class MediaFormatEntity
|
||||
{
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string MediaId { get; set; }
|
||||
public required int Itag { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? Quality { get; set; }
|
||||
public bool IsAdaptive { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? MimeType { get; set; }
|
||||
public long Bitrate { get; set; }
|
||||
public long AverageBitrate { get; set; }
|
||||
public long LastModifiedUnixEpoch { get; set; }
|
||||
public long ContentLengthBytes { get; set; }
|
||||
public long ApproxDurationMs { get; set; }
|
||||
public int? Width { get; set; }
|
||||
public int? Height { get; set; }
|
||||
public double? Framerate { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? QualityLabel { get; set; }
|
||||
public int? AudioChannels { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public string? AudioSampleRate { get; set; }
|
||||
public double? LoudnessDb { get; set; }
|
||||
}
|
17
Manager.Data/Entities/LibraryContext/PlaylistEntity.cs
Normal file
17
Manager.Data/Entities/LibraryContext/PlaylistEntity.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Manager.Data.Entities.LibraryContext.Join;
|
||||
|
||||
namespace Manager.Data.Entities.LibraryContext;
|
||||
|
||||
public class PlaylistEntity : DateTimeBase
|
||||
{
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string Id { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string Name { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbDescriptionStringSize)]
|
||||
public string? Description { get; set; }
|
||||
[MaxLength(DataConstants.DbContext.DefaultDbStringSize)]
|
||||
public required string ChannelId { get; set; }
|
||||
public List<PlaylistMedia> PlaylistMedias { get; set; } = [];
|
||||
}
|
Reference in New Issue
Block a user