-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtypes.ts
91 lines (76 loc) · 1.56 KB
/
types.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
86
87
88
89
90
91
import type { VDataTable } from "vuetify/components";
export type ReadonlyTableHeaders = VDataTable["$props"]["headers"];
export type Book = {
_id?: any;
isbn13: string;
title: string;
subtitle?: string;
authors: string;
thumbnail: string;
published_year?: string;
average_rating?: string;
stock: number | null;
checked_out: number;
};
export type BookDetails = Book & {
categories?: string;
description: string;
num_pages: string;
ratings_count?: string;
};
export type GetBooksPayload = {
books: Book[];
total: number;
};
export type SortOption = {
sortBy: keyof BookDetails;
dir: "asc" | "desc";
};
export type BookFilters = {
sort: SortOption;
genres: string[][];
};
export type User = {
email: string;
role: string;
checked_out: UserBook[];
history: UserBook[];
};
export type UserBook = {
_id: any;
book: BookDetails;
timestamp: Date;
};
export type BookReqBody = {
books: {
book: string; // book ID
timestamp: Date;
}[];
};
export type AdminMultiBookReqBody = {
books: BookDetails[];
};
export type AdminSingleBookReqBody = {
book: BookDetails;
};
export type InputRules = Array<(v: string | number) => true | string>;
export type InputField = {
modelKey: string;
label: string;
rules?: InputRules;
required?: boolean;
type?: string;
placeholder?: string;
};
export enum CustomNotificationType {
SUCCESS = "success",
INFO = "info",
WARNING = "warning",
ERROR = "error",
}
export type CustomNotification = {
id: number;
type: CustomNotificationType;
title: string;
text: string;
};