-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
89 lines (77 loc) · 1.59 KB
/
types.d.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
import type { Types} from "mongoose";
//All keys are required except there is a ? after the key.
interface User {
email: string; //unique
password: string;
role: Role;
}
interface Token {
email: string,
role: Role,
iat: number,
exp: number
}
interface Product {
_id: string;
name: string; //unique
description: string;
startingPrice: number; //Prices to be stored in euro-cents (no comma values)
stock: number;
maxOrderAmount: number;
images: string[]
}
interface Reference {
_id: Types.ObjectId;
name: string; //unique
description?: string;
sections?: Section[];
}
declare namespace Reference {
//Sections are nested Objects on References, no seperate collection
interface Section {
heading: string;
text: string;
imgUrl?: string; //we will store the image in aws/azure
}
}
interface Page {
_id: Types.ObjectId;
name: string; //unique
variables: { [key: string]: unknown };
}
namespace Page {
interface About extends Page {
name: "about";
variables: {
imageUrl: string;
name: string;
aboutMe: string;
hobbies: string[];
};
}
}
interface Order {
_id: Types.ObjectId;
email: string;
status: OrderStatus;
dueDate: Date;
shippingAddress: Address;
invoiceAddress?: Address;
products: Types.ObjectId[];
}
interface Address {
firstName: string;
lastName: string;
street: string;
houseNumber: string;
postalCode: string;
country: string;
}
type Role = "root" | "admin" | "customer"
type OrderStatus =
| "new"
| "in Progress"
| "waiting for payment"
| "cancled"
| "shipped"
| "done";