-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDrop.ts
136 lines (131 loc) · 3.64 KB
/
Drop.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* eslint-disable max-statements */
export class Drop {
id: number;
fancyId: string;
name: string;
description: string;
city: string;
country: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
timezone: string;
private: boolean;
startDate: Date;
createdDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
constructor(properties: DropProperties) {
this.id = properties.id;
this.fancyId = properties.fancyId;
this.name = properties.name;
this.description = properties.description;
this.city = properties.city;
this.country = properties.country;
this.channel = properties.channel;
this.platform = properties.platform;
this.locationType = properties.locationType;
this.dropUrl = properties.dropUrl;
this.imageUrl = properties.imageUrl;
this.originalImageUrl = properties.originalImageUrl;
this.animationUrl = properties.animationUrl;
this.year = properties.year;
this.startDate = properties.startDate;
this.timezone = properties.timezone;
this.private = properties.private;
this.createdDate = properties.createdDate;
this.poapCount = properties.poapCount;
this.transferCount = properties.transferCount;
this.emailReservationCount = properties.emailReservationCount;
this.expiryDate = properties.expiryDate;
this.endDate = properties.endDate;
}
public getTotalMinted(): number {
return this.poapCount + this.emailReservationCount;
}
public toSerializableObject(): SerializableDrop {
return {
id: this.id,
fancyId: this.fancyId,
name: this.name,
description: this.description,
city: this.city,
country: this.country,
channel: this.channel,
platform: this.platform,
locationType: this.locationType,
dropUrl: this.dropUrl,
imageUrl: this.imageUrl,
originalImageUrl: this.originalImageUrl,
animationUrl: this.animationUrl,
year: this.year,
timezone: this.timezone,
private: this.private,
startDate: this.startDate.toISOString(),
createdDate: this.createdDate.toISOString(),
poapCount: this.poapCount,
transferCount: this.transferCount,
emailReservationCount: this.emailReservationCount,
expiryDate: this.expiryDate.toISOString(),
endDate: this.endDate.toISOString(),
};
}
}
export interface SerializableDrop {
id: number;
fancyId: string;
name: string;
description: string;
city: string;
country: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
timezone: string;
private: boolean;
startDate: string; // ISO String representation of Date
createdDate: string; // ISO String representation of Date
poapCount: number;
transferCount: number;
emailReservationCount: number;
expiryDate: string; // ISO String representation of Date
endDate: string; // ISO String representation of Date
}
export interface DropProperties {
id: number;
fancyId: string;
name: string;
description: string;
city: string;
country: string;
channel: string;
platform: string;
locationType: string;
dropUrl: string;
imageUrl: string;
originalImageUrl: string;
animationUrl: string;
year: number;
timezone: string;
private: boolean;
createdDate: Date;
startDate: Date;
expiryDate: Date;
endDate: Date;
poapCount: number;
transferCount: number;
emailReservationCount: number;
}