Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Anime-Manga committed Oct 14, 2023
1 parent eda317e commit 6320502
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/references/Cesxhin.AnimeManga.Domain/DTO/AuthDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
}
Expand Down
34 changes: 34 additions & 0 deletions src/references/Cesxhin.AnimeManga.Domain/DTO/GenericQueueDTO.cs
Original file line number Diff line number Diff line change
@@ -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
};
}
}
}
6 changes: 5 additions & 1 deletion src/references/Cesxhin.AnimeManga.Domain/Models/Auth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
}
Expand Down
37 changes: 37 additions & 0 deletions src/references/Cesxhin.AnimeManga.Domain/Models/ChapterQueue.cs
Original file line number Diff line number Diff line change
@@ -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
};
}
}
}
36 changes: 36 additions & 0 deletions src/references/Cesxhin.AnimeManga.Domain/Models/EpisodeQueue.cs
Original file line number Diff line number Diff line change
@@ -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
};
}
}
}

0 comments on commit 6320502

Please sign in to comment.