@nyig/models 0.2.10 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.mts +1070 -421
- package/index.d.ts +1070 -421
- package/index.js +154 -144
- package/index.mjs +153 -144
- package/package.json +2 -1
package/index.mjs
CHANGED
|
@@ -1,70 +1,56 @@
|
|
|
1
|
-
// src/interface/booking/bUserInfo.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
var zBUserInfo = z.object({
|
|
4
|
-
firstName: z.string(),
|
|
5
|
-
lastName: z.string(),
|
|
6
|
-
rank: z.string(),
|
|
7
|
-
email: z.string(),
|
|
8
|
-
phone: z.string().optional(),
|
|
9
|
-
address: z.string().optional(),
|
|
10
|
-
notes: z.string().optional()
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
// src/interface/booking/privateBooking.ts
|
|
14
|
-
import { z as z4 } from "zod";
|
|
15
|
-
|
|
16
|
-
// src/mongoose.ts
|
|
17
|
-
import { z as z2 } from "zod";
|
|
18
|
-
function extendZodObjectForMongoose(original) {
|
|
19
|
-
return original.extend({
|
|
20
|
-
_id: z2.string(),
|
|
21
|
-
createdAt: z2.coerce.date().optional(),
|
|
22
|
-
updatedAt: z2.coerce.date().optional()
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
1
|
// src/interface/booking/bPaymentInfo.ts
|
|
27
|
-
import { z
|
|
28
|
-
var zBPaymentInfo =
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var zBPaymentInfo = z.object({
|
|
29
4
|
/**
|
|
30
5
|
* @units CENTS - Proposed payment amount in cents of the booking
|
|
31
6
|
*/
|
|
32
|
-
paymentAmount:
|
|
7
|
+
paymentAmount: z.number().int().min(1),
|
|
33
8
|
/**
|
|
34
9
|
* True if the payment has been received. Populated by webhook.
|
|
35
10
|
*/
|
|
36
|
-
paymentReceived:
|
|
11
|
+
paymentReceived: z.boolean().optional(),
|
|
37
12
|
/**
|
|
38
13
|
* When Date is reached, document is deleted by MongoDB sweeper.
|
|
39
14
|
* Creation typically marks one to two weeks.
|
|
40
15
|
* After payment, webhook should extend this date to essentially infinite.
|
|
41
16
|
*/
|
|
42
|
-
expireAt:
|
|
17
|
+
expireAt: z.coerce.date().optional()
|
|
43
18
|
});
|
|
44
19
|
|
|
45
|
-
// src/interface/booking/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
20
|
+
// src/interface/booking/bUserInfo.ts
|
|
21
|
+
import { z as z2 } from "zod";
|
|
22
|
+
var zBUserInfo = z2.object({
|
|
23
|
+
firstName: z2.string(),
|
|
24
|
+
lastName: z2.string(),
|
|
25
|
+
rank: z2.string(),
|
|
26
|
+
email: z2.string(),
|
|
27
|
+
phone: z2.string().optional(),
|
|
28
|
+
address: z2.string().optional(),
|
|
29
|
+
notes: z2.string().optional()
|
|
30
|
+
});
|
|
53
31
|
|
|
54
|
-
// src/interface/booking/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
shipping: z5.boolean().optional()
|
|
63
|
-
}).merge(zBUserInfo).merge(zBPaymentInfo);
|
|
64
|
-
var zMGroupBooking = extendZodObjectForMongoose(zGroupBooking);
|
|
32
|
+
// src/interface/booking/bookingType.ts
|
|
33
|
+
var BookingType = /* @__PURE__ */ ((BookingType2) => {
|
|
34
|
+
BookingType2["GROUP"] = "group";
|
|
35
|
+
BookingType2["PRIVATE"] = "private";
|
|
36
|
+
BookingType2["TOURNAMENT"] = "tournament";
|
|
37
|
+
BookingType2["CAMP"] = "camp";
|
|
38
|
+
return BookingType2;
|
|
39
|
+
})(BookingType || {});
|
|
65
40
|
|
|
66
41
|
// src/interface/booking/campBooking.ts
|
|
67
|
-
import { z as
|
|
42
|
+
import { z as z13 } from "zod";
|
|
43
|
+
|
|
44
|
+
// src/interface/mongoose/mongoose.ts
|
|
45
|
+
import { z as z3 } from "zod";
|
|
46
|
+
import { Types } from "mongoose";
|
|
47
|
+
function extendZodObjectForMongoose(original) {
|
|
48
|
+
return original.extend({
|
|
49
|
+
_id: z3.instanceof(Types.ObjectId),
|
|
50
|
+
createdAt: z3.coerce.date().optional(),
|
|
51
|
+
updatedAt: z3.coerce.date().optional()
|
|
52
|
+
});
|
|
53
|
+
}
|
|
68
54
|
|
|
69
55
|
// src/interface/tracking/attendState.ts
|
|
70
56
|
var AttendState = /* @__PURE__ */ ((AttendState2) => {
|
|
@@ -75,14 +61,14 @@ var AttendState = /* @__PURE__ */ ((AttendState2) => {
|
|
|
75
61
|
})(AttendState || {});
|
|
76
62
|
|
|
77
63
|
// src/interface/tracking/attendance.ts
|
|
78
|
-
import { z as
|
|
64
|
+
import { z as z5 } from "zod";
|
|
79
65
|
|
|
80
66
|
// src/interface/payment/tuition.ts
|
|
81
|
-
import { z as
|
|
82
|
-
var zTuition =
|
|
83
|
-
primary:
|
|
84
|
-
textbook:
|
|
85
|
-
shipping:
|
|
67
|
+
import { z as z4 } from "zod";
|
|
68
|
+
var zTuition = z4.object({
|
|
69
|
+
primary: z4.number().int().min(1),
|
|
70
|
+
textbook: z4.boolean().optional(),
|
|
71
|
+
shipping: z4.boolean().optional()
|
|
86
72
|
});
|
|
87
73
|
|
|
88
74
|
// src/interface/tracking/campOption.ts
|
|
@@ -94,47 +80,47 @@ var CampOption = /* @__PURE__ */ ((CampOption2) => {
|
|
|
94
80
|
})(CampOption || {});
|
|
95
81
|
|
|
96
82
|
// src/interface/tracking/attendance.ts
|
|
97
|
-
var zAttendance =
|
|
98
|
-
student:
|
|
99
|
-
states:
|
|
83
|
+
var zAttendance = z5.object({
|
|
84
|
+
student: z5.string(),
|
|
85
|
+
states: z5.array(z5.nativeEnum(AttendState)),
|
|
100
86
|
tuition: zTuition,
|
|
101
|
-
paid:
|
|
102
|
-
campOption:
|
|
87
|
+
paid: z5.boolean().optional(),
|
|
88
|
+
campOption: z5.nativeEnum(CampOption)
|
|
103
89
|
});
|
|
104
90
|
var zMAttendance = extendZodObjectForMongoose(zAttendance);
|
|
105
91
|
|
|
106
92
|
// src/interface/tracking/campTracker.ts
|
|
107
|
-
import { z as
|
|
108
|
-
var zCampTracker =
|
|
93
|
+
import { z as z6 } from "zod";
|
|
94
|
+
var zCampTracker = z6.object({
|
|
109
95
|
/**
|
|
110
96
|
* Mongoose object ID
|
|
111
97
|
*/
|
|
112
|
-
course:
|
|
98
|
+
course: z6.string(),
|
|
113
99
|
/**
|
|
114
100
|
* Mongoose object ID
|
|
115
101
|
*/
|
|
116
|
-
teacher:
|
|
102
|
+
teacher: z6.string(),
|
|
117
103
|
/**
|
|
118
104
|
* Mongoose object ID
|
|
119
105
|
*/
|
|
120
|
-
semester:
|
|
106
|
+
semester: z6.string(),
|
|
121
107
|
/**
|
|
122
108
|
* occurrences are tracked by week for camps
|
|
123
109
|
*/
|
|
124
|
-
occurrences:
|
|
110
|
+
occurrences: z6.array(z6.string()),
|
|
125
111
|
/**
|
|
126
112
|
* attendances are tracked by week for camps
|
|
127
113
|
*/
|
|
128
|
-
attendances:
|
|
129
|
-
notes:
|
|
114
|
+
attendances: z6.array(z6.string()),
|
|
115
|
+
notes: z6.string().optional()
|
|
130
116
|
});
|
|
131
117
|
var zMCampTracker = extendZodObjectForMongoose(zCampTracker);
|
|
132
118
|
|
|
133
119
|
// src/interface/tracking/classTracker.ts
|
|
134
|
-
import { z as
|
|
120
|
+
import { z as z9 } from "zod";
|
|
135
121
|
|
|
136
122
|
// src/interface/payment/invoice.ts
|
|
137
|
-
import { z as
|
|
123
|
+
import { z as z7 } from "zod";
|
|
138
124
|
|
|
139
125
|
// src/interface/payment/paymentMethod.ts
|
|
140
126
|
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
@@ -146,94 +132,94 @@ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
|
146
132
|
})(PaymentMethod || {});
|
|
147
133
|
|
|
148
134
|
// src/interface/payment/invoice.ts
|
|
149
|
-
var zDiscount =
|
|
150
|
-
desc:
|
|
151
|
-
amount:
|
|
135
|
+
var zDiscount = z7.object({
|
|
136
|
+
desc: z7.string(),
|
|
137
|
+
amount: z7.number()
|
|
152
138
|
});
|
|
153
|
-
var zInvoiceItem =
|
|
139
|
+
var zInvoiceItem = z7.object({
|
|
154
140
|
/**
|
|
155
141
|
* Mongoose object ID
|
|
156
142
|
*/
|
|
157
|
-
course:
|
|
158
|
-
price:
|
|
159
|
-
units:
|
|
143
|
+
course: z7.string(),
|
|
144
|
+
price: z7.number(),
|
|
145
|
+
units: z7.number()
|
|
160
146
|
});
|
|
161
|
-
var zInvoicePackage =
|
|
147
|
+
var zInvoicePackage = z7.object({
|
|
162
148
|
/**
|
|
163
149
|
* Mongoose object ID
|
|
164
150
|
*/
|
|
165
|
-
student:
|
|
166
|
-
items:
|
|
151
|
+
student: z7.string(),
|
|
152
|
+
items: z7.array(zInvoiceItem)
|
|
167
153
|
});
|
|
168
|
-
var zInvoice =
|
|
169
|
-
billTo:
|
|
170
|
-
packages:
|
|
171
|
-
discounts:
|
|
172
|
-
textbook:
|
|
173
|
-
shipping:
|
|
174
|
-
paid:
|
|
175
|
-
notes:
|
|
154
|
+
var zInvoice = z7.object({
|
|
155
|
+
billTo: z7.string(),
|
|
156
|
+
packages: z7.array(zInvoicePackage),
|
|
157
|
+
discounts: z7.array(zDiscount),
|
|
158
|
+
textbook: z7.number().int().min(1).optional(),
|
|
159
|
+
shipping: z7.number().int().min(1).optional(),
|
|
160
|
+
paid: z7.nativeEnum(PaymentMethod).optional(),
|
|
161
|
+
notes: z7.string().optional(),
|
|
176
162
|
/**
|
|
177
163
|
* Mongoose object ID
|
|
178
164
|
*/
|
|
179
|
-
createdBy:
|
|
165
|
+
createdBy: z7.string(),
|
|
180
166
|
/**
|
|
181
167
|
* Mongoose object ID
|
|
182
168
|
*/
|
|
183
|
-
lastEditBy:
|
|
169
|
+
lastEditBy: z7.string().optional()
|
|
184
170
|
});
|
|
185
171
|
var zMInvoice = extendZodObjectForMongoose(zInvoice);
|
|
186
172
|
|
|
187
173
|
// src/interface/payment/teacherPayment.ts
|
|
188
|
-
import { z as
|
|
189
|
-
var zTeacherPaymentRow =
|
|
190
|
-
course:
|
|
191
|
-
length:
|
|
192
|
-
count:
|
|
193
|
-
wage:
|
|
174
|
+
import { z as z8 } from "zod";
|
|
175
|
+
var zTeacherPaymentRow = z8.object({
|
|
176
|
+
course: z8.string(),
|
|
177
|
+
length: z8.number(),
|
|
178
|
+
count: z8.number(),
|
|
179
|
+
wage: z8.number()
|
|
194
180
|
});
|
|
195
|
-
var zTeacherPayment =
|
|
196
|
-
teacher:
|
|
197
|
-
rows:
|
|
198
|
-
paid:
|
|
181
|
+
var zTeacherPayment = z8.object({
|
|
182
|
+
teacher: z8.string(),
|
|
183
|
+
rows: z8.array(zTeacherPaymentRow),
|
|
184
|
+
paid: z8.boolean().optional()
|
|
199
185
|
});
|
|
200
186
|
var zMTeacherPayment = extendZodObjectForMongoose(zTeacherPayment);
|
|
201
187
|
|
|
202
188
|
// src/interface/tracking/classTracker.ts
|
|
203
|
-
var zClassTracker =
|
|
189
|
+
var zClassTracker = z9.object({
|
|
204
190
|
/**
|
|
205
191
|
* Mongoose object ID
|
|
206
192
|
*/
|
|
207
|
-
course:
|
|
193
|
+
course: z9.string(),
|
|
208
194
|
/**
|
|
209
195
|
* Mongoose object ID
|
|
210
196
|
*/
|
|
211
|
-
teacher:
|
|
197
|
+
teacher: z9.string(),
|
|
212
198
|
/**
|
|
213
199
|
* Mongoose object ID
|
|
214
200
|
*/
|
|
215
|
-
semester:
|
|
216
|
-
classTimes:
|
|
217
|
-
completedList:
|
|
201
|
+
semester: z9.string(),
|
|
202
|
+
classTimes: z9.array(z9.coerce.date()),
|
|
203
|
+
completedList: z9.array(z9.boolean()),
|
|
218
204
|
/**
|
|
219
205
|
* Virtual mongoose field when all values in completedList is true
|
|
220
206
|
*/
|
|
221
|
-
completed:
|
|
207
|
+
completed: z9.boolean().optional(),
|
|
222
208
|
tuition: zTuition.optional(),
|
|
223
|
-
paid:
|
|
224
|
-
notes:
|
|
209
|
+
paid: z9.boolean().optional(),
|
|
210
|
+
notes: z9.string().optional()
|
|
225
211
|
});
|
|
226
212
|
var zMClassTracker = extendZodObjectForMongoose(zClassTracker);
|
|
227
213
|
|
|
228
214
|
// src/interface/tracking/groupTracker.ts
|
|
229
|
-
import { z as
|
|
215
|
+
import { z as z12 } from "zod";
|
|
230
216
|
|
|
231
217
|
// src/interface/tracking/scheduleData.ts
|
|
232
|
-
import { z as
|
|
233
|
-
var zScheduleData =
|
|
234
|
-
startTime:
|
|
218
|
+
import { z as z10 } from "zod";
|
|
219
|
+
var zScheduleData = z10.object({
|
|
220
|
+
startTime: z10.string(),
|
|
235
221
|
// String in 24 hour "HH:mm" format
|
|
236
|
-
dayOfWeek:
|
|
222
|
+
dayOfWeek: z10.number().int().min(0).max(6)
|
|
237
223
|
// integeters in 0 - 6
|
|
238
224
|
});
|
|
239
225
|
|
|
@@ -262,88 +248,110 @@ var NYIGSchool = /* @__PURE__ */ ((NYIGSchool2) => {
|
|
|
262
248
|
})(NYIGSchool || {});
|
|
263
249
|
|
|
264
250
|
// src/interface/course/course.ts
|
|
265
|
-
import { z as
|
|
266
|
-
var zCourse =
|
|
267
|
-
name:
|
|
268
|
-
category:
|
|
251
|
+
import { z as z11 } from "zod";
|
|
252
|
+
var zCourse = z11.object({
|
|
253
|
+
name: z11.string(),
|
|
254
|
+
category: z11.nativeEnum(CourseCategory),
|
|
269
255
|
/**
|
|
270
256
|
* @unit SECONDS - Duration of the course in seconds
|
|
271
257
|
*/
|
|
272
|
-
duration:
|
|
258
|
+
duration: z11.number(),
|
|
273
259
|
/**
|
|
274
260
|
* @unit CENTS - Price of the course in cents
|
|
275
261
|
*/
|
|
276
|
-
price:
|
|
277
|
-
description:
|
|
262
|
+
price: z11.number(),
|
|
263
|
+
description: z11.string().optional(),
|
|
278
264
|
/**
|
|
279
265
|
* NYIG School locations
|
|
280
266
|
*/
|
|
281
|
-
nyigSchool:
|
|
267
|
+
nyigSchool: z11.nativeEnum(NYIGSchool),
|
|
282
268
|
/**
|
|
283
269
|
* Recommended level before taking this course
|
|
284
270
|
*/
|
|
285
|
-
recLevel:
|
|
271
|
+
recLevel: z11.string(),
|
|
286
272
|
/**
|
|
287
273
|
* Camp tuition for half-day option
|
|
288
274
|
*/
|
|
289
|
-
halfCampTuition:
|
|
275
|
+
halfCampTuition: z11.number(),
|
|
290
276
|
/**
|
|
291
277
|
* Camp tuition for full-day option
|
|
292
278
|
*/
|
|
293
|
-
fullCampTuition:
|
|
279
|
+
fullCampTuition: z11.number()
|
|
294
280
|
});
|
|
295
281
|
var zMCourse = extendZodObjectForMongoose(zCourse);
|
|
296
282
|
|
|
297
283
|
// src/interface/tracking/groupTracker.ts
|
|
298
|
-
var zGroupTracker =
|
|
284
|
+
var zGroupTracker = z12.object({
|
|
299
285
|
/**
|
|
300
286
|
* Mongoose object ID
|
|
301
287
|
*/
|
|
302
|
-
course:
|
|
288
|
+
course: z12.string(),
|
|
303
289
|
/**
|
|
304
290
|
* Mongoose object ID
|
|
305
291
|
*/
|
|
306
|
-
teacher:
|
|
292
|
+
teacher: z12.string(),
|
|
307
293
|
/**
|
|
308
294
|
* Mongoose object ID
|
|
309
295
|
*/
|
|
310
|
-
semester:
|
|
296
|
+
semester: z12.string(),
|
|
311
297
|
scheduleData: zScheduleData,
|
|
312
298
|
/**
|
|
313
299
|
* occurrences are tracked by week for Groups
|
|
314
300
|
*/
|
|
315
|
-
occurrences:
|
|
301
|
+
occurrences: z12.array(z12.coerce.date()),
|
|
316
302
|
/**
|
|
317
303
|
* attendances are tracked by week for Groups
|
|
318
304
|
*/
|
|
319
|
-
attendances:
|
|
305
|
+
attendances: z12.array(z12.string()),
|
|
320
306
|
/**
|
|
321
307
|
* ID of the course instance, e.g., 101
|
|
322
308
|
*/
|
|
323
|
-
courseId:
|
|
309
|
+
courseId: z12.string().optional(),
|
|
324
310
|
/**
|
|
325
311
|
* Age group of the class instance, e.g. "adult", "youth"
|
|
326
312
|
*/
|
|
327
|
-
ageGroup:
|
|
313
|
+
ageGroup: z12.nativeEnum(AgeGroup).optional(),
|
|
328
314
|
/**
|
|
329
315
|
* If true, the course is hidden from public view
|
|
330
316
|
*/
|
|
331
|
-
isNonPublic:
|
|
332
|
-
notes:
|
|
317
|
+
isNonPublic: z12.boolean().optional(),
|
|
318
|
+
notes: z12.string().optional()
|
|
333
319
|
});
|
|
334
320
|
var zMGroupTracker = extendZodObjectForMongoose(zGroupTracker);
|
|
335
321
|
|
|
336
322
|
// src/interface/booking/campBooking.ts
|
|
337
|
-
var zCampBooking =
|
|
338
|
-
userId:
|
|
339
|
-
ctId:
|
|
340
|
-
isOnline:
|
|
341
|
-
classDates:
|
|
342
|
-
campOption:
|
|
343
|
-
shipping:
|
|
323
|
+
var zCampBooking = z13.object({
|
|
324
|
+
userId: z13.string().optional(),
|
|
325
|
+
ctId: z13.string().optional(),
|
|
326
|
+
isOnline: z13.boolean(),
|
|
327
|
+
classDates: z13.string(),
|
|
328
|
+
campOption: z13.nativeEnum(CampOption),
|
|
329
|
+
shipping: z13.boolean().optional()
|
|
344
330
|
}).merge(zBUserInfo).merge(zBPaymentInfo);
|
|
345
331
|
var zMCampBooking = extendZodObjectForMongoose(zCampBooking);
|
|
346
332
|
|
|
333
|
+
// src/interface/booking/groupBooking.ts
|
|
334
|
+
import { z as z14 } from "zod";
|
|
335
|
+
var zGroupBooking = z14.object({
|
|
336
|
+
userId: z14.string().optional(),
|
|
337
|
+
gtId: z14.string().optional(),
|
|
338
|
+
isTrial: z14.boolean().optional(),
|
|
339
|
+
isOnline: z14.boolean(),
|
|
340
|
+
classDate: z14.string().optional(),
|
|
341
|
+
shipping: z14.boolean().optional()
|
|
342
|
+
}).merge(zBUserInfo).merge(zBPaymentInfo);
|
|
343
|
+
var zMGroupBooking = extendZodObjectForMongoose(zGroupBooking);
|
|
344
|
+
|
|
345
|
+
// src/interface/booking/privateBooking.ts
|
|
346
|
+
import { z as z15 } from "zod";
|
|
347
|
+
var zPrivateBooking = z15.object({
|
|
348
|
+
userId: z15.string().optional(),
|
|
349
|
+
courseId: z15.string(),
|
|
350
|
+
teacherId: z15.string(),
|
|
351
|
+
classDate: z15.string().optional()
|
|
352
|
+
}).merge(zBUserInfo).merge(zBPaymentInfo);
|
|
353
|
+
var zMPrivateBooking = extendZodObjectForMongoose(zPrivateBooking);
|
|
354
|
+
|
|
347
355
|
// src/interface/public/aurora.ts
|
|
348
356
|
import { z as z16 } from "zod";
|
|
349
357
|
var zTeacherDisplay = z16.object({
|
|
@@ -555,7 +563,7 @@ var zTTicket = z24.object({
|
|
|
555
563
|
/**
|
|
556
564
|
* @optional If date is provided and in the past, ticket cannot be purchased
|
|
557
565
|
*/
|
|
558
|
-
|
|
566
|
+
lastBuyableDate: z24.coerce.date().optional()
|
|
559
567
|
});
|
|
560
568
|
var zMTTicket = extendZodObjectForMongoose(zTTicket);
|
|
561
569
|
|
|
@@ -668,6 +676,7 @@ var zMTeacher = extendZodObjectForMongoose(zTeacher);
|
|
|
668
676
|
export {
|
|
669
677
|
AgeGroup,
|
|
670
678
|
AttendState,
|
|
679
|
+
BookingType,
|
|
671
680
|
CampOption,
|
|
672
681
|
CourseCategory,
|
|
673
682
|
GoRank,
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyig/models",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
7
7
|
"types": "index.d.ts",
|
|
8
8
|
"peerDependencies": {
|
|
9
|
+
"mongoose": ">=8.0.0",
|
|
9
10
|
"zod": ">=3.22.4"
|
|
10
11
|
},
|
|
11
12
|
"devDependencies": {
|