From 632050275395ee5fc3690c5ff169aa186ab1e6c4 Mon Sep 17 00:00:00 2001 From: Anime-Manga <> Date: Sat, 14 Oct 2023 15:39:37 +0000 Subject: [PATCH] Update from https://github.com/Anime-Manga/references/commit/bbeb5230a8087e95f64dec84b48427cfde3ad3df --- .../Cesxhin.AnimeManga.Domain/DTO/AuthDTO.cs | 4 +- .../DTO/GenericQueueDTO.cs | 34 +++++++++++++++++ .../Cesxhin.AnimeManga.Domain/Models/Auth.cs | 6 ++- .../Models/ChapterQueue.cs | 37 +++++++++++++++++++ .../Models/EpisodeQueue.cs | 36 ++++++++++++++++++ 5 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 src/references/Cesxhin.AnimeManga.Domain/DTO/GenericQueueDTO.cs create mode 100644 src/references/Cesxhin.AnimeManga.Domain/Models/ChapterQueue.cs create mode 100644 src/references/Cesxhin.AnimeManga.Domain/Models/EpisodeQueue.cs diff --git a/src/references/Cesxhin.AnimeManga.Domain/DTO/AuthDTO.cs b/src/references/Cesxhin.AnimeManga.Domain/DTO/AuthDTO.cs index 21bbb72..ecfe7ea 100644 --- a/src/references/Cesxhin.AnimeManga.Domain/DTO/AuthDTO.cs +++ b/src/references/Cesxhin.AnimeManga.Domain/DTO/AuthDTO.cs @@ -5,13 +5,15 @@ namespace Cesxhin.AnimeManga.Domain.DTO public class AuthDTO { public string Username { get; set; } + public int Role { get; set; } //convert Auth to AuthDTO public static AuthDTO AuthToAuthDTO(Auth auth) { return new AuthDTO { - Username = auth.Username + Username = auth.Username, + Role = auth.Role }; } } diff --git a/src/references/Cesxhin.AnimeManga.Domain/DTO/GenericQueueDTO.cs b/src/references/Cesxhin.AnimeManga.Domain/DTO/GenericQueueDTO.cs new file mode 100644 index 0000000..01e2e42 --- /dev/null +++ b/src/references/Cesxhin.AnimeManga.Domain/DTO/GenericQueueDTO.cs @@ -0,0 +1,34 @@ +using Cesxhin.AnimeManga.Domain.Models; +using System; + +namespace Cesxhin.AnimeManga.Domain.DTO +{ + public class GenericQueueDTO + { + public string Url { get; set; } + public string NameCfg { get; set; } + public long TimeRequest { get; set; } = ((DateTimeOffset)DateTime.UtcNow).ToUnixTimeMilliseconds(); + + //convert ChapterQueue to GenericQueueDTO + public static GenericQueueDTO ChapterQueueToGenericQueueDTO(ChapterQueue queue) + { + return new GenericQueueDTO + { + Url = queue.Url, + NameCfg = queue.NameCfg, + TimeRequest = queue.TimeRequest + }; + } + + //convert EpisodeQueue to GenericQueueDTO + public static GenericQueueDTO EpisodeQueueToGenericQueueDTO(EpisodeQueue queue) + { + return new GenericQueueDTO + { + Url = queue.Url, + NameCfg = queue.NameCfg, + TimeRequest = queue.TimeRequest + }; + } + } +} diff --git a/src/references/Cesxhin.AnimeManga.Domain/Models/Auth.cs b/src/references/Cesxhin.AnimeManga.Domain/Models/Auth.cs index 140cba4..9bb9518 100644 --- a/src/references/Cesxhin.AnimeManga.Domain/Models/Auth.cs +++ b/src/references/Cesxhin.AnimeManga.Domain/Models/Auth.cs @@ -13,12 +13,16 @@ public class Auth [Map("password")] public string Password { get; set; } + [Map("role")] + public int Role { get; set; } + //convert AuthDTO to Auth public static Auth AuthDTOToAuth(AuthDTO auth) { return new Auth { - Username = auth.Username + Username = auth.Username, + Role = auth.Role, }; } } diff --git a/src/references/Cesxhin.AnimeManga.Domain/Models/ChapterQueue.cs b/src/references/Cesxhin.AnimeManga.Domain/Models/ChapterQueue.cs new file mode 100644 index 0000000..10d58c7 --- /dev/null +++ b/src/references/Cesxhin.AnimeManga.Domain/Models/ChapterQueue.cs @@ -0,0 +1,37 @@ +using Cesxhin.AnimeManga.Domain.DTO; +using RepoDb.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cesxhin.AnimeManga.Domain.Models +{ + [Map("chapterqueue")] + public class ChapterQueue + { + [Primary] + [Map("url")] + public string Url { get; set; } + + [Primary] + [Map("namecfg")] + public string NameCfg { get; set; } + + [Map("timerequest")] + public long TimeRequest { get; set; } + + + //convert GenericQueueDTO to ChapterQueue + public static ChapterQueue GenericQueueDTOToChapterQueue(GenericQueueDTO queue) + { + return new ChapterQueue + { + Url = queue.Url, + NameCfg = queue.NameCfg, + TimeRequest = queue.TimeRequest + }; + } + } +} diff --git a/src/references/Cesxhin.AnimeManga.Domain/Models/EpisodeQueue.cs b/src/references/Cesxhin.AnimeManga.Domain/Models/EpisodeQueue.cs new file mode 100644 index 0000000..7538657 --- /dev/null +++ b/src/references/Cesxhin.AnimeManga.Domain/Models/EpisodeQueue.cs @@ -0,0 +1,36 @@ +using Cesxhin.AnimeManga.Domain.DTO; +using RepoDb.Attributes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cesxhin.AnimeManga.Domain.Models +{ + [Map("episodequeue")] + public class EpisodeQueue + { + [Primary] + [Map("url")] + public string Url { get; set; } + + [Primary] + [Map("namecfg")] + public string NameCfg { get; set; } + + [Map("timerequest")] + public long TimeRequest { get; set; } + + //convert GenericQueueDTO to EpisodeQueue + public static EpisodeQueue GenericQueueDTOToEpisodeQueue(GenericQueueDTO queue) + { + return new EpisodeQueue + { + Url = queue.Url, + NameCfg = queue.NameCfg, + TimeRequest = queue.TimeRequest + }; + } + } +}