@nyig/models 0.2.14 → 0.2.17
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 +90 -195
- package/index.d.ts +90 -195
- package/index.js +77 -71
- package/index.mjs +78 -72
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -18,8 +18,10 @@ var zBPaymentInfo = z.object({
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
// src/interface/booking/bUserInfo.ts
|
|
21
|
+
import { Types } from "mongoose";
|
|
21
22
|
import { z as z2 } from "zod";
|
|
22
23
|
var zBUserInfo = z2.object({
|
|
24
|
+
userId: z2.instanceof(Types.ObjectId).optional(),
|
|
23
25
|
firstName: z2.string(),
|
|
24
26
|
lastName: z2.string(),
|
|
25
27
|
rank: z2.string(),
|
|
@@ -43,10 +45,10 @@ import { z as z13 } from "zod";
|
|
|
43
45
|
|
|
44
46
|
// src/interface/mongoose/mongoose.ts
|
|
45
47
|
import { z as z3 } from "zod";
|
|
46
|
-
import { Types } from "mongoose";
|
|
48
|
+
import { Types as Types2 } from "mongoose";
|
|
47
49
|
function extendZodObjectForMongoose(original) {
|
|
48
50
|
return original.extend({
|
|
49
|
-
_id: z3.instanceof(
|
|
51
|
+
_id: z3.instanceof(Types2.ObjectId),
|
|
50
52
|
createdAt: z3.coerce.date().optional(),
|
|
51
53
|
updatedAt: z3.coerce.date().optional()
|
|
52
54
|
});
|
|
@@ -61,6 +63,7 @@ var AttendState = /* @__PURE__ */ ((AttendState2) => {
|
|
|
61
63
|
})(AttendState || {});
|
|
62
64
|
|
|
63
65
|
// src/interface/tracking/attendance.ts
|
|
66
|
+
import { Types as Types3 } from "mongoose";
|
|
64
67
|
import { z as z5 } from "zod";
|
|
65
68
|
|
|
66
69
|
// src/interface/payment/tuition.ts
|
|
@@ -80,9 +83,8 @@ var CampOption = /* @__PURE__ */ ((CampOption2) => {
|
|
|
80
83
|
})(CampOption || {});
|
|
81
84
|
|
|
82
85
|
// src/interface/tracking/attendance.ts
|
|
83
|
-
import { Types as Types2 } from "mongoose";
|
|
84
86
|
var zAttendance = z5.object({
|
|
85
|
-
student: z5.instanceof(
|
|
87
|
+
student: z5.instanceof(Types3.ObjectId),
|
|
86
88
|
states: z5.array(z5.nativeEnum(AttendState)),
|
|
87
89
|
tuition: zTuition,
|
|
88
90
|
paid: z5.boolean().optional(),
|
|
@@ -91,12 +93,12 @@ var zAttendance = z5.object({
|
|
|
91
93
|
var zMAttendance = extendZodObjectForMongoose(zAttendance);
|
|
92
94
|
|
|
93
95
|
// src/interface/tracking/campTracker.ts
|
|
94
|
-
import { Types as
|
|
96
|
+
import { Types as Types4 } from "mongoose";
|
|
95
97
|
import { z as z6 } from "zod";
|
|
96
98
|
var zCampTracker = z6.object({
|
|
97
|
-
course: z6.instanceof(
|
|
98
|
-
teacher: z6.instanceof(
|
|
99
|
-
semester: z6.instanceof(
|
|
99
|
+
course: z6.instanceof(Types4.ObjectId),
|
|
100
|
+
teacher: z6.instanceof(Types4.ObjectId),
|
|
101
|
+
semester: z6.instanceof(Types4.ObjectId),
|
|
100
102
|
/**
|
|
101
103
|
* occurrences are tracked by week for camps
|
|
102
104
|
*/
|
|
@@ -110,11 +112,11 @@ var zCampTracker = z6.object({
|
|
|
110
112
|
var zMCampTracker = extendZodObjectForMongoose(zCampTracker);
|
|
111
113
|
|
|
112
114
|
// src/interface/tracking/classTracker.ts
|
|
113
|
-
import { Types as
|
|
115
|
+
import { Types as Types7 } from "mongoose";
|
|
114
116
|
import { z as z9 } from "zod";
|
|
115
117
|
|
|
116
118
|
// src/interface/payment/invoice.ts
|
|
117
|
-
import { Types as
|
|
119
|
+
import { Types as Types5 } from "mongoose";
|
|
118
120
|
import { z as z7 } from "zod";
|
|
119
121
|
|
|
120
122
|
// src/interface/payment/paymentMethod.ts
|
|
@@ -132,12 +134,12 @@ var zDiscount = z7.object({
|
|
|
132
134
|
amount: z7.number()
|
|
133
135
|
});
|
|
134
136
|
var zInvoiceItem = z7.object({
|
|
135
|
-
course: z7.instanceof(
|
|
137
|
+
course: z7.instanceof(Types5.ObjectId),
|
|
136
138
|
price: z7.number(),
|
|
137
139
|
units: z7.number()
|
|
138
140
|
});
|
|
139
141
|
var zInvoicePackage = z7.object({
|
|
140
|
-
student: z7.instanceof(
|
|
142
|
+
student: z7.instanceof(Types5.ObjectId),
|
|
141
143
|
items: z7.array(zInvoiceItem)
|
|
142
144
|
});
|
|
143
145
|
var zInvoice = z7.object({
|
|
@@ -148,13 +150,13 @@ var zInvoice = z7.object({
|
|
|
148
150
|
shipping: z7.number().int().min(1).optional(),
|
|
149
151
|
paid: z7.nativeEnum(PaymentMethod).optional(),
|
|
150
152
|
notes: z7.string().optional(),
|
|
151
|
-
createdBy: z7.instanceof(
|
|
152
|
-
lastEditBy: z7.instanceof(
|
|
153
|
+
createdBy: z7.instanceof(Types5.ObjectId),
|
|
154
|
+
lastEditBy: z7.instanceof(Types5.ObjectId).optional()
|
|
153
155
|
});
|
|
154
156
|
var zMInvoice = extendZodObjectForMongoose(zInvoice);
|
|
155
157
|
|
|
156
158
|
// src/interface/payment/teacherPayment.ts
|
|
157
|
-
import { Types as
|
|
159
|
+
import { Types as Types6 } from "mongoose";
|
|
158
160
|
import { z as z8 } from "zod";
|
|
159
161
|
var zTeacherPaymentRow = z8.object({
|
|
160
162
|
course: z8.string(),
|
|
@@ -163,7 +165,7 @@ var zTeacherPaymentRow = z8.object({
|
|
|
163
165
|
wage: z8.number()
|
|
164
166
|
});
|
|
165
167
|
var zTeacherPayment = z8.object({
|
|
166
|
-
teacher: z8.instanceof(
|
|
168
|
+
teacher: z8.instanceof(Types6.ObjectId),
|
|
167
169
|
rows: z8.array(zTeacherPaymentRow),
|
|
168
170
|
paid: z8.boolean().optional()
|
|
169
171
|
});
|
|
@@ -171,9 +173,9 @@ var zMTeacherPayment = extendZodObjectForMongoose(zTeacherPayment);
|
|
|
171
173
|
|
|
172
174
|
// src/interface/tracking/classTracker.ts
|
|
173
175
|
var zClassTracker = z9.object({
|
|
174
|
-
course: z9.instanceof(
|
|
175
|
-
teacher: z9.instanceof(
|
|
176
|
-
student: z9.instanceof(
|
|
176
|
+
course: z9.instanceof(Types7.ObjectId),
|
|
177
|
+
teacher: z9.instanceof(Types7.ObjectId),
|
|
178
|
+
student: z9.instanceof(Types7.ObjectId),
|
|
177
179
|
classTimes: z9.array(z9.coerce.date()),
|
|
178
180
|
completedList: z9.array(z9.boolean()),
|
|
179
181
|
/**
|
|
@@ -182,6 +184,7 @@ var zClassTracker = z9.object({
|
|
|
182
184
|
completed: z9.boolean().optional(),
|
|
183
185
|
tuition: zTuition.optional(),
|
|
184
186
|
paid: z9.boolean().optional(),
|
|
187
|
+
paused: z9.boolean().optional(),
|
|
185
188
|
notes: z9.string().optional()
|
|
186
189
|
});
|
|
187
190
|
var zMClassTracker = extendZodObjectForMongoose(zClassTracker);
|
|
@@ -230,11 +233,11 @@ var zCourse = z11.object({
|
|
|
230
233
|
/**
|
|
231
234
|
* @unit SECONDS - Duration of the course in seconds
|
|
232
235
|
*/
|
|
233
|
-
duration: z11.number(),
|
|
236
|
+
duration: z11.number().int("Duration in seconds must be a whole number").min(1, "Duration in seconds must not be less than or equal to 0"),
|
|
234
237
|
/**
|
|
235
238
|
* @unit CENTS - Price of the course in cents
|
|
236
239
|
*/
|
|
237
|
-
price: z11.number(),
|
|
240
|
+
price: z11.number().int("Tuition must be a whole number in cents").min(1, "Tuition must not be less than or equal to 0"),
|
|
238
241
|
description: z11.string().optional(),
|
|
239
242
|
/**
|
|
240
243
|
* NYIG School locations
|
|
@@ -247,20 +250,20 @@ var zCourse = z11.object({
|
|
|
247
250
|
/**
|
|
248
251
|
* Camp tuition for half-day option
|
|
249
252
|
*/
|
|
250
|
-
halfCampTuition: z11.number(),
|
|
253
|
+
halfCampTuition: z11.number().int("Tuition must be a whole number in cents").min(1, "Tuition must not be less than or equal to 0").optional(),
|
|
251
254
|
/**
|
|
252
255
|
* Camp tuition for full-day option
|
|
253
256
|
*/
|
|
254
|
-
fullCampTuition: z11.number()
|
|
257
|
+
fullCampTuition: z11.number().int("Tuition must be a whole number in cents").min(1, "Tuition must not be less than or equal to 0").optional()
|
|
255
258
|
});
|
|
256
259
|
var zMCourse = extendZodObjectForMongoose(zCourse);
|
|
257
260
|
|
|
258
261
|
// src/interface/tracking/groupTracker.ts
|
|
259
|
-
import { Types as
|
|
262
|
+
import { Types as Types8 } from "mongoose";
|
|
260
263
|
var zGroupTracker = z12.object({
|
|
261
|
-
course: z12.instanceof(
|
|
262
|
-
teacher: z12.instanceof(
|
|
263
|
-
semester: z12.instanceof(
|
|
264
|
+
course: z12.instanceof(Types8.ObjectId),
|
|
265
|
+
teacher: z12.instanceof(Types8.ObjectId),
|
|
266
|
+
semester: z12.instanceof(Types8.ObjectId),
|
|
264
267
|
scheduleData: zScheduleData,
|
|
265
268
|
/**
|
|
266
269
|
* occurrences are tracked by week for Groups
|
|
@@ -269,7 +272,7 @@ var zGroupTracker = z12.object({
|
|
|
269
272
|
/**
|
|
270
273
|
* attendances are tracked by week for Groups
|
|
271
274
|
*/
|
|
272
|
-
attendances: z12.array(z12.instanceof(
|
|
275
|
+
attendances: z12.array(z12.instanceof(Types8.ObjectId)),
|
|
273
276
|
/**
|
|
274
277
|
* public-facing ID of the course instance, e.g., 101
|
|
275
278
|
*/
|
|
@@ -288,7 +291,6 @@ var zMGroupTracker = extendZodObjectForMongoose(zGroupTracker);
|
|
|
288
291
|
|
|
289
292
|
// src/interface/booking/campBooking.ts
|
|
290
293
|
var zCampBooking = z13.object({
|
|
291
|
-
userId: z13.string().optional(),
|
|
292
294
|
ctId: z13.string().optional(),
|
|
293
295
|
isOnline: z13.boolean(),
|
|
294
296
|
classDates: z13.string(),
|
|
@@ -298,10 +300,10 @@ var zCampBooking = z13.object({
|
|
|
298
300
|
var zMCampBooking = extendZodObjectForMongoose(zCampBooking);
|
|
299
301
|
|
|
300
302
|
// src/interface/booking/groupBooking.ts
|
|
303
|
+
import { Types as Types9 } from "mongoose";
|
|
301
304
|
import { z as z14 } from "zod";
|
|
302
305
|
var zGroupBooking = z14.object({
|
|
303
|
-
|
|
304
|
-
gtId: z14.string().optional(),
|
|
306
|
+
gtId: z14.instanceof(Types9.ObjectId).optional(),
|
|
305
307
|
isTrial: z14.boolean().optional(),
|
|
306
308
|
isOnline: z14.boolean(),
|
|
307
309
|
classDate: z14.string().optional(),
|
|
@@ -310,11 +312,11 @@ var zGroupBooking = z14.object({
|
|
|
310
312
|
var zMGroupBooking = extendZodObjectForMongoose(zGroupBooking);
|
|
311
313
|
|
|
312
314
|
// src/interface/booking/privateBooking.ts
|
|
315
|
+
import { Types as Types10 } from "mongoose";
|
|
313
316
|
import { z as z15 } from "zod";
|
|
314
317
|
var zPrivateBooking = z15.object({
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
teacherId: z15.string(),
|
|
318
|
+
courseId: z15.instanceof(Types10.ObjectId),
|
|
319
|
+
teacherId: z15.instanceof(Types10.ObjectId),
|
|
318
320
|
classDate: z15.string().optional()
|
|
319
321
|
}).merge(zBUserInfo).merge(zBPaymentInfo);
|
|
320
322
|
var zMPrivateBooking = extendZodObjectForMongoose(zPrivateBooking);
|
|
@@ -346,7 +348,7 @@ var zImageDef = z17.object({
|
|
|
346
348
|
});
|
|
347
349
|
|
|
348
350
|
// src/interface/reporting/reportTicket.ts
|
|
349
|
-
import { Types as
|
|
351
|
+
import { Types as Types11 } from "mongoose";
|
|
350
352
|
import { z as z18 } from "zod";
|
|
351
353
|
|
|
352
354
|
// src/interface/reporting/ticketStatus.ts
|
|
@@ -360,8 +362,8 @@ var TicketStatus = /* @__PURE__ */ ((TicketStatus2) => {
|
|
|
360
362
|
|
|
361
363
|
// src/interface/reporting/reportTicket.ts
|
|
362
364
|
var zReportTicket = z18.object({
|
|
363
|
-
requester: z18.instanceof(
|
|
364
|
-
resolver: z18.instanceof(
|
|
365
|
+
requester: z18.instanceof(Types11.ObjectId),
|
|
366
|
+
resolver: z18.instanceof(Types11.ObjectId),
|
|
365
367
|
status: z18.nativeEnum(TicketStatus),
|
|
366
368
|
title: z18.string(),
|
|
367
369
|
description: z18.string()
|
|
@@ -395,7 +397,7 @@ var zSemester = z19.object({
|
|
|
395
397
|
var zMSemester = extendZodObjectForMongoose(zSemester);
|
|
396
398
|
|
|
397
399
|
// src/interface/tournament/tConfig.ts
|
|
398
|
-
import { Types as
|
|
400
|
+
import { Types as Types12 } from "mongoose";
|
|
399
401
|
import { z as z21 } from "zod";
|
|
400
402
|
|
|
401
403
|
// src/interface/tournament/table.ts
|
|
@@ -458,7 +460,7 @@ var zTConfig = z21.object({
|
|
|
458
460
|
/**
|
|
459
461
|
* List of ticket object IDs for this tournament
|
|
460
462
|
*/
|
|
461
|
-
tickets: z21.array(z21.instanceof(
|
|
463
|
+
tickets: z21.array(z21.instanceof(Types12.ObjectId)),
|
|
462
464
|
/**
|
|
463
465
|
* If false, the tournament registration is closed
|
|
464
466
|
*/
|
|
@@ -475,14 +477,14 @@ var zTConfig = z21.object({
|
|
|
475
477
|
var zMTConfig = extendZodObjectForMongoose(zTConfig);
|
|
476
478
|
|
|
477
479
|
// src/interface/tournament/tReg.ts
|
|
478
|
-
import { Types as
|
|
480
|
+
import { Types as Types14 } from "mongoose";
|
|
479
481
|
import { z as z23 } from "zod";
|
|
480
482
|
|
|
481
483
|
// src/interface/tournament/tTicketReg.ts
|
|
482
484
|
import { z as z22 } from "zod";
|
|
483
|
-
import { Types as
|
|
485
|
+
import { Types as Types13 } from "mongoose";
|
|
484
486
|
var zTTicketReg = z22.object({
|
|
485
|
-
ticket: z22.instanceof(
|
|
487
|
+
ticket: z22.instanceof(Types13.ObjectId),
|
|
486
488
|
/**
|
|
487
489
|
* integer minimum 1, otherwise no ticket is being bought
|
|
488
490
|
*/
|
|
@@ -492,7 +494,7 @@ var zTTicketReg = z22.object({
|
|
|
492
494
|
// src/interface/tournament/tReg.ts
|
|
493
495
|
var zTReg = z23.object({
|
|
494
496
|
agaId: z23.string(),
|
|
495
|
-
tournamentId: z23.instanceof(
|
|
497
|
+
tournamentId: z23.instanceof(Types14.ObjectId),
|
|
496
498
|
tickets: z23.array(zTTicketReg),
|
|
497
499
|
/**
|
|
498
500
|
* @units CENTS - Donation in cents
|
|
@@ -505,7 +507,7 @@ var zTReg = z23.object({
|
|
|
505
507
|
/**
|
|
506
508
|
* Mongoose ID of the admin that edited the registration
|
|
507
509
|
*/
|
|
508
|
-
edited: z23.instanceof(
|
|
510
|
+
edited: z23.instanceof(Types14.ObjectId).optional()
|
|
509
511
|
}).merge(zBUserInfo).merge(zBPaymentInfo);
|
|
510
512
|
var zMTReg = extendZodObjectForMongoose(zTReg);
|
|
511
513
|
|
|
@@ -579,50 +581,46 @@ var GoRank = /* @__PURE__ */ ((GoRank2) => {
|
|
|
579
581
|
})(GoRank || {});
|
|
580
582
|
|
|
581
583
|
// src/interface/user/user.ts
|
|
582
|
-
import { z as z26 } from "zod";
|
|
583
|
-
|
|
584
|
-
// src/interface/user/userRoles.ts
|
|
585
584
|
import { z as z25 } from "zod";
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
birthDate: z26.string().optional()
|
|
585
|
+
import { Types as Types15 } from "mongoose";
|
|
586
|
+
var zUser = z25.object({
|
|
587
|
+
name: z25.string().min(2).max(100),
|
|
588
|
+
username: z25.string().optional(),
|
|
589
|
+
password: z25.string().optional(),
|
|
590
|
+
roles: z25.array(z25.number().int()),
|
|
591
|
+
email: z25.string().email().max(100).optional(),
|
|
592
|
+
address: z25.string().optional(),
|
|
593
|
+
country: z25.string().length(2, {
|
|
594
|
+
message: "Enter the 2-letter country code"
|
|
595
|
+
}).optional(),
|
|
596
|
+
phoneNumber: z25.string().regex(/^\d{10}/, {
|
|
597
|
+
message: `Please enter a valid 10-digit US phone number with numbers only`
|
|
598
|
+
}).optional(),
|
|
599
|
+
birthDate: z25.string().regex(/^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/, {
|
|
600
|
+
message: "Enter a valid date in yyyy-mm-dd format"
|
|
601
|
+
}).optional()
|
|
604
602
|
});
|
|
605
603
|
var zMUser = extendZodObjectForMongoose(zUser);
|
|
606
604
|
var zStudent = zUser.extend({
|
|
607
|
-
rank:
|
|
608
|
-
guardian:
|
|
605
|
+
rank: z25.nativeEnum(GoRank),
|
|
606
|
+
guardian: z25.instanceof(Types15.ObjectId).optional()
|
|
609
607
|
});
|
|
610
608
|
var zMStudent = extendZodObjectForMongoose(zStudent);
|
|
611
609
|
var zTeacher = zUser.extend({
|
|
612
|
-
rank:
|
|
610
|
+
rank: z25.nativeEnum(GoRank),
|
|
613
611
|
/**
|
|
614
612
|
* Inactive teachers are not shown on public endpoints
|
|
615
613
|
*/
|
|
616
|
-
isInactive:
|
|
614
|
+
isInactive: z25.boolean().optional(),
|
|
617
615
|
/**
|
|
618
616
|
* Teacher's position, e.g., instructor, president
|
|
619
617
|
*/
|
|
620
|
-
title:
|
|
618
|
+
title: z25.string().optional(),
|
|
621
619
|
/**
|
|
622
620
|
* Teacher's bio text describing experience
|
|
623
621
|
* new lines will be rendered as paragraphs
|
|
624
622
|
*/
|
|
625
|
-
bio:
|
|
623
|
+
bio: z25.string().optional(),
|
|
626
624
|
/** Format is illustrated below, where teacher is available
|
|
627
625
|
* Mon 9-12am 3-6pm & Tue 10-12am 6-10pm
|
|
628
626
|
* [
|
|
@@ -635,9 +633,17 @@ var zTeacher = zUser.extend({
|
|
|
635
633
|
* [],
|
|
636
634
|
* ]
|
|
637
635
|
*/
|
|
638
|
-
available:
|
|
636
|
+
available: z25.array(z25.array(z25.array(z25.number()))).optional()
|
|
639
637
|
});
|
|
640
638
|
var zMTeacher = extendZodObjectForMongoose(zTeacher);
|
|
639
|
+
|
|
640
|
+
// src/interface/user/userRoles.ts
|
|
641
|
+
import { z as z26 } from "zod";
|
|
642
|
+
var zUserRoles = z26.object({
|
|
643
|
+
user: z26.number().int(),
|
|
644
|
+
admin: z26.number().int(),
|
|
645
|
+
superadmin: z26.number().int()
|
|
646
|
+
});
|
|
641
647
|
export {
|
|
642
648
|
AgeGroup,
|
|
643
649
|
AttendState,
|