@nyig/models 0.2.26 → 0.2.29

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.
Files changed (6) hide show
  1. package/README.md +1 -1
  2. package/index.d.mts +422 -726
  3. package/index.d.ts +422 -726
  4. package/index.js +107 -138
  5. package/index.mjs +91 -118
  6. package/package.json +1 -2
package/index.mjs CHANGED
@@ -18,10 +18,9 @@ var zBPaymentInfo = z.object({
18
18
  });
19
19
 
20
20
  // src/interface/booking/bUserInfo.ts
21
- import { Types } from "mongoose";
22
21
  import { z as z2 } from "zod";
23
22
  var zBUserInfo = z2.object({
24
- userId: z2.instanceof(Types.ObjectId).or(z2.string()).optional(),
23
+ userId: z2.string().optional(),
25
24
  firstName: z2.string(),
26
25
  lastName: z2.string(),
27
26
  rank: z2.string(),
@@ -43,17 +42,6 @@ var BookingType = /* @__PURE__ */ ((BookingType2) => {
43
42
  // src/interface/booking/campBooking.ts
44
43
  import { z as z13 } from "zod";
45
44
 
46
- // src/interface/mongoose/mongoose.ts
47
- import { z as z3 } from "zod";
48
- import { Types as Types2 } from "mongoose";
49
- function extendZodObjectForMongoose(original, isIdString) {
50
- return original.extend({
51
- _id: !isIdString ? z3.instanceof(Types2.ObjectId).or(z3.string()) : z3.string(),
52
- createdAt: z3.coerce.date().optional(),
53
- updatedAt: z3.coerce.date().optional()
54
- });
55
- }
56
-
57
45
  // src/interface/tracking/attendState.ts
58
46
  var AttendState = /* @__PURE__ */ ((AttendState2) => {
59
47
  AttendState2["ABSENT"] = "absent";
@@ -63,15 +51,14 @@ var AttendState = /* @__PURE__ */ ((AttendState2) => {
63
51
  })(AttendState || {});
64
52
 
65
53
  // src/interface/tracking/attendance.ts
66
- import { Types as Types3 } from "mongoose";
67
54
  import { z as z5 } from "zod";
68
55
 
69
56
  // src/interface/payment/tuition.ts
70
- import { z as z4 } from "zod";
71
- var zTuition = z4.object({
72
- primary: z4.number().int().min(1),
73
- textbook: z4.boolean().optional(),
74
- shipping: z4.boolean().optional()
57
+ import { z as z3 } from "zod";
58
+ var zTuition = z3.object({
59
+ primary: z3.number().int().min(1),
60
+ textbook: z3.boolean().optional(),
61
+ shipping: z3.boolean().optional()
75
62
  });
76
63
 
77
64
  // src/interface/tracking/campOption.ts
@@ -82,23 +69,33 @@ var CampOption = /* @__PURE__ */ ((CampOption2) => {
82
69
  return CampOption2;
83
70
  })(CampOption || {});
84
71
 
72
+ // src/interface/addAutoProps.ts
73
+ import { z as z4 } from "zod";
74
+ function addAutoProps(original) {
75
+ return original.extend({
76
+ _id: z4.string(),
77
+ editedBy: z4.string(),
78
+ createdAt: z4.coerce.date().optional(),
79
+ updatedAt: z4.coerce.date().optional()
80
+ });
81
+ }
82
+
85
83
  // src/interface/tracking/attendance.ts
86
- var zAttendance = z5.object({
87
- student: z5.instanceof(Types3.ObjectId).or(z5.string()),
84
+ var zBAttendance = z5.object({
85
+ student: z5.string(),
88
86
  states: z5.array(z5.nativeEnum(AttendState)),
89
87
  tuition: zTuition,
90
88
  paid: z5.boolean().optional(),
91
89
  campOption: z5.nativeEnum(CampOption)
92
90
  });
93
- var zMAttendance = extendZodObjectForMongoose(zAttendance);
91
+ var zAttendance = addAutoProps(zBAttendance);
94
92
 
95
93
  // src/interface/tracking/campTracker.ts
96
- import { Types as Types4 } from "mongoose";
97
94
  import { z as z6 } from "zod";
98
- var zCampTracker = z6.object({
99
- course: z6.instanceof(Types4.ObjectId).or(z6.string()),
100
- teacher: z6.instanceof(Types4.ObjectId).or(z6.string()),
101
- semester: z6.instanceof(Types4.ObjectId).or(z6.string()),
95
+ var zBCampTracker = z6.object({
96
+ course: z6.string(),
97
+ teacher: z6.string(),
98
+ semester: z6.string(),
102
99
  /**
103
100
  * occurrences are tracked by week for camps
104
101
  */
@@ -109,14 +106,12 @@ var zCampTracker = z6.object({
109
106
  attendances: z6.array(z6.string()),
110
107
  notes: z6.string().optional()
111
108
  });
112
- var zMCampTracker = extendZodObjectForMongoose(zCampTracker);
109
+ var zCampTracker = addAutoProps(zBCampTracker);
113
110
 
114
111
  // src/interface/tracking/classTracker.ts
115
- import { Types as Types7 } from "mongoose";
116
112
  import { z as z9 } from "zod";
117
113
 
118
114
  // src/interface/payment/invoice.ts
119
- import { Types as Types5 } from "mongoose";
120
115
  import { z as z7 } from "zod";
121
116
 
122
117
  // src/interface/payment/paymentMethod.ts
@@ -139,10 +134,10 @@ var zInvoiceItem = z7.object({
139
134
  units: z7.number()
140
135
  });
141
136
  var zInvoicePackage = z7.object({
142
- student: z7.instanceof(Types5.ObjectId).or(z7.string()),
137
+ student: z7.string(),
143
138
  items: z7.array(zInvoiceItem).min(1, "Package must contain at least one item")
144
139
  });
145
- var zInvoice = z7.object({
140
+ var zBInvoice = z7.object({
146
141
  billTo: z7.string().min(1, "The 'Bill To' field must not be empty"),
147
142
  packages: z7.array(zInvoicePackage).min(1, "Invoice must include at least one package"),
148
143
  discounts: z7.array(zDiscount),
@@ -150,13 +145,11 @@ var zInvoice = z7.object({
150
145
  shipping: z7.number().int().min(0).optional(),
151
146
  paid: z7.nativeEnum(PaymentMethod).optional(),
152
147
  notes: z7.string().optional(),
153
- createdBy: z7.instanceof(Types5.ObjectId).or(z7.string()),
154
- lastEditBy: z7.instanceof(Types5.ObjectId).or(z7.string()).optional()
148
+ createdBy: z7.string()
155
149
  });
156
- var zMInvoice = extendZodObjectForMongoose(zInvoice);
150
+ var zInvoice = addAutoProps(zBInvoice);
157
151
 
158
152
  // src/interface/payment/teacherPayment.ts
159
- import { Types as Types6 } from "mongoose";
160
153
  import { z as z8 } from "zod";
161
154
  var zTeacherPaymentRow = z8.object({
162
155
  course: z8.string(),
@@ -164,18 +157,18 @@ var zTeacherPaymentRow = z8.object({
164
157
  count: z8.number(),
165
158
  wage: z8.number()
166
159
  });
167
- var zTeacherPayment = z8.object({
168
- teacher: z8.instanceof(Types6.ObjectId).or(z8.string()),
160
+ var zBTeacherPayment = z8.object({
161
+ teacher: z8.string(),
169
162
  rows: z8.array(zTeacherPaymentRow),
170
163
  paid: z8.boolean().optional()
171
164
  });
172
- var zMTeacherPayment = extendZodObjectForMongoose(zTeacherPayment);
165
+ var zTeacherPayment = addAutoProps(zBTeacherPayment);
173
166
 
174
167
  // src/interface/tracking/classTracker.ts
175
- var zClassTracker = z9.object({
176
- course: z9.instanceof(Types7.ObjectId).or(z9.string()),
177
- teacher: z9.instanceof(Types7.ObjectId).or(z9.string()),
178
- student: z9.instanceof(Types7.ObjectId).or(z9.string()),
168
+ var zBClassTracker = z9.object({
169
+ course: z9.string(),
170
+ teacher: z9.string(),
171
+ student: z9.string(),
179
172
  classTimes: z9.array(z9.coerce.date()),
180
173
  completedList: z9.array(z9.boolean()),
181
174
  /**
@@ -187,7 +180,7 @@ var zClassTracker = z9.object({
187
180
  paused: z9.boolean().optional(),
188
181
  notes: z9.string().optional()
189
182
  });
190
- var zMClassTracker = extendZodObjectForMongoose(zClassTracker);
183
+ var zClassTracker = addAutoProps(zBClassTracker);
191
184
 
192
185
  // src/interface/tracking/groupTracker.ts
193
186
  import { z as z12 } from "zod";
@@ -227,7 +220,7 @@ var NYIGSchool = /* @__PURE__ */ ((NYIGSchool2) => {
227
220
 
228
221
  // src/interface/course/course.ts
229
222
  import { z as z11 } from "zod";
230
- var zCourse = z11.object({
223
+ var zBCourse = z11.object({
231
224
  name: z11.string(),
232
225
  category: z11.nativeEnum(CourseCategory),
233
226
  /**
@@ -256,14 +249,13 @@ var zCourse = z11.object({
256
249
  */
257
250
  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()
258
251
  });
259
- var zMCourse = extendZodObjectForMongoose(zCourse);
252
+ var zCourse = addAutoProps(zBCourse);
260
253
 
261
254
  // src/interface/tracking/groupTracker.ts
262
- import { Types as Types8 } from "mongoose";
263
- var zGroupTracker = z12.object({
264
- course: z12.instanceof(Types8.ObjectId).or(z12.string()),
265
- teacher: z12.instanceof(Types8.ObjectId).or(z12.string()),
266
- semester: z12.instanceof(Types8.ObjectId).or(z12.string()),
255
+ var zBGroupTracker = z12.object({
256
+ course: z12.string(),
257
+ teacher: z12.string(),
258
+ semester: z12.string(),
267
259
  scheduleData: zScheduleData,
268
260
  /**
269
261
  * occurrences are tracked by week for Groups
@@ -272,7 +264,7 @@ var zGroupTracker = z12.object({
272
264
  /**
273
265
  * attendances are tracked by week for Groups
274
266
  */
275
- attendances: z12.array(z12.instanceof(Types8.ObjectId)),
267
+ attendances: z12.array(z12.string()),
276
268
  /**
277
269
  * public-facing ID of the course instance, e.g., 101
278
270
  */
@@ -287,39 +279,37 @@ var zGroupTracker = z12.object({
287
279
  isNonPublic: z12.boolean().optional(),
288
280
  notes: z12.string().optional()
289
281
  });
290
- var zMGroupTracker = extendZodObjectForMongoose(zGroupTracker);
282
+ var zGroupTracker = addAutoProps(zBGroupTracker);
291
283
 
292
284
  // src/interface/booking/campBooking.ts
293
- var zCampBooking = z13.object({
285
+ var zBCampBooking = z13.object({
294
286
  ctId: z13.string().optional(),
295
287
  isOnline: z13.boolean(),
296
288
  classDates: z13.string(),
297
289
  campOption: z13.nativeEnum(CampOption),
298
290
  shipping: z13.boolean().optional()
299
291
  }).merge(zBUserInfo).merge(zBPaymentInfo);
300
- var zMCampBooking = extendZodObjectForMongoose(zCampBooking);
292
+ var zCampBooking = addAutoProps(zBCampBooking);
301
293
 
302
294
  // src/interface/booking/groupBooking.ts
303
- import { Types as Types9 } from "mongoose";
304
295
  import { z as z14 } from "zod";
305
- var zGroupBooking = z14.object({
306
- gtId: z14.instanceof(Types9.ObjectId).or(z14.string()).optional(),
296
+ var zBGroupBooking = z14.object({
297
+ gtId: z14.string().optional(),
307
298
  isTrial: z14.boolean().optional(),
308
299
  isOnline: z14.boolean(),
309
300
  classDate: z14.string().optional(),
310
301
  shipping: z14.boolean().optional()
311
302
  }).merge(zBUserInfo).merge(zBPaymentInfo);
312
- var zMGroupBooking = extendZodObjectForMongoose(zGroupBooking);
303
+ var zGroupBooking = addAutoProps(zBGroupBooking);
313
304
 
314
305
  // src/interface/booking/privateBooking.ts
315
- import { Types as Types10 } from "mongoose";
316
306
  import { z as z15 } from "zod";
317
- var zPrivateBooking = z15.object({
318
- courseId: z15.instanceof(Types10.ObjectId).or(z15.string()),
319
- teacherId: z15.instanceof(Types10.ObjectId).or(z15.string()),
307
+ var zBPrivateBooking = z15.object({
308
+ courseId: z15.string(),
309
+ teacherId: z15.string(),
320
310
  classDate: z15.string().optional()
321
311
  }).merge(zBUserInfo).merge(zBPaymentInfo);
322
- var zMPrivateBooking = extendZodObjectForMongoose(zPrivateBooking);
312
+ var zPrivateBooking = addAutoProps(zBPrivateBooking);
323
313
 
324
314
  // src/interface/public/aurora.ts
325
315
  import { z as z16 } from "zod";
@@ -348,7 +338,6 @@ var zImageDef = z17.object({
348
338
  });
349
339
 
350
340
  // src/interface/reporting/reportTicket.ts
351
- import { Types as Types11 } from "mongoose";
352
341
  import { z as z18 } from "zod";
353
342
 
354
343
  // src/interface/reporting/ticketStatus.ts
@@ -361,14 +350,14 @@ var TicketStatus = /* @__PURE__ */ ((TicketStatus2) => {
361
350
  })(TicketStatus || {});
362
351
 
363
352
  // src/interface/reporting/reportTicket.ts
364
- var zReportTicket = z18.object({
365
- requester: z18.instanceof(Types11.ObjectId).or(z18.string()),
366
- resolver: z18.instanceof(Types11.ObjectId).or(z18.string()).optional(),
353
+ var zBReportTicket = z18.object({
354
+ requester: z18.string(),
355
+ resolver: z18.string().optional(),
367
356
  status: z18.nativeEnum(TicketStatus),
368
357
  title: z18.string(),
369
358
  description: z18.string()
370
359
  });
371
- var zMReportTicket = extendZodObjectForMongoose(zReportTicket);
360
+ var zReportTicket = addAutoProps(zBReportTicket);
372
361
 
373
362
  // src/interface/semester/season.ts
374
363
  var Season = /* @__PURE__ */ ((Season2) => {
@@ -380,7 +369,7 @@ var Season = /* @__PURE__ */ ((Season2) => {
380
369
 
381
370
  // src/interface/semester/semester.ts
382
371
  import { z as z19 } from "zod";
383
- var zSemester = z19.object({
372
+ var zBSemester = z19.object({
384
373
  season: z19.nativeEnum(Season),
385
374
  year: z19.number().min(2022).max(2999),
386
375
  startDate: z19.coerce.date(),
@@ -394,15 +383,14 @@ var zSemester = z19.object({
394
383
  */
395
384
  importantDates: z19.array(z19.string())
396
385
  });
397
- var zMSemester = extendZodObjectForMongoose(zSemester);
386
+ var zSemester = addAutoProps(zBSemester);
398
387
 
399
388
  // src/interface/event/eConfig.ts
400
- import { Types as Types12 } from "mongoose";
401
389
  import { z as z22 } from "zod";
402
390
 
403
391
  // src/interface/event/eTicket.ts
404
392
  import { z as z20 } from "zod";
405
- var zEventTicket = z20.object({
393
+ var zBEventTicket = z20.object({
406
394
  name: z20.string().min(5, "Name must be at least 5 characters"),
407
395
  /**
408
396
  * Price in cents
@@ -421,7 +409,7 @@ var zEventTicket = z20.object({
421
409
  */
422
410
  lastBuyableDate: z20.coerce.date().optional()
423
411
  });
424
- var zMEventTicket = extendZodObjectForMongoose(zEventTicket);
412
+ var zEventTicket = addAutoProps(zBEventTicket);
425
413
 
426
414
  // src/interface/event/table.ts
427
415
  import { z as z21 } from "zod";
@@ -436,7 +424,7 @@ var zScheduleTable = z21.object({
436
424
  });
437
425
 
438
426
  // src/interface/event/eConfig.ts
439
- var zEventConfig = z22.object({
427
+ var zBEventConfig = z22.object({
440
428
  /**
441
429
  * Location of the event
442
430
  */
@@ -483,7 +471,7 @@ var zEventConfig = z22.object({
483
471
  /**
484
472
  * List of ticket object IDs for this tournament
485
473
  */
486
- tickets: z22.array(z22.instanceof(Types12.ObjectId).or(z22.string())),
474
+ tickets: z22.array(z22.string()),
487
475
  /**
488
476
  * If false, the tournament registration is closed
489
477
  */
@@ -497,34 +485,31 @@ var zEventConfig = z22.object({
497
485
  */
498
486
  image: zImageDef.optional()
499
487
  });
488
+ var zEventConfig = addAutoProps(zBEventConfig);
500
489
  var zEventConfigResponse = zEventConfig.extend({
501
- tickets: z22.array(zMEventTicket)
490
+ tickets: z22.array(zEventTicket)
502
491
  });
503
- var zMEventConfig = extendZodObjectForMongoose(zEventConfig);
504
- var zMTConfigResponse = extendZodObjectForMongoose(zEventConfigResponse, true);
505
492
 
506
493
  // src/interface/event/eReg.ts
507
- import { Types as Types14 } from "mongoose";
508
494
  import { z as z24 } from "zod";
509
495
 
510
496
  // src/interface/event/eTicketReg.ts
511
497
  import { z as z23 } from "zod";
512
- import { Types as Types13 } from "mongoose";
513
498
  var zEventTicketReg = z23.object({
514
- ticket: z23.instanceof(Types13.ObjectId).or(z23.string()),
499
+ ticket: z23.string(),
515
500
  /**
516
501
  * integer minimum 1, otherwise no ticket is being bought
517
502
  */
518
503
  amount: z23.number().int().min(1)
519
504
  });
520
505
  var zEventTicketRegResponse = zEventTicketReg.extend({
521
- ticket: zMEventTicket
506
+ ticket: zEventTicket
522
507
  });
523
508
 
524
509
  // src/interface/event/eReg.ts
525
- var zEventReg = z24.object({
510
+ var zBEventReg = z24.object({
526
511
  agaId: z24.string(),
527
- tournamentId: z24.instanceof(Types14.ObjectId).or(z24.string()),
512
+ tournamentId: z24.string(),
528
513
  tickets: z24.array(zEventTicketReg),
529
514
  /**
530
515
  * @units CENTS - Donation in cents
@@ -533,17 +518,12 @@ var zEventReg = z24.object({
533
518
  /**
534
519
  * How the registration was created, namely through public endpoint or admin
535
520
  */
536
- createMethod: z24.string().optional(),
537
- /**
538
- * Mongoose ID of the admin that edited the registration
539
- */
540
- edited: z24.instanceof(Types14.ObjectId).optional()
521
+ createMethod: z24.string().optional()
541
522
  }).merge(zBUserInfo).merge(zBPaymentInfo);
523
+ var zEventReg = addAutoProps(zBEventReg);
542
524
  var zEventRegResponse = zEventReg.extend({
543
525
  tickets: z24.array(zEventTicketRegResponse)
544
526
  });
545
- var zMEventReg = extendZodObjectForMongoose(zEventReg);
546
- var zMEventRegResponse = extendZodObjectForMongoose(zEventRegResponse, true);
547
527
 
548
528
  // src/interface/user/goRank.ts
549
529
  var GoRank = /* @__PURE__ */ ((GoRank2) => {
@@ -593,8 +573,7 @@ var GoRank = /* @__PURE__ */ ((GoRank2) => {
593
573
 
594
574
  // src/interface/user/user.ts
595
575
  import { z as z25 } from "zod";
596
- import { Types as Types15 } from "mongoose";
597
- var zUser = z25.object({
576
+ var zBUser = z25.object({
598
577
  name: z25.string().min(2).max(100),
599
578
  username: z25.string().optional(),
600
579
  password: z25.string().optional(),
@@ -611,12 +590,11 @@ var zUser = z25.object({
611
590
  message: "Enter a valid date in yyyy-mm-dd format"
612
591
  }).optional()
613
592
  });
614
- var zMUser = extendZodObjectForMongoose(zUser);
593
+ var zUser = addAutoProps(zBUser);
615
594
  var zStudent = zUser.extend({
616
595
  rank: z25.nativeEnum(GoRank),
617
- guardian: z25.instanceof(Types15.ObjectId).optional()
596
+ guardian: z25.string().optional()
618
597
  });
619
- var zMStudent = extendZodObjectForMongoose(zStudent);
620
598
  var zTeacher = zUser.extend({
621
599
  rank: z25.nativeEnum(GoRank),
622
600
  /**
@@ -646,7 +624,6 @@ var zTeacher = zUser.extend({
646
624
  */
647
625
  available: z25.array(z25.array(z25.array(z25.number()))).optional()
648
626
  });
649
- var zMTeacher = extendZodObjectForMongoose(zTeacher);
650
627
 
651
628
  // src/interface/user/userRoles.ts
652
629
  import { z as z26 } from "zod";
@@ -667,7 +644,23 @@ export {
667
644
  Season,
668
645
  TicketStatus,
669
646
  zAttendance,
647
+ zBAttendance,
648
+ zBCampBooking,
649
+ zBCampTracker,
650
+ zBClassTracker,
651
+ zBCourse,
652
+ zBEventConfig,
653
+ zBEventReg,
654
+ zBEventTicket,
655
+ zBGroupBooking,
656
+ zBGroupTracker,
657
+ zBInvoice,
670
658
  zBPaymentInfo,
659
+ zBPrivateBooking,
660
+ zBReportTicket,
661
+ zBSemester,
662
+ zBTeacherPayment,
663
+ zBUser,
671
664
  zBUserInfo,
672
665
  zCampBooking,
673
666
  zCampTracker,
@@ -689,26 +682,6 @@ export {
689
682
  zInvoice,
690
683
  zInvoiceItem,
691
684
  zInvoicePackage,
692
- zMAttendance,
693
- zMCampBooking,
694
- zMCampTracker,
695
- zMClassTracker,
696
- zMCourse,
697
- zMEventConfig,
698
- zMEventReg,
699
- zMEventRegResponse,
700
- zMEventTicket,
701
- zMGroupBooking,
702
- zMGroupTracker,
703
- zMInvoice,
704
- zMPrivateBooking,
705
- zMReportTicket,
706
- zMSemester,
707
- zMStudent,
708
- zMTConfigResponse,
709
- zMTeacher,
710
- zMTeacherPayment,
711
- zMUser,
712
685
  zPrivateBooking,
713
686
  zReportTicket,
714
687
  zScheduleData,
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@nyig/models",
3
- "version": "0.2.26",
3
+ "version": "0.2.29",
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",
10
9
  "zod": ">=3.22.4"
11
10
  },
12
11
  "devDependencies": {