This repository has been archived by the owner on Sep 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfilter.ts
85 lines (65 loc) · 1.73 KB
/
filter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import {FilterCondition, FilterStatus, Genre, GenreCondition, Type} from "./enum";
import {IManga, IMangaObject, Source} from "./interface";
export type GenreCollection = Array<Genre>;
export interface NameFilterCondition {
name: string;
condition?: FilterCondition;
}
export interface ValueFilter {
value: number;
condition?: FilterCondition;
}
export interface GenreFilter {
inGenres?: GenreCollection;
outGenres?: GenreCollection;
condition?: GenreCondition;
}
export interface RatingFilter { // from
from?: number;
to?: number;
}
export type NameFilter = NameFilterCondition;
export type AuthorFilter = NameFilter;
export type ArtistFilter = NameFilter;
export type ReleaseFilter = ValueFilter;
export interface Search {
name?: NameFilter | string;
author?: AuthorFilter | string;
artist?: ArtistFilter | string;
status?: FilterStatus | string;
released?: ReleaseFilter | number;
genre?: GenreFilter | GenreCollection;
rating?: RatingFilter| number;
mature?: boolean;
type?: Type;
}
export interface MangaFilter {
name?: string;
search?: Search;
sort?: {};
page?: number;
}
export type MangaSource = IManga & Source;
export interface FilteredResults {
results: IMangaObject[];
page: number;
total: number;
}
export namespace filter {
export interface Search {
name?: NameFilter;
author?: AuthorFilter;
artist?: ArtistFilter;
status?: FilterStatus;
released?: ReleaseFilter;
genre?: GenreFilter;
rating?: RatingFilter;
mature?: boolean;
type?: Type;
}
export interface FilterSupport {
search?: Search;
sort?: {};
page?: number;
}
}