diff options
| author | Ritesh Ghosh <[email protected]> | 2023-08-07 14:55:25 +0530 |
|---|---|---|
| committer | Ritesh Ghosh <[email protected]> | 2023-08-07 14:55:25 +0530 |
| commit | 8a5884b75288ca6fa5870bc026b23d23e1625ebe (patch) | |
| tree | 7fe3d2a36fdd60144ac993c10124c270b0e51baa | |
| parent | 10e46b1002dcbbed5202936f1028fae550d9f765 (diff) | |
| download | aniwatch-api-8a5884b75288ca6fa5870bc026b23d23e1625ebe.tar.xz aniwatch-api-8a5884b75288ca6fa5870bc026b23d23e1625ebe.zip | |
revert(parserTypes): refactored parser types
| -rw-r--r-- | src/models/parsers/animeAboutInfo.ts | 19 | ||||
| -rw-r--r-- | src/models/parsers/animeCategory.ts | 22 | ||||
| -rw-r--r-- | src/models/parsers/animeGenre.ts | 8 | ||||
| -rw-r--r-- | src/models/parsers/animeSearch.ts | 8 | ||||
| -rw-r--r-- | src/models/parsers/homePage.ts | 18 | ||||
| -rw-r--r-- | src/models/parsers/index.ts | 13 |
6 files changed, 88 insertions, 0 deletions
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<ScrapedAnimeSearchResult, "mostPopularAnimes"> { + anime: { + info: AnimeGeneralAboutInfo; + moreInfo: Record<string, string | string[]>; + }; + seasons: Array<Season>; + relatedAnimes: Array<RelatedAnime> | HttpError; + recommendedAnimes: Array<RecommendedAnime> | 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<Anime> | HttpError; + genres: Array<string>; + top10Animes: { + today: Array<Top10Anime> | HttpError; + week: Array<Top10Anime> | HttpError; + month: Array<Top10Anime> | 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<ScrapedAnimeCategory, CommonAnimeScrapeTypes | "genres">, + Pick<ScrapedHomePage, "topAiringAnimes"> { + 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<ScrapedAnimeCategory, CommonAnimeScrapeTypes> { + mostPopularAnimes: Array<MostPopularAnime> | 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<ScrapedAnimeCategory, "genres" | "top10Animes"> { + spotlightAnimes: Array<SpotlightAnime> | HttpError; + trendingAnimes: Array<TrendingAnime> | HttpError; + latestEpisodeAnimes: Array<LatestEpisodeAnime> | HttpError; + topUpcomingAnimes: Array<TopUpcomingAnime> | HttpError; + topAiringAnimes: Array<TopAiringAnime> | 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, +}; |
