@nyig/models 0.2.27 → 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 +409 -742
  3. package/index.d.ts +409 -742
  4. package/index.js +107 -148
  5. package/index.mjs +91 -127
  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,24 +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 addMongooseProps(original) {
50
- return original.extend({
51
- _id: z3.instanceof(Types2.ObjectId).or(z3.string()),
52
- createdAt: z3.coerce.date().optional(),
53
- updatedAt: z3.coerce.date().optional()
54
- });
55
- }
56
- function addMongoosePropsToResponse(original) {
57
- return original.extend({
58
- _id: z3.string(),
59
- createdAt: z3.coerce.date().optional(),
60
- updatedAt: z3.coerce.date().optional()
61
- });
62
- }
63
-
64
45
  // src/interface/tracking/attendState.ts
65
46
  var AttendState = /* @__PURE__ */ ((AttendState2) => {
66
47
  AttendState2["ABSENT"] = "absent";
@@ -70,15 +51,14 @@ var AttendState = /* @__PURE__ */ ((AttendState2) => {
70
51
  })(AttendState || {});
71
52
 
72
53
  // src/interface/tracking/attendance.ts
73
- import { Types as Types3 } from "mongoose";
74
54
  import { z as z5 } from "zod";
75
55
 
76
56
  // src/interface/payment/tuition.ts
77
- import { z as z4 } from "zod";
78
- var zTuition = z4.object({
79
- primary: z4.number().int().min(1),
80
- textbook: z4.boolean().optional(),
81
- 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()
82
62
  });
83
63
 
84
64
  // src/interface/tracking/campOption.ts
@@ -89,23 +69,33 @@ var CampOption = /* @__PURE__ */ ((CampOption2) => {
89
69
  return CampOption2;
90
70
  })(CampOption || {});
91
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
+
92
83
  // src/interface/tracking/attendance.ts
93
- var zAttendance = z5.object({
94
- student: z5.instanceof(Types3.ObjectId).or(z5.string()),
84
+ var zBAttendance = z5.object({
85
+ student: z5.string(),
95
86
  states: z5.array(z5.nativeEnum(AttendState)),
96
87
  tuition: zTuition,
97
88
  paid: z5.boolean().optional(),
98
89
  campOption: z5.nativeEnum(CampOption)
99
90
  });
100
- var zMAttendance = addMongooseProps(zAttendance);
91
+ var zAttendance = addAutoProps(zBAttendance);
101
92
 
102
93
  // src/interface/tracking/campTracker.ts
103
- import { Types as Types4 } from "mongoose";
104
94
  import { z as z6 } from "zod";
105
- var zCampTracker = z6.object({
106
- course: z6.instanceof(Types4.ObjectId).or(z6.string()),
107
- teacher: z6.instanceof(Types4.ObjectId).or(z6.string()),
108
- 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(),
109
99
  /**
110
100
  * occurrences are tracked by week for camps
111
101
  */
@@ -116,14 +106,12 @@ var zCampTracker = z6.object({
116
106
  attendances: z6.array(z6.string()),
117
107
  notes: z6.string().optional()
118
108
  });
119
- var zMCampTracker = addMongooseProps(zCampTracker);
109
+ var zCampTracker = addAutoProps(zBCampTracker);
120
110
 
121
111
  // src/interface/tracking/classTracker.ts
122
- import { Types as Types7 } from "mongoose";
123
112
  import { z as z9 } from "zod";
124
113
 
125
114
  // src/interface/payment/invoice.ts
126
- import { Types as Types5 } from "mongoose";
127
115
  import { z as z7 } from "zod";
128
116
 
129
117
  // src/interface/payment/paymentMethod.ts
@@ -146,10 +134,10 @@ var zInvoiceItem = z7.object({
146
134
  units: z7.number()
147
135
  });
148
136
  var zInvoicePackage = z7.object({
149
- student: z7.instanceof(Types5.ObjectId).or(z7.string()),
137
+ student: z7.string(),
150
138
  items: z7.array(zInvoiceItem).min(1, "Package must contain at least one item")
151
139
  });
152
- var zInvoice = z7.object({
140
+ var zBInvoice = z7.object({
153
141
  billTo: z7.string().min(1, "The 'Bill To' field must not be empty"),
154
142
  packages: z7.array(zInvoicePackage).min(1, "Invoice must include at least one package"),
155
143
  discounts: z7.array(zDiscount),
@@ -157,13 +145,11 @@ var zInvoice = z7.object({
157
145
  shipping: z7.number().int().min(0).optional(),
158
146
  paid: z7.nativeEnum(PaymentMethod).optional(),
159
147
  notes: z7.string().optional(),
160
- createdBy: z7.instanceof(Types5.ObjectId).or(z7.string()),
161
- lastEditBy: z7.instanceof(Types5.ObjectId).or(z7.string()).optional()
148
+ createdBy: z7.string()
162
149
  });
163
- var zMInvoice = addMongooseProps(zInvoice);
150
+ var zInvoice = addAutoProps(zBInvoice);
164
151
 
165
152
  // src/interface/payment/teacherPayment.ts
166
- import { Types as Types6 } from "mongoose";
167
153
  import { z as z8 } from "zod";
168
154
  var zTeacherPaymentRow = z8.object({
169
155
  course: z8.string(),
@@ -171,18 +157,18 @@ var zTeacherPaymentRow = z8.object({
171
157
  count: z8.number(),
172
158
  wage: z8.number()
173
159
  });
174
- var zTeacherPayment = z8.object({
175
- teacher: z8.instanceof(Types6.ObjectId).or(z8.string()),
160
+ var zBTeacherPayment = z8.object({
161
+ teacher: z8.string(),
176
162
  rows: z8.array(zTeacherPaymentRow),
177
163
  paid: z8.boolean().optional()
178
164
  });
179
- var zMTeacherPayment = addMongooseProps(zTeacherPayment);
165
+ var zTeacherPayment = addAutoProps(zBTeacherPayment);
180
166
 
181
167
  // src/interface/tracking/classTracker.ts
182
- var zClassTracker = z9.object({
183
- course: z9.instanceof(Types7.ObjectId).or(z9.string()),
184
- teacher: z9.instanceof(Types7.ObjectId).or(z9.string()),
185
- 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(),
186
172
  classTimes: z9.array(z9.coerce.date()),
187
173
  completedList: z9.array(z9.boolean()),
188
174
  /**
@@ -194,7 +180,7 @@ var zClassTracker = z9.object({
194
180
  paused: z9.boolean().optional(),
195
181
  notes: z9.string().optional()
196
182
  });
197
- var zMClassTracker = addMongooseProps(zClassTracker);
183
+ var zClassTracker = addAutoProps(zBClassTracker);
198
184
 
199
185
  // src/interface/tracking/groupTracker.ts
200
186
  import { z as z12 } from "zod";
@@ -234,7 +220,7 @@ var NYIGSchool = /* @__PURE__ */ ((NYIGSchool2) => {
234
220
 
235
221
  // src/interface/course/course.ts
236
222
  import { z as z11 } from "zod";
237
- var zCourse = z11.object({
223
+ var zBCourse = z11.object({
238
224
  name: z11.string(),
239
225
  category: z11.nativeEnum(CourseCategory),
240
226
  /**
@@ -263,14 +249,13 @@ var zCourse = z11.object({
263
249
  */
264
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()
265
251
  });
266
- var zMCourse = addMongooseProps(zCourse);
252
+ var zCourse = addAutoProps(zBCourse);
267
253
 
268
254
  // src/interface/tracking/groupTracker.ts
269
- import { Types as Types8 } from "mongoose";
270
- var zGroupTracker = z12.object({
271
- course: z12.instanceof(Types8.ObjectId).or(z12.string()),
272
- teacher: z12.instanceof(Types8.ObjectId).or(z12.string()),
273
- 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(),
274
259
  scheduleData: zScheduleData,
275
260
  /**
276
261
  * occurrences are tracked by week for Groups
@@ -279,7 +264,7 @@ var zGroupTracker = z12.object({
279
264
  /**
280
265
  * attendances are tracked by week for Groups
281
266
  */
282
- attendances: z12.array(z12.instanceof(Types8.ObjectId)),
267
+ attendances: z12.array(z12.string()),
283
268
  /**
284
269
  * public-facing ID of the course instance, e.g., 101
285
270
  */
@@ -294,39 +279,37 @@ var zGroupTracker = z12.object({
294
279
  isNonPublic: z12.boolean().optional(),
295
280
  notes: z12.string().optional()
296
281
  });
297
- var zMGroupTracker = addMongooseProps(zGroupTracker);
282
+ var zGroupTracker = addAutoProps(zBGroupTracker);
298
283
 
299
284
  // src/interface/booking/campBooking.ts
300
- var zCampBooking = z13.object({
285
+ var zBCampBooking = z13.object({
301
286
  ctId: z13.string().optional(),
302
287
  isOnline: z13.boolean(),
303
288
  classDates: z13.string(),
304
289
  campOption: z13.nativeEnum(CampOption),
305
290
  shipping: z13.boolean().optional()
306
291
  }).merge(zBUserInfo).merge(zBPaymentInfo);
307
- var zMCampBooking = addMongooseProps(zCampBooking);
292
+ var zCampBooking = addAutoProps(zBCampBooking);
308
293
 
309
294
  // src/interface/booking/groupBooking.ts
310
- import { Types as Types9 } from "mongoose";
311
295
  import { z as z14 } from "zod";
312
- var zGroupBooking = z14.object({
313
- gtId: z14.instanceof(Types9.ObjectId).or(z14.string()).optional(),
296
+ var zBGroupBooking = z14.object({
297
+ gtId: z14.string().optional(),
314
298
  isTrial: z14.boolean().optional(),
315
299
  isOnline: z14.boolean(),
316
300
  classDate: z14.string().optional(),
317
301
  shipping: z14.boolean().optional()
318
302
  }).merge(zBUserInfo).merge(zBPaymentInfo);
319
- var zMGroupBooking = addMongooseProps(zGroupBooking);
303
+ var zGroupBooking = addAutoProps(zBGroupBooking);
320
304
 
321
305
  // src/interface/booking/privateBooking.ts
322
- import { Types as Types10 } from "mongoose";
323
306
  import { z as z15 } from "zod";
324
- var zPrivateBooking = z15.object({
325
- courseId: z15.instanceof(Types10.ObjectId).or(z15.string()),
326
- teacherId: z15.instanceof(Types10.ObjectId).or(z15.string()),
307
+ var zBPrivateBooking = z15.object({
308
+ courseId: z15.string(),
309
+ teacherId: z15.string(),
327
310
  classDate: z15.string().optional()
328
311
  }).merge(zBUserInfo).merge(zBPaymentInfo);
329
- var zMPrivateBooking = addMongooseProps(zPrivateBooking);
312
+ var zPrivateBooking = addAutoProps(zBPrivateBooking);
330
313
 
331
314
  // src/interface/public/aurora.ts
332
315
  import { z as z16 } from "zod";
@@ -355,7 +338,6 @@ var zImageDef = z17.object({
355
338
  });
356
339
 
357
340
  // src/interface/reporting/reportTicket.ts
358
- import { Types as Types11 } from "mongoose";
359
341
  import { z as z18 } from "zod";
360
342
 
361
343
  // src/interface/reporting/ticketStatus.ts
@@ -368,14 +350,14 @@ var TicketStatus = /* @__PURE__ */ ((TicketStatus2) => {
368
350
  })(TicketStatus || {});
369
351
 
370
352
  // src/interface/reporting/reportTicket.ts
371
- var zReportTicket = z18.object({
372
- requester: z18.instanceof(Types11.ObjectId).or(z18.string()),
373
- resolver: z18.instanceof(Types11.ObjectId).or(z18.string()).optional(),
353
+ var zBReportTicket = z18.object({
354
+ requester: z18.string(),
355
+ resolver: z18.string().optional(),
374
356
  status: z18.nativeEnum(TicketStatus),
375
357
  title: z18.string(),
376
358
  description: z18.string()
377
359
  });
378
- var zMReportTicket = addMongooseProps(zReportTicket);
360
+ var zReportTicket = addAutoProps(zBReportTicket);
379
361
 
380
362
  // src/interface/semester/season.ts
381
363
  var Season = /* @__PURE__ */ ((Season2) => {
@@ -387,7 +369,7 @@ var Season = /* @__PURE__ */ ((Season2) => {
387
369
 
388
370
  // src/interface/semester/semester.ts
389
371
  import { z as z19 } from "zod";
390
- var zSemester = z19.object({
372
+ var zBSemester = z19.object({
391
373
  season: z19.nativeEnum(Season),
392
374
  year: z19.number().min(2022).max(2999),
393
375
  startDate: z19.coerce.date(),
@@ -401,15 +383,14 @@ var zSemester = z19.object({
401
383
  */
402
384
  importantDates: z19.array(z19.string())
403
385
  });
404
- var zMSemester = addMongooseProps(zSemester);
386
+ var zSemester = addAutoProps(zBSemester);
405
387
 
406
388
  // src/interface/event/eConfig.ts
407
- import { Types as Types12 } from "mongoose";
408
389
  import { z as z22 } from "zod";
409
390
 
410
391
  // src/interface/event/eTicket.ts
411
392
  import { z as z20 } from "zod";
412
- var zEventTicket = z20.object({
393
+ var zBEventTicket = z20.object({
413
394
  name: z20.string().min(5, "Name must be at least 5 characters"),
414
395
  /**
415
396
  * Price in cents
@@ -428,8 +409,7 @@ var zEventTicket = z20.object({
428
409
  */
429
410
  lastBuyableDate: z20.coerce.date().optional()
430
411
  });
431
- var zMEventTicket = addMongooseProps(zEventTicket);
432
- var zMEventTicketResponse = addMongoosePropsToResponse(zEventTicket);
412
+ var zEventTicket = addAutoProps(zBEventTicket);
433
413
 
434
414
  // src/interface/event/table.ts
435
415
  import { z as z21 } from "zod";
@@ -444,7 +424,7 @@ var zScheduleTable = z21.object({
444
424
  });
445
425
 
446
426
  // src/interface/event/eConfig.ts
447
- var zEventConfig = z22.object({
427
+ var zBEventConfig = z22.object({
448
428
  /**
449
429
  * Location of the event
450
430
  */
@@ -491,7 +471,7 @@ var zEventConfig = z22.object({
491
471
  /**
492
472
  * List of ticket object IDs for this tournament
493
473
  */
494
- tickets: z22.array(z22.instanceof(Types12.ObjectId).or(z22.string())),
474
+ tickets: z22.array(z22.string()),
495
475
  /**
496
476
  * If false, the tournament registration is closed
497
477
  */
@@ -505,34 +485,31 @@ var zEventConfig = z22.object({
505
485
  */
506
486
  image: zImageDef.optional()
507
487
  });
508
- var zMEventConfig = addMongooseProps(zEventConfig);
488
+ var zEventConfig = addAutoProps(zBEventConfig);
509
489
  var zEventConfigResponse = zEventConfig.extend({
510
- tickets: z22.array(zMEventTicketResponse)
490
+ tickets: z22.array(zEventTicket)
511
491
  });
512
- var zMEventConfigResponse = addMongoosePropsToResponse(zEventConfigResponse);
513
492
 
514
493
  // src/interface/event/eReg.ts
515
- import { Types as Types14 } from "mongoose";
516
494
  import { z as z24 } from "zod";
517
495
 
518
496
  // src/interface/event/eTicketReg.ts
519
497
  import { z as z23 } from "zod";
520
- import { Types as Types13 } from "mongoose";
521
498
  var zEventTicketReg = z23.object({
522
- ticket: z23.instanceof(Types13.ObjectId).or(z23.string()),
499
+ ticket: z23.string(),
523
500
  /**
524
501
  * integer minimum 1, otherwise no ticket is being bought
525
502
  */
526
503
  amount: z23.number().int().min(1)
527
504
  });
528
505
  var zEventTicketRegResponse = zEventTicketReg.extend({
529
- ticket: zMEventTicket
506
+ ticket: zEventTicket
530
507
  });
531
508
 
532
509
  // src/interface/event/eReg.ts
533
- var zEventReg = z24.object({
510
+ var zBEventReg = z24.object({
534
511
  agaId: z24.string(),
535
- tournamentId: z24.instanceof(Types14.ObjectId).or(z24.string()),
512
+ tournamentId: z24.string(),
536
513
  tickets: z24.array(zEventTicketReg),
537
514
  /**
538
515
  * @units CENTS - Donation in cents
@@ -541,17 +518,12 @@ var zEventReg = z24.object({
541
518
  /**
542
519
  * How the registration was created, namely through public endpoint or admin
543
520
  */
544
- createMethod: z24.string().optional(),
545
- /**
546
- * Mongoose ID of the admin that edited the registration
547
- */
548
- edited: z24.instanceof(Types14.ObjectId).optional()
521
+ createMethod: z24.string().optional()
549
522
  }).merge(zBUserInfo).merge(zBPaymentInfo);
523
+ var zEventReg = addAutoProps(zBEventReg);
550
524
  var zEventRegResponse = zEventReg.extend({
551
525
  tickets: z24.array(zEventTicketRegResponse)
552
526
  });
553
- var zMEventReg = addMongooseProps(zEventReg);
554
- var zMEventRegResponse = addMongoosePropsToResponse(zEventRegResponse);
555
527
 
556
528
  // src/interface/user/goRank.ts
557
529
  var GoRank = /* @__PURE__ */ ((GoRank2) => {
@@ -601,8 +573,7 @@ var GoRank = /* @__PURE__ */ ((GoRank2) => {
601
573
 
602
574
  // src/interface/user/user.ts
603
575
  import { z as z25 } from "zod";
604
- import { Types as Types15 } from "mongoose";
605
- var zUser = z25.object({
576
+ var zBUser = z25.object({
606
577
  name: z25.string().min(2).max(100),
607
578
  username: z25.string().optional(),
608
579
  password: z25.string().optional(),
@@ -619,12 +590,11 @@ var zUser = z25.object({
619
590
  message: "Enter a valid date in yyyy-mm-dd format"
620
591
  }).optional()
621
592
  });
622
- var zMUser = addMongooseProps(zUser);
593
+ var zUser = addAutoProps(zBUser);
623
594
  var zStudent = zUser.extend({
624
595
  rank: z25.nativeEnum(GoRank),
625
- guardian: z25.instanceof(Types15.ObjectId).optional()
596
+ guardian: z25.string().optional()
626
597
  });
627
- var zMStudent = addMongooseProps(zStudent);
628
598
  var zTeacher = zUser.extend({
629
599
  rank: z25.nativeEnum(GoRank),
630
600
  /**
@@ -654,7 +624,6 @@ var zTeacher = zUser.extend({
654
624
  */
655
625
  available: z25.array(z25.array(z25.array(z25.number()))).optional()
656
626
  });
657
- var zMTeacher = addMongooseProps(zTeacher);
658
627
 
659
628
  // src/interface/user/userRoles.ts
660
629
  import { z as z26 } from "zod";
@@ -675,7 +644,23 @@ export {
675
644
  Season,
676
645
  TicketStatus,
677
646
  zAttendance,
647
+ zBAttendance,
648
+ zBCampBooking,
649
+ zBCampTracker,
650
+ zBClassTracker,
651
+ zBCourse,
652
+ zBEventConfig,
653
+ zBEventReg,
654
+ zBEventTicket,
655
+ zBGroupBooking,
656
+ zBGroupTracker,
657
+ zBInvoice,
678
658
  zBPaymentInfo,
659
+ zBPrivateBooking,
660
+ zBReportTicket,
661
+ zBSemester,
662
+ zBTeacherPayment,
663
+ zBUser,
679
664
  zBUserInfo,
680
665
  zCampBooking,
681
666
  zCampTracker,
@@ -697,27 +682,6 @@ export {
697
682
  zInvoice,
698
683
  zInvoiceItem,
699
684
  zInvoicePackage,
700
- zMAttendance,
701
- zMCampBooking,
702
- zMCampTracker,
703
- zMClassTracker,
704
- zMCourse,
705
- zMEventConfig,
706
- zMEventConfigResponse,
707
- zMEventReg,
708
- zMEventRegResponse,
709
- zMEventTicket,
710
- zMEventTicketResponse,
711
- zMGroupBooking,
712
- zMGroupTracker,
713
- zMInvoice,
714
- zMPrivateBooking,
715
- zMReportTicket,
716
- zMSemester,
717
- zMStudent,
718
- zMTeacher,
719
- zMTeacherPayment,
720
- zMUser,
721
685
  zPrivateBooking,
722
686
  zReportTicket,
723
687
  zScheduleData,
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@nyig/models",
3
- "version": "0.2.27",
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": {