From 8a5884b75288ca6fa5870bc026b23d23e1625ebe Mon Sep 17 00:00:00 2001 From: Ritesh Ghosh Date: Mon, 7 Aug 2023 14:55:25 +0530 Subject: revert(parserTypes): refactored parser types --- src/models/parsers/animeAboutInfo.ts | 19 +++++++++++++++++++ src/models/parsers/animeCategory.ts | 22 ++++++++++++++++++++++ src/models/parsers/animeGenre.ts | 8 ++++++++ src/models/parsers/animeSearch.ts | 8 ++++++++ src/models/parsers/homePage.ts | 18 ++++++++++++++++++ src/models/parsers/index.ts | 13 +++++++++++++ 6 files changed, 88 insertions(+) create mode 100644 src/models/parsers/animeAboutInfo.ts create mode 100644 src/models/parsers/animeCategory.ts create mode 100644 src/models/parsers/animeGenre.ts create mode 100644 src/models/parsers/animeSearch.ts create mode 100644 src/models/parsers/homePage.ts create mode 100644 src/models/parsers/index.ts (limited to 'src') diff --git a/src/models/parsers/animeAboutInfo.ts b/src/models/parsers/animeAboutInfo.ts new file mode 100644 index 0000000..9f20fce --- /dev/null +++ b/src/models/parsers/animeAboutInfo.ts @@ -0,0 +1,19 @@ +import { HttpError } from "http-errors"; +import { ScrapedAnimeSearchResult } from "./animeSearch"; +import { + AnimeGeneralAboutInfo, + Season, + RelatedAnime, + RecommendedAnime, +} from "../anime"; + +export interface ScrapedAnimeAboutInfo + extends Pick { + anime: { + info: AnimeGeneralAboutInfo; + moreInfo: Record; + }; + seasons: Array; + relatedAnimes: Array | HttpError; + recommendedAnimes: Array | HttpError; +} diff --git a/src/models/parsers/animeCategory.ts b/src/models/parsers/animeCategory.ts new file mode 100644 index 0000000..db748da --- /dev/null +++ b/src/models/parsers/animeCategory.ts @@ -0,0 +1,22 @@ +import { HttpError } from "http-errors"; +import { Anime, Top10Anime, AnimeCategories } from "../anime"; + +export interface ScrapedAnimeCategory { + animes: Array | HttpError; + genres: Array; + top10Animes: { + today: Array | HttpError; + week: Array | HttpError; + month: Array | HttpError; + }; + category: AnimeCategories; + totalPages: number; + currentPage: number; + hasNextPage: boolean; +} + +export type CommonAnimeScrapeTypes = + | "animes" + | "totalPages" + | "hasNextPage" + | "currentPage"; diff --git a/src/models/parsers/animeGenre.ts b/src/models/parsers/animeGenre.ts new file mode 100644 index 0000000..09e07fe --- /dev/null +++ b/src/models/parsers/animeGenre.ts @@ -0,0 +1,8 @@ +import { ScrapedHomePage } from "./homePage"; +import { ScrapedAnimeCategory, CommonAnimeScrapeTypes } from "./animeCategory"; + +export interface ScrapedGenreAnime + extends Pick, + Pick { + genreName: string; +} diff --git a/src/models/parsers/animeSearch.ts b/src/models/parsers/animeSearch.ts new file mode 100644 index 0000000..a03a97a --- /dev/null +++ b/src/models/parsers/animeSearch.ts @@ -0,0 +1,8 @@ +import { HttpError } from "http-errors"; +import { MostPopularAnime } from "../anime"; +import { ScrapedAnimeCategory, CommonAnimeScrapeTypes } from "./animeCategory"; + +export interface ScrapedAnimeSearchResult + extends Pick { + mostPopularAnimes: Array | HttpError; +} diff --git a/src/models/parsers/homePage.ts b/src/models/parsers/homePage.ts new file mode 100644 index 0000000..39f44d3 --- /dev/null +++ b/src/models/parsers/homePage.ts @@ -0,0 +1,18 @@ +import { HttpError } from "http-errors"; +import { ScrapedAnimeCategory } from "./animeCategory"; +import { + TrendingAnime, + SpotlightAnime, + TopAiringAnime, + TopUpcomingAnime, + LatestEpisodeAnime, +} from "../anime"; + +export interface ScrapedHomePage + extends Pick { + spotlightAnimes: Array | HttpError; + trendingAnimes: Array | HttpError; + latestEpisodeAnimes: Array | HttpError; + topUpcomingAnimes: Array | HttpError; + topAiringAnimes: Array | HttpError; +} diff --git a/src/models/parsers/index.ts b/src/models/parsers/index.ts new file mode 100644 index 0000000..60c58fb --- /dev/null +++ b/src/models/parsers/index.ts @@ -0,0 +1,13 @@ +import { ScrapedHomePage } from "./homePage"; +import { ScrapedGenreAnime } from "./animeGenre"; +import { ScrapedAnimeCategory } from "./animeCategory"; +import { ScrapedAnimeAboutInfo } from "./animeAboutInfo"; +import { ScrapedAnimeSearchResult } from "./animeSearch"; + +export { + ScrapedHomePage, + ScrapedGenreAnime, + ScrapedAnimeCategory, + ScrapedAnimeAboutInfo, + ScrapedAnimeSearchResult, +}; -- cgit v1.2.3