diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
new file mode 100644
index 0000000..37f01a9
--- /dev/null
+++ b/.github/workflows/unit-test.yml
@@ -0,0 +1,29 @@
+name: On Pull Request Opened
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ defaults:
+ run:
+ working-directory: ./src
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+
+ - name: Install packages
+ run: npm i
+
+ - name: Check syntax code
+ run: npm run eslint
+
+ - name: Check typescript
+ run: npm run typecheck
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 8bfb316..0d35a1f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -405,3 +405,9 @@ Properties
schemas.json
Cesxhin.AnimeManga.Api.csproj
+
+
+# node
+node_modules
+package-lock.json
+.env
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..d0a8a20
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "references"]
+ path = references
+ url = https://github.com/Anime-Manga/references.git
+ branch = refactory
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..0a67b54
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,15 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "node-terminal",
+ "request": "launch",
+ "name": "Start",
+ "cwd": "${workspaceFolder}/src_refactory",
+ "command": "npm run start"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/Cesxhin.AnimeManga.Api/Cesxhin.AnimeManga.Api.csproj b/src/Cesxhin.AnimeManga.Api/Cesxhin.AnimeManga.Api.csproj
deleted file mode 100644
index 0e1104a..0000000
--- a/src/Cesxhin.AnimeManga.Api/Cesxhin.AnimeManga.Api.csproj
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
- net5.0
- f1d2050b-ac80-4560-808c-e1e1bb2c67ea
- Linux
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Always
-
-
-
-
-
-
diff --git a/src/Cesxhin.AnimeManga.Api/Controllers/AccountController.cs b/src/Cesxhin.AnimeManga.Api/Controllers/AccountController.cs
deleted file mode 100644
index d95aa4c..0000000
--- a/src/Cesxhin.AnimeManga.Api/Controllers/AccountController.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-using Cesxhin.AnimeManga.Modules.Exceptions;
-using Cesxhin.AnimeManga.Application.Interfaces.Services;
-using Cesxhin.AnimeManga.Domain.DTO;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using System;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Api.Controllers
-{
- [Route("api/[controller]")]
- [ApiController]
- public class AccountController : ControllerBase
- {
- private readonly IAccountService _accountService;
- public AccountController(IAccountService accountService)
- {
- _accountService = accountService;
- }
-
- //login
- [HttpPost("/auth/login")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(AuthDTO))]
- [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task Login(AuthLoginDTO auth)
- {
- try
- {
- if (string.IsNullOrEmpty(auth.Username) || string.IsNullOrEmpty(auth.Password))
- return BadRequest();
-
- var user = await _accountService.Login(auth.Username, auth.Password);
- return Ok(user);
- }
- catch (ApiNotAuthorizeException)
- {
- return Unauthorized();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //register
- [HttpPost("/auth/register")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(AuthDTO))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task Register(AuthLoginDTO auth)
- {
- try
- {
- if (string.IsNullOrEmpty(auth.Username) || string.IsNullOrEmpty(auth.Password))
- return BadRequest();
-
- var user = await _accountService.CreateAccount(auth.Username, auth.Password);
- return Ok(user);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //add whiteList
- [HttpPost("/auth/watchlist")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WatchListDTO))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task AddWatchList(WatchListDTO whiteListDTO)
- {
- try
- {
- var rs = await _accountService.InsertWatchList(whiteListDTO);
- return Ok(rs);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //delete whiteList
- [HttpDelete("/auth/watchlist")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(WatchListDTO))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task DeleteWatchList(WatchListDTO whiteListDTO)
- {
- try
- {
- var rs = await _accountService.DeleteWatchList(whiteListDTO);
- if (rs != null)
- return Ok(rs);
-
- return Conflict();
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Api/Controllers/BookController.cs b/src/Cesxhin.AnimeManga.Api/Controllers/BookController.cs
deleted file mode 100644
index 98dbcd5..0000000
--- a/src/Cesxhin.AnimeManga.Api/Controllers/BookController.cs
+++ /dev/null
@@ -1,1044 +0,0 @@
-using Cesxhin.AnimeManga.Application.Interfaces.Controllers;
-using Cesxhin.AnimeManga.Application.Interfaces.Services;
-using Cesxhin.AnimeManga.Modules.NlogManager;
-using Cesxhin.AnimeManga.Modules.HtmlAgilityPack;
-using Cesxhin.AnimeManga.Modules.Exceptions;
-using Cesxhin.AnimeManga.Domain.DTO;
-using MassTransit;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Newtonsoft.Json.Linq;
-using NLog;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Api.Controllers
-{
- [Route("api")]
- [ApiController]
- public class BookController : ControllerBase, IGeneralControllerBase
- {
- //interfaces
- private readonly IDescriptionBookService _bookService;
- private readonly IChapterService _chapterService;
- private readonly IChapterRegisterService _chapterRegisterService;
- private readonly IProgressChapterService _progressChapterService;
- private readonly IChapterQueueService _chapterQueueService;
- private readonly IAccountService _accountService;
- private readonly IChapterBlackListService _chapterBlackListService;
- private readonly IBus _publishEndpoint;
-
- //log
- private readonly NLogConsole _logger = new(LogManager.GetCurrentClassLogger());
-
- //env
- private readonly string _folder = Environment.GetEnvironmentVariable("BASE_PATH") ?? "/";
- private readonly JObject _schema = JObject.Parse(Environment.GetEnvironmentVariable("SCHEMA"));
-
- public BookController(
- IDescriptionBookService bookService,
- IChapterService chapterService,
- IChapterRegisterService chapterRegisterService,
- IProgressChapterService progressChapterService,
- IChapterQueueService chapterQueueService,
- IAccountService accountService,
- IChapterBlackListService chapterBlackListService,
- IBus publishEndpoint
- )
- {
- _publishEndpoint = publishEndpoint;
- _bookService = bookService;
- _chapterService = chapterService;
- _chapterRegisterService = chapterRegisterService;
- _progressChapterService = progressChapterService;
- _chapterQueueService = chapterQueueService;
- _accountService = accountService;
- _chapterBlackListService = chapterBlackListService;
- }
-
- //get list all manga without filter
- [HttpGet("/book")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetInfoAll(string nameCfg, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var listManga = await _bookService.GetNameAllAsync(nameCfg, username);
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(listManga));
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get manga by name
- [HttpGet("/book/name/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetInfoByName(string nameCfg, string name, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var anime = await _bookService.GetNameByNameAsync(nameCfg, name, username);
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(anime));
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get list manga by start name similar
- [HttpGet("/book/names/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetMostInfoByName(string nameCfg, string name, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var searchSchema = _schema.GetValue(nameCfg).ToObject().GetValue("search").ToObject();
- var bookUrls = RipperBookGeneric.GetBookUrl(searchSchema, name);
-
- //list anime
- List listManga = new();
-
- foreach (var book in bookUrls)
- {
- var bookDTO = GenericUrlDTO.GenericUrlToGenericUrlDTO(book);
-
- var checkManga = await _bookService.GetNameByNameAsync(nameCfg, book.Name, username);
- if (checkManga != null)
- bookDTO.Exists = true;
-
- listManga.Add(bookDTO);
- }
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(listManga));
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get all db manga
- [HttpGet("/book/all")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetAll(string nameCfg, string username)
- {
- try
- {
- if (nameCfg != null && _schema.ContainsKey(nameCfg))
- {
- var listManga = await _bookService.GetNameAllWithAllAsync(nameCfg, username);
- return Ok(listManga);
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get chapter by name anime
- [HttpGet("/chapter/name/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectByName(string name)
- {
- try
- {
- var listChapters = await _chapterService.GetObjectsByNameAsync(name);
- return Ok(listChapters);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get chapter by id
- [HttpGet("/chapter/id/{id}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ChapterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectById(string id)
- {
- try
- {
- var chapter = await _chapterService.GetObjectByIDAsync(id);
- return Ok(chapter);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get chapterRegister by id
- [HttpGet("/chapter/register/chapterid/{id}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ChapterRegisterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectRegisterByObjectId(string id)
- {
- try
- {
- var chapterRegister = await _chapterRegisterService.GetObjectRegisterByObjectId(id);
- return Ok(chapterRegister);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get list name by external db
- [HttpGet("/book/list/name/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetListSearchByName(string nameCfg, string name)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var searchSchema = _schema.GetValue(nameCfg).ToObject().GetValue("search").ToObject();
- var bookUrls = RipperBookGeneric.GetBookUrl(searchSchema, name);
-
- List listBlackList = new();
- try
- {
- listBlackList = await _chapterBlackListService.GetObjectsBlackList();
- }
- catch (ApiNotFoundException) { }
-
- if (listBlackList.Any())
- {
- bookUrls = bookUrls.Where(book =>
- listBlackList.Where(blackList =>
- book.Name == blackList.Name &&
- book.Url == blackList.Url &&
- nameCfg == blackList.NameCfg
- ).ToList().Count == 0
- ).ToList();
- }
-
- //list manga
- List list = new();
-
- foreach (var bookUrl in bookUrls)
- {
- var bookUrlDTO = GenericUrlDTO.GenericUrlToGenericUrlDTO(bookUrl);
-
- //check if already exists
- try
- {
- await _chapterService.GetObjectsByNameAsync(bookUrlDTO.Name);
- bookUrlDTO.Exists = true;
- }
- catch (ApiNotFoundException) { }
-
- list.Add(bookUrlDTO);
- }
- return Ok(list);
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert manga
- [HttpPost("/book")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutInfo(string nameCfg, string infoClass)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- //insert
- var mangaResult = await _bookService.InsertNameAsync(nameCfg, JObject.Parse(infoClass));
- return Created("none", Newtonsoft.Json.JsonConvert.SerializeObject(mangaResult));
- }
- else
- return BadRequest();
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //update manga
- [HttpPut("/book")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task UpdateInfo([FromBody] string content)
- {
- try
- {
- var description = JObject.Parse(content);
- string nameCfg = (string)description["nameCfg"];
-
- if (_schema.ContainsKey(nameCfg))
- {
- //update
- var mangaResult = await _bookService.UpdateNameAsync(nameCfg, description);
- return Created("none", Newtonsoft.Json.JsonConvert.SerializeObject(mangaResult));
- }
- else
- return BadRequest();
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert chapter
- [HttpPost("/chapter")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(ChapterDTO))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObject(ChapterDTO objectClass)
- {
- try
- {
- //insert
- var chapterResult = await _chapterService.InsertObjectAsync(objectClass);
- return Created("none", chapterResult);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert list chapters
- [HttpPost("/chapters")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjects(List objectsClass)
- {
- try
- {
- //insert
- var chaptersResult = await _chapterService.InsertObjectsAsync(objectsClass);
- return Created("none", chaptersResult);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert list chaptersRegisters
- [HttpPost("/chapters/registers")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjectsRegisters(List objectsRegistersClass)
- {
- try
- {
- //insert
- var chapterResult = await _chapterRegisterService.InsertObjectsRegistersAsync(objectsRegistersClass);
- return Created("none", chapterResult);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //put chapterRegister into db
- [HttpPut("/chapter/register")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ChapterRegisterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task UpdateObjectRegister(ChapterRegisterDTO objectRegisterClass)
- {
- try
- {
- var chapterRegisterResult = await _chapterRegisterService.UpdateObjectRegisterAsync(objectRegisterClass);
- return Ok(chapterRegisterResult);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
-
- //reset state download of chapterRegister into db
- [HttpPut("/book/redownload")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List))]
- [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task RedownloadObjectByUrlPage(string name, string username)
- {
- try
- {
- AuthDTO account = null;
- try
- {
- account = await _accountService.FindAccountByUsername(username);
- }
- catch (ApiNotFoundException)
- {
- throw new ApiNotAuthorizeException();
- }
-
- if (account.Role != 100)
- throw new ApiNotAuthorizeException();
-
- var result = await _chapterService.ResetStatusMultipleDownloadObjectByIdAsync(name);
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (ApiNotAuthorizeException)
- {
- return StatusCode(401);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //put manga into db
- [HttpPost("/book/download")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task DownloadInfoByUrlPage(DownloadDTO downloadClass, string username)
- {
- try
- {
- AuthDTO account = null;
- try
- {
- account = await _accountService.FindAccountByUsername(username);
- }
- catch (ApiNotFoundException)
- {
- throw new ApiNotAuthorizeException();
- }
-
- if (account.Role != 100)
- throw new ApiNotAuthorizeException();
-
- if (!_schema.ContainsKey(downloadClass.nameCfg))
- return BadRequest();
-
- //get manga
- var manga = RipperBookGeneric.GetDescriptionBook(_schema.GetValue(downloadClass.nameCfg).ToObject(), downloadClass.Url, downloadClass.nameCfg);
- string name = manga.GetValue("name_id").ToString();
- string cover = manga.GetValue("cover").ToString();
-
- //get chapters
- var chapters = RipperBookGeneric.GetChapters(
- _schema.GetValue(downloadClass.nameCfg).ToObject(),
- downloadClass.Url,
- name,
- downloadClass.nameCfg
- );
-
- try
- {
- manga.GetValue("totalVolumes").ToObject();
- manga.GetValue("totalChapters").ToObject();
- }
- catch
- {
- float maxVolumes = 0;
- int maxChapters = chapters.Count;
-
- foreach (var chapter in chapters)
- {
- if (chapter.CurrentVolume > maxVolumes)
- maxVolumes = chapter.CurrentVolume;
- }
-
- manga["totalVolumes"] = maxVolumes;
- manga["totalChapters"] = maxChapters;
- }
-
- //insert manga
- var resultDescription = await _bookService.InsertNameAsync(downloadClass.nameCfg, manga);
-
- //insert chapters
- var listChapters = await _chapterService.InsertObjectsAsync(chapters);
-
- var listChapterRegister = new List();
- List chapterPaths = new();
-
- foreach (var chapter in chapters)
- {
-
- for (int i = 0; i <= chapter.NumberMaxImage; i++)
- {
- chapterPaths.Add($"{_folder}/{chapter.NameManga}/Volume {chapter.CurrentVolume}/Chapter {chapter.CurrentChapter}/{chapter.NameManga} s{chapter.CurrentVolume}c{chapter.CurrentChapter}n{i}.png");
- }
-
- listChapterRegister.Add(new ChapterRegisterDTO
- {
- ChapterId = chapter.ID,
- ChapterPath = chapterPaths.ToArray()
- });
-
- chapterPaths.Clear();
- }
-
- //insert episodesRegisters
- var episodeRegisterResult = await _chapterRegisterService.InsertObjectsRegistersAsync(listChapterRegister);
-
- //delete if exist queue
- try
- {
- await _chapterQueueService.DeleteObjectQueue(new GenericQueueDTO
- {
- NameCfg = downloadClass.nameCfg,
- Url = downloadClass.Url
- });
- }
- catch (ApiNotFoundException) { }
-
- //create message for notify
- string message = $"Added: {name} [Manga]\n";
-
- try
- {
- var messageNotify = new NotifyMangaDTO
- {
- Message = message,
- Image = cover
- };
- await _publishEndpoint.Publish(messageNotify);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
-
- return Created("none", Newtonsoft.Json.JsonConvert.SerializeObject(resultDescription));
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (ApiNotAuthorizeException)
- {
- return StatusCode(401);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- //update status chapter
- [HttpPut("/book/statusDownload")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ChapterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutUpdateStateDownload(ChapterDTO objectClass)
- {
- try
- {
- //update
- var chapterResult = await _chapterService.UpdateStateDownloadAsync(objectClass);
- return Ok(chapterResult);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- //delete manga
- [HttpDelete("/book/{id}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task DeleteInfo(string nameCfg, string id, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- AuthDTO account = null;
- try
- {
- account = await _accountService.FindAccountByUsername(username);
- }
- catch (ApiNotFoundException)
- {
- throw new ApiNotAuthorizeException();
- }
-
- if (account.Role != 100)
- throw new ApiNotAuthorizeException();
-
- var listChapterService = await _chapterService.GetObjectsByNameAsync(id);
- var listChapterRegister = await _chapterRegisterService.GetObjectsRegistersByListObjectId(listChapterService.ToList());
- var bookDescription = await _bookService.GetNameByNameAsync(nameCfg, id, null);
-
- var book = await _bookService.DeleteNameByIdAsync(nameCfg, id);
-
- //create message for notify
- string message = $"Removed: {id} [Manga]\n";
-
- try
- {
- var messageNotify = new NotifyMangaDTO
- {
- Message = message,
- Image = bookDescription.GetValue("cover").ToString()
- };
-
- await _publishEndpoint.Publish(messageNotify);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
-
- foreach (var chapterRegister in listChapterRegister)
- {
- try
- {
- await _publishEndpoint.Publish(chapterRegister);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
- }
-
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(book));
- }
- else
- return BadRequest();
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- //put progress for tracker
- [HttpPut("/chapter/progress")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ProgressChapterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutStateProgress(ProgressChapterDTO progress)
- {
- try
- {
- var result = await _progressChapterService.UpdateProgress(progress);
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- //get progress for tracker
- [HttpGet("/chapter/progress")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ProgressChapterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetStateProgress(string name, string username, string nameCfg)
- {
- try
- {
- var result = await _progressChapterService.GetProgressByName(name, username, nameCfg);
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpGet("/chapter/all-queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectsQueue()
- {
- try
- {
- var result = await _chapterQueueService.GetObjectsQueue();
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpPut("/chapter/queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericQueueDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjectQueue(GenericQueueDTO objectClass)
- {
- try
- {
- var result = await _chapterQueueService.PutObjectQueue(objectClass);
-
- //create message for notify
- string message = $"Someone likes: {objectClass.Name} [Manga]\n";
-
- try
- {
- var messageNotify = new NotifyRequestMangaDTO
- {
- Message = message
- };
-
- await _publishEndpoint.Publish(messageNotify);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
-
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpDelete("/chapter/queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericQueueDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task DeleteObjectQueue(GenericQueueDTO objectClass)
- {
- try
- {
- var result = await _chapterQueueService.DeleteObjectQueue(objectClass);
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpGet("/chapter/queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericQueueDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectQueue(string name, string url, string nameCfg)
- {
- try
- {
- var result = await _chapterQueueService.GetObjectQueue(new GenericQueueDTO
- {
- Name = name,
- NameCfg = nameCfg,
- Url = url
- });
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpPut("/chapter/blacklist")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericBlackListDTO))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjectBlackList(GenericBlackListDTO objectClass)
- {
- try
- {
- var result = await _chapterBlackListService.PutObjectBlackList(objectClass);
-
- await _chapterQueueService.DeleteObjectQueue(new GenericQueueDTO
- {
- Name = objectClass.Name,
- Url = objectClass.Url,
- NameCfg = objectClass.NameCfg,
- });
-
- return Ok(result);
- }
- catch (ApiConflictException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Api/Controllers/GenericController.cs b/src/Cesxhin.AnimeManga.Api/Controllers/GenericController.cs
deleted file mode 100644
index b50375a..0000000
--- a/src/Cesxhin.AnimeManga.Api/Controllers/GenericController.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-using Cesxhin.AnimeManga.Modules.Exceptions;
-using Cesxhin.AnimeManga.Application.Interfaces.Services;
-using Cesxhin.AnimeManga.Modules.Parallel;
-using Cesxhin.AnimeManga.Domain.DTO;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Newtonsoft.Json.Linq;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Api.Controllers
-{
- [Route("api")]
- [ApiController]
- public class GenericController : ControllerBase
- {
- //interfaces
- private readonly IDescriptionVideoService _descriptionVideoService;
- private readonly IDescriptionBookService _descriptionBookService;
-
- //env
- private readonly JObject schemas = JObject.Parse(Environment.GetEnvironmentVariable("SCHEMA"));
-
- public GenericController(
- IDescriptionVideoService descriptionVideoService,
- IDescriptionBookService descriptionBookService
- )
- {
- _descriptionVideoService = descriptionVideoService;
- _descriptionBookService = descriptionBookService;
- }
- //check test
- [HttpGet("/cfg")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task getSchema()
- {
- try
- {
- return Ok(Environment.GetEnvironmentVariable("SCHEMA"));
- }
- catch
- {
- return StatusCode(500);
- }
- }
-
- //check test
- [HttpGet("/check")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task Check()
- {
- try
- {
- return Ok("Ok");
- }
- catch
- {
- return StatusCode(500);
- }
- }
- //get all db only saved by account
- [HttpGet("/all/watchlist")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetAllOnlyWatchList(string username)
- {
- List listGeneric = new();
- dynamic result;
- try
- {
- foreach (var item in schemas)
- {
- var schema = schemas.GetValue(item.Key).ToObject();
- if (schema.GetValue("type").ToString() == "video")
- {
- result = await _descriptionVideoService.GetNameAllOnlyWatchListAsync(item.Key, username);
- }
- else
- {
- result = await _descriptionBookService.GetNameAllOnlyWatchListAsync(item.Key, username);
- }
-
- if (result != null)
- listGeneric.AddRange(result);
- }
-
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(listGeneric));
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get all db
- [HttpGet("/all")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetAll(string username)
- {
- List listGeneric = new();
- dynamic result;
- try
- {
- foreach (var item in schemas)
- {
- var schema = schemas.GetValue(item.Key).ToObject();
- result = null;
-
- if (schema.GetValue("type").ToString() == "video")
- {
- try
- {
- result = await _descriptionVideoService.GetNameAllAsync(item.Key, username);
- }
- catch (ApiNotFoundException) { }
- }
- else
- {
- try
- {
- result = await _descriptionBookService.GetNameAllAsync(item.Key, username);
- }
- catch (ApiNotFoundException) { }
- }
-
- if (result != null)
- listGeneric.AddRange(result);
- }
-
- if (listGeneric.Count > 0)
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(listGeneric));
- else
- throw new ApiNotFoundException();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get all db
- [HttpGet("/search")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetSearch(string username)
- {
- List listGeneric = new();
- ParallelManager> parallel = new();
- List>> tasks = new();
- dynamic result;
- try
- {
- foreach (var item in schemas)
- {
- var schema = schemas.GetValue(item.Key).ToObject();
- if (schema.GetValue("type").ToString() == "video")
- {
- var key = item.Key;
- tasks.Add(new Func>(() => _descriptionVideoService.GetNameAllAsync(key, username).GetAwaiter().GetResult()));
- }
- else
- {
- var key = item.Key;
- tasks.Add(new Func>(() => _descriptionBookService.GetNameAllAsync(key, username).GetAwaiter().GetResult()));
- }
-
- }
-
- parallel.AddTasks(tasks);
- parallel.Start();
- parallel.WhenCompleted();
-
- result = parallel.GetResult();
-
- foreach (var item in result)
- listGeneric.AddRange(item);
-
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(listGeneric));
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Api/Controllers/VideoController.cs b/src/Cesxhin.AnimeManga.Api/Controllers/VideoController.cs
deleted file mode 100644
index ab992dd..0000000
--- a/src/Cesxhin.AnimeManga.Api/Controllers/VideoController.cs
+++ /dev/null
@@ -1,981 +0,0 @@
-using Cesxhin.AnimeManga.Modules.Exceptions;
-using Cesxhin.AnimeManga.Modules.HtmlAgilityPack;
-using Cesxhin.AnimeManga.Application.Interfaces.Controllers;
-using Cesxhin.AnimeManga.Application.Interfaces.Services;
-using Cesxhin.AnimeManga.Modules.NlogManager;
-using Cesxhin.AnimeManga.Domain.DTO;
-using MassTransit;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Mvc;
-using Newtonsoft.Json.Linq;
-using NLog;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Api.Controllers
-{
- [Route("api")]
- [ApiController]
- public class AnimeController : ControllerBase, IGeneralControllerBase
- {
- //interfaces
- private readonly IDescriptionVideoService _descriptionService;
- private readonly IEpisodeService _episodeService;
- private readonly IEpisodeRegisterService _episodeRegisterService;
- private readonly IProgressEpisodeService _progressEpisodeService;
- private readonly IEpisodeQueueService _episodeQueueService;
- private readonly IAccountService _accountService;
- private readonly IEpisodeBlackListService _episodeBlackListService;
- private readonly IBus _publishEndpoint;
-
- //log
- private readonly NLogConsole _logger = new(LogManager.GetCurrentClassLogger());
-
- //env
- private readonly string _folder = Environment.GetEnvironmentVariable("BASE_PATH") ?? "/";
- private readonly JObject _schema = JObject.Parse(Environment.GetEnvironmentVariable("SCHEMA"));
-
- public AnimeController(
- IEpisodeService episodeService,
- IEpisodeRegisterService episodeRegisterService,
- IDescriptionVideoService descriptionService,
- IProgressEpisodeService progressEpisodeService,
- IEpisodeQueueService episodeQueueService,
- IEpisodeBlackListService episodeBlackListService,
- IAccountService accountService,
- IBus publishEndpoint
- )
- {
- _descriptionService = descriptionService;
- _episodeService = episodeService;
- _episodeRegisterService = episodeRegisterService;
- _publishEndpoint = publishEndpoint;
- _episodeQueueService = episodeQueueService;
- _progressEpisodeService = progressEpisodeService;
- _accountService = accountService;
- _episodeBlackListService = episodeBlackListService;
- }
-
- //get list all anime without filter
- [HttpGet("/video")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetInfoAll(string nameCfg, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var listAll = await _descriptionService.GetNameAllAsync(nameCfg, username);
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(listAll));
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get anime by name
- [HttpGet("/video/name/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetInfoByName(string name, string nameCfg, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var description = await _descriptionService.GetNameByNameAsync(nameCfg, name, username);
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(description));
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get list anime by start name similar
- [HttpGet("/video/names/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetMostInfoByName(string nameCfg, string name, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var description = await _descriptionService.GetMostNameByNameAsync(nameCfg, name, username);
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(description));
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get episode by name anime
- [HttpGet("/episode/name/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectByName(string name)
- {
- try
- {
- var listEpisodes = await _episodeService.GetObjectsByNameAsync(name);
- return Ok(listEpisodes);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get episode by id
- [HttpGet("/episode/id/{id}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(EpisodeDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectById(string id)
- {
- try
- {
- var episode = await _episodeService.GetObjectByIDAsync(id);
- return Ok(episode);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //get episodeRegister by id
- [HttpGet("/episode/register/episodeid/{id}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(EpisodeRegisterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectRegisterByObjectId(string id)
- {
- try
- {
- var episodeRegister = await _episodeRegisterService.GetObjectRegisterByObjectId(id);
- return Ok(episodeRegister);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert anime
- [HttpPost("/video")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutInfo(string nameCfg, string description)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- //insert
- var descriptionResult = await _descriptionService.InsertNameAsync(nameCfg, JObject.Parse(description));
- return Created("none", Newtonsoft.Json.JsonConvert.SerializeObject(descriptionResult));
- }
- else
- return BadRequest();
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //update anime
- [HttpPut("/video")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task UpdateInfo([FromBody] string content)
- {
- try
- {
- var description = JObject.Parse(content);
- string nameCfg = (string)description["nameCfg"];
-
- if (_schema.ContainsKey(nameCfg))
- {
- //update
- var descriptionResult = await _descriptionService.UpdateNameAsync(nameCfg, description);
- return Created("none", Newtonsoft.Json.JsonConvert.SerializeObject(descriptionResult));
- }
- else
- return BadRequest();
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert episode
- [HttpPost("/episode")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(EpisodeDTO))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObject(EpisodeDTO objectClass)
- {
- try
- {
- //insert
- var episodeResult = await _episodeService.InsertObjectAsync(objectClass);
- return Created("none", episodeResult);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert list episodes
- [HttpPost("/episodes")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjects(List objectsClass)
- {
- try
- {
- //insert
- var episodeResult = await _episodeService.InsertObjectsAsync(objectsClass);
- return Created("none", episodeResult);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //insert list episodesRegisters
- [HttpPost("/episodes/registers")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjectsRegisters(List objectsRegistersClass)
- {
- try
- {
- //insert
- var episodeResult = await _episodeRegisterService.InsertObjectsRegistersAsync(objectsRegistersClass);
- return Created("none", episodeResult);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //put episodeRegister into db
- [HttpPut("/episode/register")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(EpisodeRegisterDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task UpdateObjectRegister(EpisodeRegisterDTO objectRegisterClass)
- {
- try
- {
- var rs = await _episodeRegisterService.UpdateObjectRegisterAsync(objectRegisterClass);
- return Ok(rs);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- return StatusCode(500, ex.Message);
- }
- }
-
- //put anime into db
- [HttpPost("/video/download")]
- [ProducesResponseType(StatusCodes.Status201Created, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task DownloadInfoByUrlPage(DownloadDTO downloadClass, string username)
- {
- try
- {
- AuthDTO account = null;
- try
- {
- account = await _accountService.FindAccountByUsername(username);
- }
- catch(ApiNotFoundException)
- {
- throw new ApiNotAuthorizeException();
- }
-
- if (account.Role != 100)
- throw new ApiNotAuthorizeException();
-
- JObject cfg = null;
-
- if (!_schema.ContainsKey(downloadClass.nameCfg))
- return BadRequest();
-
- cfg = _schema.GetValue(downloadClass.nameCfg).ToObject();
-
- //get anime and episodes
- var description = RipperVideoGeneric.GetDescriptionVideo(cfg, downloadClass.Url, downloadClass.nameCfg);
- var episodes = RipperVideoGeneric.GetEpisodes(cfg, downloadClass.Url, description["name_id"].ToString(), downloadClass.nameCfg);
-
- var listEpisodeRegister = new List();
-
- foreach (var episode in episodes)
- {
- listEpisodeRegister.Add(new EpisodeRegisterDTO
- {
- EpisodeId = episode.ID,
- EpisodePath = $"{_folder}/{episode.VideoId}/Season {episode.NumberSeasonCurrent.ToString("D2")}/{episode.VideoId} s{episode.NumberSeasonCurrent.ToString("D2")}e{episode.NumberEpisodeCurrent.ToString("D2")}.mp4"
- });
- }
-
- var descriptionResult = await _descriptionService.InsertNameAsync(downloadClass.nameCfg, JObject.Parse(description.ToString()));
-
- //insert episodes
- var episodeResult = await _episodeService.InsertObjectsAsync(episodes);
-
- //insert episodesRegisters
- var episodeRegisterResult = await _episodeRegisterService.InsertObjectsRegistersAsync(listEpisodeRegister);
-
- //delete if exist queue
- try
- {
- await _episodeQueueService.DeleteObjectQueue(new GenericQueueDTO {
- NameCfg = downloadClass.nameCfg,
- Url = downloadClass.Url
- });
- }
- catch (ApiNotFoundException) { }
-
- //create message for notify
- string message = $"Added: {description["name_id"]} [Anime]\n";
-
- try
- {
- var messageNotify = new NotifyAnimeDTO
- {
- Message = message,
- Image = description["cover"].ToString()
- };
- await _publishEndpoint.Publish(messageNotify);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
-
- return Created("none", Newtonsoft.Json.JsonConvert.SerializeObject(descriptionResult));
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (ApiNotAuthorizeException)
- {
- return StatusCode(401);
- }
- catch (Exception e)
- {
- _logger.Error(e);
- return StatusCode(500);
- }
- }
-
- //reset state download of episodeRegister into db
- [HttpPut("/video/redownload")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List))]
- [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task RedownloadObjectByUrlPage(string name, string username)
- {
- try
- {
- AuthDTO account = null;
- try
- {
- account = await _accountService.FindAccountByUsername(username);
- }
- catch (ApiNotFoundException)
- {
- throw new ApiNotAuthorizeException();
- }
-
- if (account.Role != 100)
- throw new ApiNotAuthorizeException();
-
- var rs = await _episodeService.ResetStatusMultipleDownloadObjectByIdAsync(name);
- return Ok(rs);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (ApiNotAuthorizeException)
- {
- return StatusCode(401);
- }
- catch (Exception)
- {
- return StatusCode(500);
- }
- }
-
- //delete description
- [HttpDelete("/video/{id}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(string))]
- [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task DeleteInfo(string nameCfg, string id, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- AuthDTO account = null;
- try
- {
- account = await _accountService.FindAccountByUsername(username);
- }
- catch (ApiNotFoundException)
- {
- throw new ApiNotAuthorizeException();
- }
-
- if (account.Role != 100)
- throw new ApiNotAuthorizeException();
-
- var listEpisodeService = await _episodeService.GetObjectsByNameAsync(id);
- var listEpisodeRegister = await _episodeRegisterService.GetObjectsRegistersByListObjectId(listEpisodeService.ToList());
- var videoDescription = await _descriptionService.GetNameByNameAsync(nameCfg, id, null);
-
- //delete
- var videoResult = await _descriptionService.DeleteNameByIdAsync(nameCfg, id);
-
- //create message for notify
- string message = $"Removed: {id} [Anime]\n";
-
- try
- {
- var messageNotify = new NotifyAnimeDTO
- {
- Message = message,
- Image = videoDescription.GetValue("cover").ToString()
- };
- await _publishEndpoint.Publish(messageNotify);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
-
- foreach (var episode in listEpisodeRegister)
- {
- try
- {
- await _publishEndpoint.Publish(episode);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
- }
-
- return Ok(Newtonsoft.Json.JsonConvert.SerializeObject(videoResult));
- }
- else
- return BadRequest();
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception)
- {
- return StatusCode(500);
- }
- }
-
- //get all db anime
- [HttpGet("/video/all")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(IEnumerable))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status400BadRequest)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetAll(string nameCfg, string username)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var listDescription = await _descriptionService.GetNameAllWithAllAsync(nameCfg, username);
- return Ok(listDescription);
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception)
- {
- return StatusCode(500);
- }
- }
-
- //get list name by external db
- [HttpGet("/video/list/name/{name}")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetListSearchByName(string nameCfg, string name)
- {
- try
- {
- if (_schema.ContainsKey(nameCfg))
- {
- var searchSchema = _schema.GetValue(nameCfg).ToObject().GetValue("search").ToObject();
- var descriptionUrls = RipperVideoGeneric.GetVideoUrl(searchSchema, name);
-
- List listBlackList = new();
- try
- {
- listBlackList = await _episodeBlackListService.GetObjectsBlackList();
- }
- catch (ApiNotFoundException) { }
-
- if (listBlackList.Any())
- {
- descriptionUrls = descriptionUrls.Where(book =>
- listBlackList.Where(blackList =>
- book.Name == blackList.Name &&
- book.Url == blackList.Url &&
- nameCfg == blackList.NameCfg
- ).ToList().Count == 0
- ).ToList();
- }
-
- //list anime
- List list = new();
-
- foreach (var descrptionUrl in descriptionUrls)
- {
- var descriptionUrlDTO = GenericUrlDTO.GenericUrlToGenericUrlDTO(descrptionUrl);
-
- //check if already exists
- try
- {
- await _descriptionService.GetNameByNameAsync(nameCfg, descriptionUrlDTO.Name, null);
- descriptionUrlDTO.Exists = true;
- }
- catch (ApiNotFoundException) { }
-
- list.Add(descriptionUrlDTO);
- }
- return Ok(list);
- }
- else
- return BadRequest();
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception)
- {
- return StatusCode(500);
- }
- }
-
- //update status episode
- [HttpPut("/video/statusDownload")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(EpisodeDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutUpdateStateDownload(EpisodeDTO objectClass)
- {
- try
- {
- //update
- var resultEpisode = await _episodeService.UpdateStateDownloadAsync(objectClass);
- return Ok(resultEpisode);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception)
- {
- return StatusCode(500);
- }
- }
-
- //put progress for tracker
- [HttpPut("/episode/progress")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ProgressEpisodeDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutStateProgress(ProgressEpisodeDTO progress)
- {
- try
- {
- var result = await _progressEpisodeService.UpdateProgress(progress);
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception)
- {
- return StatusCode(500);
- }
- }
-
- //put progress for tracker
- [HttpGet("/episode/progress")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ProgressEpisodeDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetStateProgress(string name, string username, string nameCfg)
- {
- try
- {
- var result = await _progressEpisodeService.GetProgressByName(name, username, nameCfg);
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception)
- {
- return StatusCode(500);
- }
- }
-
- [HttpGet("/episode/all-queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectsQueue()
- {
- try
- {
- var result = await _episodeQueueService.GetObjectsQueue();
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpPut("/episode/queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericQueueDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjectQueue(GenericQueueDTO objectClass)
- {
- try
- {
- var result = await _episodeQueueService.PutObjectQueue(objectClass);
-
- //create message for notify
- string message = $"Someone likes: {objectClass.Name} [Anime]\n";
-
- try
- {
- var messageNotify = new NotifyRequestAnimeDTO
- {
- Message = message
- };
-
- await _publishEndpoint.Publish(messageNotify);
- }
- catch (Exception ex)
- {
- _logger.Error($"Cannot send message rabbit, details: {ex.Message}");
- }
-
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (ApiConflictException)
- {
- return Conflict();
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpDelete("/episode/queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericQueueDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task DeleteObjectQueue(GenericQueueDTO objectClass)
- {
- try
- {
- var result = await _episodeQueueService.DeleteObjectQueue(objectClass);
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpGet("/episode/queue")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericQueueDTO))]
- [ProducesResponseType(StatusCodes.Status404NotFound)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task GetObjectQueue(string name, string url, string nameCfg)
- {
- try
- {
- var result = await _episodeQueueService.GetObjectQueue(new GenericQueueDTO
- {
- Name = name,
- NameCfg = nameCfg,
- Url = url
- });
- return Ok(result);
- }
- catch (ApiNotFoundException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
-
- [HttpPut("/episode/blacklist")]
- [ProducesResponseType(StatusCodes.Status200OK, Type = typeof(GenericBlackListDTO))]
- [ProducesResponseType(StatusCodes.Status409Conflict)]
- [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- public async Task PutObjectBlackList(GenericBlackListDTO objectClass)
- {
- try
- {
- var result = await _episodeBlackListService.PutObjectBlackList(objectClass);
-
- await _episodeQueueService.DeleteObjectQueue(new GenericQueueDTO {
- Name = objectClass.Name,
- Url = objectClass.Url,
- NameCfg = objectClass.NameCfg,
- });
-
- return Ok(result);
- }
- catch (ApiConflictException)
- {
- return NotFound();
- }
- catch (ApiGenericException)
- {
- return StatusCode(500);
- }
- catch (Exception ex)
- {
- _logger.Error(ex.Message);
- return StatusCode(500, ex.Message);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Cesxhin.AnimeManga.Api/Program.cs b/src/Cesxhin.AnimeManga.Api/Program.cs
deleted file mode 100644
index a58a48f..0000000
--- a/src/Cesxhin.AnimeManga.Api/Program.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Hosting;
-
-namespace Cesxhin.AnimeManga.Api
-{
- public class Program
- {
- public static void Main(string[] args)
- {
- CreateHostBuilder(args).Build().Run();
- }
-
- public static IHostBuilder CreateHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup();
- });
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Api/Startup.cs b/src/Cesxhin.AnimeManga.Api/Startup.cs
deleted file mode 100644
index d0928a7..0000000
--- a/src/Cesxhin.AnimeManga.Api/Startup.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using Cesxhin.AnimeManga.Modules.Generic;
-using Cesxhin.AnimeManga.Application.Interfaces.Repositories;
-using Cesxhin.AnimeManga.Application.Interfaces.Services;
-using Cesxhin.AnimeManga.Modules.Schema;
-using Cesxhin.AnimeManga.Application.Services;
-using Cesxhin.AnimeManga.Persistence.Repositories;
-using MassTransit;
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-using Microsoft.OpenApi.Models;
-using NLog;
-using Quartz;
-using System;
-
-namespace Cesxhin.AnimeManga.Api
-{
- public class Startup
- {
- public Startup(IConfiguration configuration)
- {
- Configuration = configuration;
-
- SchemaControl.Check();
- }
-
- public IConfiguration Configuration { get; }
-
- // This method gets called by the runtime. Use this method to add services to the container.
- public void ConfigureServices(IServiceCollection services)
- {
- //interfaces
- //services
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
-
- //repositories
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
- services.AddSingleton();
-
- //init repoDb
- RepoDb.PostgreSqlBootstrap.Initialize();
-
- //rabbit
- services.AddMassTransit(
- x =>
- {
- x.UsingRabbitMq((context, cfg) =>
- {
- cfg.Host(
- Environment.GetEnvironmentVariable("ADDRESS_RABBIT") ?? "localhost",
- "/",
- credentials =>
- {
- credentials.Username(Environment.GetEnvironmentVariable("USERNAME_RABBIT") ?? "guest");
- credentials.Password(Environment.GetEnvironmentVariable("PASSWORD_RABBIT") ?? "guest");
- });
- });
- });
-
-
- services.AddCors();
- services.AddControllers();
- services.AddSwaggerGen(c =>
- {
- c.SwaggerDoc("v1", new OpenApiInfo { Title = "Cesxhin.AnimeManga.Api", Version = "v1" });
- });
-
- //setup nlog
- var level = Environment.GetEnvironmentVariable("LOG_LEVEL")?.ToLower() ?? "info";
- LogLevel logLevel = NLogManager.GetLevel(level);
- NLogManager.Configure(logLevel);
- }
-
- // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
- {
- if (env.IsDevelopment())
- {
- app.UseDeveloperExceptionPage();
- app.UseSwagger();
- app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Cesxhin.AnimeManga.Api v1"));
- }
-
- app.UseHttpsRedirection();
-
- app.UseRouting();
-
- // global cors policy
- app.UseCors(x => x
- .AllowAnyMethod()
- .AllowAnyHeader()
- .SetIsOriginAllowed(origin => true));
-
- app.UseAuthorization();
- app.UseAuthentication();
-
- app.UseEndpoints(endpoints =>
- {
- endpoints.MapControllers();
- });
- }
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Api/appsettings.Development.json b/src/Cesxhin.AnimeManga.Api/appsettings.Development.json
deleted file mode 100644
index 8983e0f..0000000
--- a/src/Cesxhin.AnimeManga.Api/appsettings.Development.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Api/appsettings.json b/src/Cesxhin.AnimeManga.Api/appsettings.json
deleted file mode 100644
index 222224e..0000000
--- a/src/Cesxhin.AnimeManga.Api/appsettings.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft": "Warning",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "AllowedHosts": "*"
-}
\ No newline at end of file
diff --git a/src/Cesxhin.AnimeManga.Api/schema_template.json b/src/Cesxhin.AnimeManga.Api/schema_template.json
deleted file mode 100644
index 305b5c8..0000000
--- a/src/Cesxhin.AnimeManga.Api/schema_template.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "*": {
- "name": "string",
- "type": "string",
- "search": {
- "url_search": "string",
- "page": "boolean",
- "prefixSearch": "string",
-
- "collection": "*",
-
- "description": {
- "imageUrl": "*",
- "urlPage": "*",
- "name": "*"
- }
- },
- "description": {
- "*": "*"
- },
- "video": {
- "collection": "*",
- "procedure": {
- "*":"*"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/Cesxhin.AnimeManga.Application/Cesxhin.AnimeManga.Application.csproj b/src/Cesxhin.AnimeManga.Application/Cesxhin.AnimeManga.Application.csproj
deleted file mode 100644
index 05a0d02..0000000
--- a/src/Cesxhin.AnimeManga.Application/Cesxhin.AnimeManga.Application.csproj
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- net5.0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Controllers/IGeneralControllerBase.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Controllers/IGeneralControllerBase.cs
deleted file mode 100644
index ba293e2..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Controllers/IGeneralControllerBase.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Controllers
-{
- public interface IGeneralControllerBase
- {
- //get
- public Task GetInfoAll(string nameCfg, string username);
- public Task GetInfoByName(string nameCfg, string name, string username);
- public Task GetMostInfoByName(string nameCfg, string name, string username);
- public Task GetAll(string nameCfg, string username);
- public Task GetObjectByName(string name);
- public Task GetObjectById(string id);
- public Task GetObjectRegisterByObjectId(string id);
- public Task GetListSearchByName(string nameCfg, string name);
- public Task GetStateProgress(string name, string username, string nameCfg);
- public Task GetObjectsQueue();
- public Task GetObjectQueue(string name, string url, string nameCfg);
-
- //put
- public Task PutInfo(string nameCfg, I infoClass);
- public Task UpdateInfo(string content);
- public Task PutObject(O objectClass);
- public Task PutObjects(List objectsClass);
- public Task PutObjectsRegisters(List objectsRegistersClass);
- public Task UpdateObjectRegister(R objectRegisterClass);
- public Task RedownloadObjectByUrlPage(string id, string username);
- public Task DownloadInfoByUrlPage(D objectsClass, string username);
- public Task PutUpdateStateDownload(O objectClass);
- public Task PutStateProgress(E objectClass);
- public Task PutObjectQueue(Q objectClass);
- public Task PutObjectBlackList(S objectClass);
-
- //delete
- public Task DeleteInfo(string nameCfg, string id, string username);
- public Task DeleteObjectQueue(Q objectClass);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IAccountRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IAccountRepository.cs
deleted file mode 100644
index 395dd53..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IAccountRepository.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IAccountRepository
- {
- public Task CreateAccount(Auth auth);
- public Task FindAccountByUsername(string username);
-
- //whitelist generic
- public Task> GetListWatchListByUsername(string username);
- public Task InsertWhiteList(WatchList whiteList);
- public Task DeleteWhiteList(WatchList whiteList);
- public Task WhiteListCheckByName(string name, string username);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterBlackListRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterBlackListRepository.cs
deleted file mode 100644
index c54e089..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterBlackListRepository.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IChapterBlackListRepository : IGeneralObjectBlackListRepository
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterQueueRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterQueueRepository.cs
deleted file mode 100644
index c8f4c53..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterQueueRepository.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IChapterQueueRepository : IGeneralObjectQueueRepository
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterRegisterRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterRegisterRepository.cs
deleted file mode 100644
index dbb1c89..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterRegisterRepository.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IChapterRegisterRepository : IGeneralObjectRegisterRepository
- {
- }
-}
\ No newline at end of file
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterRepository.cs
deleted file mode 100644
index 7129947..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IChapterRepository.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IChapterRepository : IGeneralObjectRepository
- {
- public Task DeleteByNameAsync(string id);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IDescriptionRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IDescriptionRepository.cs
deleted file mode 100644
index d8b649c..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IDescriptionRepository.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Newtonsoft.Json.Linq;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IDescriptionRepository : IGeneralNameRepository
- {
-
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeBlackListRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeBlackListRepository.cs
deleted file mode 100644
index 84c7681..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeBlackListRepository.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IEpisodeBlackListRepository : IGeneralObjectBlackListRepository
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeQueueRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeQueueRepository.cs
deleted file mode 100644
index 68d8d2a..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeQueueRepository.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IEpisodeQueueRepository : IGeneralObjectQueueRepository
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeRegisterRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeRegisterRepository.cs
deleted file mode 100644
index 98ab7f3..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeRegisterRepository.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IEpisodeRegisterRepository : IGeneralObjectRegisterRepository
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeRepository.cs
deleted file mode 100644
index 1d86b29..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IEpisodeRepository.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IEpisodeRepository : IGeneralObjectRepository
- {
- public Task DeleteByNameAsync(string id);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralNameRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralNameRepository.cs
deleted file mode 100644
index 537bb44..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralNameRepository.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IGeneralNameRepository
- {
- //get
- Task> GetNameAllAsync(string nameCfg);
- Task GetNameByNameAsync(string nameCfg, string name);
- Task> GetMostNameByNameAsync(string nameCfg, string name);
-
- //Insert
- Task InsertNameAsync(string nameCfg, TGeneralName generalName);
-
- //Update
- Task UpdateNameAsync(string nameCfg, TGeneralName generalName);
-
- //delete
- Task DeleteNameAsync(string nameCfg, string id);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectBlackListRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectBlackListRepository.cs
deleted file mode 100644
index dbca8bf..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectBlackListRepository.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IGeneralObjectBlackListRepository
- {
- //get
- Task GetObjectBlackList(T objectGeneral);
- Task> GetObjectsBlackList();
-
- //put
- Task PutObjectBlackList(T objectGeneral);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectQueueRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectQueueRepository.cs
deleted file mode 100644
index a8bd2f4..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectQueueRepository.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IGeneralObjectQueueRepository
- {
- //get
- Task> GetObjectsQueue();
- Task GetObjectQueue(T objectGeneral);
-
- //put
- Task PutObjectQueue(T objectGeneral);
-
- //delete
- Task DeleteObjectQueue(T objectGeneral);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectRegisterRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectRegisterRepository.cs
deleted file mode 100644
index c71d4b8..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectRegisterRepository.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IGeneralObjectRegisterRepository
- {
- //get
- Task GetObjectRegisterByObjectId(string id);
- Task> GetObjectsRegistersByListObjectId(List listObjects);
-
- //insert
- Task> InsertObjectsRegisterAsync(List objectRegister);
- Task InsertObjectRegisterAsync(T objectRegister);
-
- //put
- Task UpdateObjectRegisterAsync(T objectRegister);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectRepository.cs
deleted file mode 100644
index b8cec89..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IGeneralObjectRepository.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IGeneralObjectRepository
- {
- //get
- Task GetObjectByIDAsync(string id);
- Task> GetObjectsByNameAsync(string nameGeneral);
-
- //insert
- Task> InsertObjectsAsync(List objectsGeneral);
- Task InsertObjectAsync(T objectGeneral);
-
- //update
- Task UpdateStateDownloadAsync(T objectGeneral);
-
- //reset
- Task ResetStatusDownloadObjectByIdAsync(T objectGeneral);
- Task> ResetStatusDownloadObjectsByIdAsync(List objectsGeneral);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IProgressChapterRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IProgressChapterRepository.cs
deleted file mode 100644
index 5a555f0..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IProgressChapterRepository.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IProgressChapterRepository
- {
- public Task UpdateProgress(ProgressChapter progress);
- public Task CheckProgress(string name, string username, string nameCfg);
- public Task CreateProgress(ProgressChapter progress);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IProgressEpisodeRepository.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IProgressEpisodeRepository.cs
deleted file mode 100644
index 6c413ad..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Repositories/IProgressEpisodeRepository.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using Cesxhin.AnimeManga.Domain.Models;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Repositories
-{
- public interface IProgressEpisodeRepository
- {
- public Task UpdateProgress(ProgressEpisode progress);
- public Task CheckProgress(string name, string username, string nameCfg);
- public Task CreateProgress(ProgressEpisode progress);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IAccountService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IAccountService.cs
deleted file mode 100644
index a8b1109..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IAccountService.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IAccountService
- {
- public Task Login(string username, string password);
- public Task CreateAccount(string username, string password);
- public Task FindAccountByUsername(string username);
-
- //whitelist generic
- public Task> GetListWatchListByUsername(string username);
- public Task InsertWatchList(WatchListDTO whiteListDTO);
- public Task DeleteWatchList(WatchListDTO whiteListDTO);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterBlackListService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterBlackListService.cs
deleted file mode 100644
index 995bff4..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterBlackListService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IChapterBlackListService : IGeneralObjectBlackListService
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterQueueService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterQueueService.cs
deleted file mode 100644
index f75139b..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterQueueService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IChapterQueueService : IGeneralObjectQueueService
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterRegisterService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterRegisterService.cs
deleted file mode 100644
index 6196df2..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterRegisterService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IChapterRegisterService : IGeneralObjectRegister
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterService.cs
deleted file mode 100644
index b3a07b8..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IChapterService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IChapterService : IGeneralObject
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IDescriptionBookService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IDescriptionBookService.cs
deleted file mode 100644
index aa60034..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IDescriptionBookService.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-using Newtonsoft.Json.Linq;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IDescriptionBookService : IGeneralNameService
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IDescriptionVideoService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IDescriptionVideoService.cs
deleted file mode 100644
index c460181..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IDescriptionVideoService.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-using Newtonsoft.Json.Linq;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IDescriptionVideoService : IGeneralNameService
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeBlackListService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeBlackListService.cs
deleted file mode 100644
index f1a9e7c..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeBlackListService.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IEpisodeBlackListService : IGeneralObjectBlackListService
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeQueueService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeQueueService.cs
deleted file mode 100644
index 4d3fd7c..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeQueueService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IEpisodeQueueService : IGeneralObjectQueueService
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeRegisterService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeRegisterService.cs
deleted file mode 100644
index 0067900..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeRegisterService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IEpisodeRegisterService : IGeneralObjectRegister
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeService.cs
deleted file mode 100644
index 5757c3d..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IEpisodeService.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Cesxhin.AnimeManga.Domain.DTO;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IEpisodeService : IGeneralObject
- {
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IGeneralNameService.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IGeneralNameService.cs
deleted file mode 100644
index 70c94ea..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IGeneralNameService.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IGeneralNameService
- {
- //get
- Task> GetNameAllAsync(string nameCfg, string username);
- Task GetNameByNameAsync(string nameCfg, string name, string username);
- Task> GetMostNameByNameAsync(string nameCfg, string name, string username);
- Task> GetNameAllWithAllAsync(string nameCfg, string username);
- Task> GetNameAllOnlyWatchListAsync(string nameCfg, string username);
-
- //insert
- Task InsertNameAsync(string nameCfg, TGeneralNameDTO anime);
-
- //update
- Task UpdateNameAsync(string nameCfg, TGeneralNameDTO anime);
-
- //delete
- Task DeleteNameByIdAsync(string nameCfg, string id);
- }
-}
diff --git a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IGeneralObject.cs b/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IGeneralObject.cs
deleted file mode 100644
index f19fc2d..0000000
--- a/src/Cesxhin.AnimeManga.Application/Interfaces/Services/IGeneralObject.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-
-namespace Cesxhin.AnimeManga.Application.Interfaces.Services
-{
- public interface IGeneralObject
- {
- //get
- Task GetObjectByIDAsync(string id);
- Task> GetObjectsByNameAsync(string name);
-
- //insert
- Task