@nyig/models 0.2.22 → 0.2.24

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 (5) hide show
  1. package/index.d.mts +304 -48
  2. package/index.d.ts +304 -48
  3. package/index.js +67 -59
  4. package/index.mjs +62 -56
  5. package/package.json +1 -1
package/index.js CHANGED
@@ -59,6 +59,7 @@ __export(src_exports, {
59
59
  zMSemester: () => zMSemester,
60
60
  zMStudent: () => zMStudent,
61
61
  zMTConfig: () => zMTConfig,
62
+ zMTConfigResponse: () => zMTConfigResponse,
62
63
  zMTReg: () => zMTReg,
63
64
  zMTTicket: () => zMTTicket,
64
65
  zMTeacher: () => zMTeacher,
@@ -71,6 +72,7 @@ __export(src_exports, {
71
72
  zSemester: () => zSemester,
72
73
  zStudent: () => zStudent,
73
74
  zTConfig: () => zTConfig,
75
+ zTConfigResponse: () => zTConfigResponse,
74
76
  zTReg: () => zTReg,
75
77
  zTTicket: () => zTTicket,
76
78
  zTTicketReg: () => zTTicketReg,
@@ -220,24 +222,24 @@ var zDiscount = import_zod7.z.object({
220
222
  amount: import_zod7.z.number()
221
223
  });
222
224
  var zInvoiceItem = import_zod7.z.object({
223
- course: import_zod7.z.instanceof(import_mongoose7.Types.ObjectId).or(import_zod7.z.string()),
225
+ course: import_zod7.z.string().min(1),
224
226
  price: import_zod7.z.number(),
225
227
  units: import_zod7.z.number()
226
228
  });
227
229
  var zInvoicePackage = import_zod7.z.object({
228
230
  student: import_zod7.z.instanceof(import_mongoose7.Types.ObjectId).or(import_zod7.z.string()),
229
- items: import_zod7.z.array(zInvoiceItem)
231
+ items: import_zod7.z.array(zInvoiceItem).min(1, "Package must contain at least one item")
230
232
  });
231
233
  var zInvoice = import_zod7.z.object({
232
- billTo: import_zod7.z.string(),
233
- packages: import_zod7.z.array(zInvoicePackage),
234
+ billTo: import_zod7.z.string().min(1, "The 'Bill To' field must not be empty"),
235
+ packages: import_zod7.z.array(zInvoicePackage).min(1, "Invoice must include at least one package"),
234
236
  discounts: import_zod7.z.array(zDiscount),
235
- textbook: import_zod7.z.number().int().min(1).optional(),
236
- shipping: import_zod7.z.number().int().min(1).optional(),
237
+ textbook: import_zod7.z.number().int().min(0).optional(),
238
+ shipping: import_zod7.z.number().int().min(0).optional(),
237
239
  paid: import_zod7.z.nativeEnum(PaymentMethod).optional(),
238
240
  notes: import_zod7.z.string().optional(),
239
241
  createdBy: import_zod7.z.instanceof(import_mongoose7.Types.ObjectId).or(import_zod7.z.string()),
240
- lastEditBy: import_zod7.z.instanceof(import_mongoose7.Types.ObjectId).optional()
242
+ lastEditBy: import_zod7.z.instanceof(import_mongoose7.Types.ObjectId).or(import_zod7.z.string()).optional()
241
243
  });
242
244
  var zMInvoice = extendZodObjectForMongoose(zInvoice);
243
245
 
@@ -483,8 +485,8 @@ var zSemester = import_zod19.z.object({
483
485
  var zMSemester = extendZodObjectForMongoose(zSemester);
484
486
 
485
487
  // src/interface/tournament/tConfig.ts
486
- var import_mongoose24 = require("mongoose");
487
- var import_zod21 = require("zod");
488
+ var import_mongoose25 = require("mongoose");
489
+ var import_zod22 = require("zod");
488
490
 
489
491
  // src/interface/tournament/table.ts
490
492
  var import_zod20 = require("zod");
@@ -495,44 +497,67 @@ var zDetailsTable = import_zod20.z.object({
495
497
  });
496
498
  var zScheduleTable = import_zod20.z.object({
497
499
  fields: import_zod20.z.array(import_zod20.z.string()).length(2),
498
- data: import_zod20.z.map(import_zod20.z.string(), zTable)
500
+ data: import_zod20.z.record(import_zod20.z.string(), zTable)
501
+ });
502
+
503
+ // src/interface/tournament/tTicket.ts
504
+ var import_zod21 = require("zod");
505
+ var zTTicket = import_zod21.z.object({
506
+ name: import_zod21.z.string(),
507
+ /**
508
+ * Price in cents
509
+ */
510
+ price: import_zod21.z.number(),
511
+ /**
512
+ * @optional description of the ticket
513
+ */
514
+ description: import_zod21.z.string().optional(),
515
+ /**
516
+ * @optional The ticket cannot be purchased if true
517
+ */
518
+ isNotBuyable: import_zod21.z.boolean().optional(),
519
+ /**
520
+ * @optional If date is provided and in the past, ticket cannot be purchased
521
+ */
522
+ lastBuyableDate: import_zod21.z.coerce.date().optional()
499
523
  });
524
+ var zMTTicket = extendZodObjectForMongoose(zTTicket);
500
525
 
501
526
  // src/interface/tournament/tConfig.ts
502
- var zTConfig = import_zod21.z.object({
527
+ var zTConfig = import_zod22.z.object({
503
528
  /**
504
529
  * Location of the event
505
530
  */
506
- location: import_zod21.z.string().optional(),
531
+ location: import_zod22.z.string().optional(),
507
532
  /**
508
533
  * URL of the tournament on the official website
509
534
  * Must be a valid URL link
510
535
  */
511
- url: import_zod21.z.string(),
536
+ url: import_zod22.z.string(),
512
537
  /**
513
538
  * Full name of the tournament
514
539
  */
515
- title: import_zod21.z.string(),
540
+ title: import_zod22.z.string(),
516
541
  /**
517
542
  * Abbreviated title of the tournament
518
543
  */
519
- shortTitle: import_zod21.z.string(),
544
+ shortTitle: import_zod22.z.string(),
520
545
  /**
521
546
  * Tournament start date and time
522
547
  */
523
- tStart: import_zod21.z.coerce.date(),
548
+ tStart: import_zod22.z.coerce.date(),
524
549
  /**
525
550
  * Tournament end date and time
526
551
  */
527
- tEnd: import_zod21.z.coerce.date(),
552
+ tEnd: import_zod22.z.coerce.date(),
528
553
  /**
529
554
  * Short description for tournament card
530
555
  */
531
- shortDescription: import_zod21.z.string(),
556
+ shortDescription: import_zod22.z.string(),
532
557
  /**
533
558
  * Full description
534
559
  */
535
- description: import_zod21.z.string(),
560
+ description: import_zod22.z.string(),
536
561
  /**
537
562
  * Defines the tournament details table with 2 columns
538
563
  * typically Time and Event
@@ -546,80 +571,61 @@ var zTConfig = import_zod21.z.object({
546
571
  /**
547
572
  * List of ticket object IDs for this tournament
548
573
  */
549
- tickets: import_zod21.z.array(import_zod21.z.instanceof(import_mongoose24.Types.ObjectId).or(import_zod21.z.string())),
574
+ tickets: import_zod22.z.array(import_zod22.z.instanceof(import_mongoose25.Types.ObjectId).or(import_zod22.z.string())),
550
575
  /**
551
576
  * If false, the tournament registration is closed
552
577
  */
553
- canRegister: import_zod21.z.boolean(),
578
+ canRegister: import_zod22.z.boolean(),
554
579
  /**
555
580
  * If true, free form donation amounts are disabled.
556
581
  */
557
- donationsDisabled: import_zod21.z.boolean().optional(),
582
+ donationsDisabled: import_zod22.z.boolean().optional(),
558
583
  /**
559
584
  * Defines URL, height, width of the image
560
585
  */
561
586
  image: zImageDef.optional()
562
587
  });
588
+ var zTConfigResponse = zTConfig.extend({
589
+ tickets: import_zod22.z.array(zTTicket)
590
+ });
563
591
  var zMTConfig = extendZodObjectForMongoose(zTConfig);
592
+ var zMTConfigResponse = extendZodObjectForMongoose(zTConfigResponse);
564
593
 
565
594
  // src/interface/tournament/tReg.ts
566
- var import_mongoose27 = require("mongoose");
567
- var import_zod23 = require("zod");
595
+ var import_mongoose28 = require("mongoose");
596
+ var import_zod24 = require("zod");
568
597
 
569
598
  // src/interface/tournament/tTicketReg.ts
570
- var import_zod22 = require("zod");
571
- var import_mongoose26 = require("mongoose");
572
- var zTTicketReg = import_zod22.z.object({
573
- ticket: import_zod22.z.instanceof(import_mongoose26.Types.ObjectId).or(import_zod22.z.string()),
599
+ var import_zod23 = require("zod");
600
+ var import_mongoose27 = require("mongoose");
601
+ var zTTicketReg = import_zod23.z.object({
602
+ ticket: import_zod23.z.instanceof(import_mongoose27.Types.ObjectId).or(import_zod23.z.string()),
574
603
  /**
575
604
  * integer minimum 1, otherwise no ticket is being bought
576
605
  */
577
- amount: import_zod22.z.number().int().min(1)
606
+ amount: import_zod23.z.number().int().min(1)
578
607
  });
579
608
 
580
609
  // src/interface/tournament/tReg.ts
581
- var zTReg = import_zod23.z.object({
582
- agaId: import_zod23.z.string(),
583
- tournamentId: import_zod23.z.instanceof(import_mongoose27.Types.ObjectId).or(import_zod23.z.string()),
584
- tickets: import_zod23.z.array(zTTicketReg),
610
+ var zTReg = import_zod24.z.object({
611
+ agaId: import_zod24.z.string(),
612
+ tournamentId: import_zod24.z.instanceof(import_mongoose28.Types.ObjectId).or(import_zod24.z.string()),
613
+ tickets: import_zod24.z.array(zTTicketReg),
585
614
  /**
586
615
  * @units CENTS - Donation in cents
587
616
  */
588
- donation: import_zod23.z.number().optional(),
617
+ donation: import_zod24.z.number().optional(),
589
618
  /**
590
619
  * How the registration was created, namely through public endpoint or admin
591
620
  */
592
- createMethod: import_zod23.z.string().optional(),
621
+ createMethod: import_zod24.z.string().optional(),
593
622
  /**
594
623
  * Mongoose ID of the admin that edited the registration
595
624
  */
596
- edited: import_zod23.z.instanceof(import_mongoose27.Types.ObjectId).optional()
625
+ edited: import_zod24.z.instanceof(import_mongoose28.Types.ObjectId).optional()
597
626
  }).merge(zBUserInfo).merge(zBPaymentInfo);
598
627
  var zMTReg = extendZodObjectForMongoose(zTReg);
599
628
 
600
- // src/interface/tournament/tTicket.ts
601
- var import_zod24 = require("zod");
602
- var zTTicket = import_zod24.z.object({
603
- name: import_zod24.z.string(),
604
- /**
605
- * Price in cents
606
- */
607
- price: import_zod24.z.number(),
608
- /**
609
- * @optional description of the ticket
610
- */
611
- description: import_zod24.z.string().optional(),
612
- /**
613
- * @optional The ticket cannot be purchased if true
614
- */
615
- isNotBuyable: import_zod24.z.boolean().optional(),
616
- /**
617
- * @optional If date is provided and in the past, ticket cannot be purchased
618
- */
619
- lastBuyableDate: import_zod24.z.coerce.date().optional()
620
- });
621
- var zMTTicket = extendZodObjectForMongoose(zTTicket);
622
-
623
629
  // src/interface/user/goRank.ts
624
630
  var GoRank = /* @__PURE__ */ ((GoRank2) => {
625
631
  GoRank2["KYU1"] = "1k";
@@ -771,6 +777,7 @@ var zUserRoles = import_zod26.z.object({
771
777
  zMSemester,
772
778
  zMStudent,
773
779
  zMTConfig,
780
+ zMTConfigResponse,
774
781
  zMTReg,
775
782
  zMTTicket,
776
783
  zMTeacher,
@@ -783,6 +790,7 @@ var zUserRoles = import_zod26.z.object({
783
790
  zSemester,
784
791
  zStudent,
785
792
  zTConfig,
793
+ zTConfigResponse,
786
794
  zTReg,
787
795
  zTTicket,
788
796
  zTTicketReg,
package/index.mjs CHANGED
@@ -134,24 +134,24 @@ var zDiscount = z7.object({
134
134
  amount: z7.number()
135
135
  });
136
136
  var zInvoiceItem = z7.object({
137
- course: z7.instanceof(Types5.ObjectId).or(z7.string()),
137
+ course: z7.string().min(1),
138
138
  price: z7.number(),
139
139
  units: z7.number()
140
140
  });
141
141
  var zInvoicePackage = z7.object({
142
142
  student: z7.instanceof(Types5.ObjectId).or(z7.string()),
143
- items: z7.array(zInvoiceItem)
143
+ items: z7.array(zInvoiceItem).min(1, "Package must contain at least one item")
144
144
  });
145
145
  var zInvoice = z7.object({
146
- billTo: z7.string(),
147
- packages: z7.array(zInvoicePackage),
146
+ billTo: z7.string().min(1, "The 'Bill To' field must not be empty"),
147
+ packages: z7.array(zInvoicePackage).min(1, "Invoice must include at least one package"),
148
148
  discounts: z7.array(zDiscount),
149
- textbook: z7.number().int().min(1).optional(),
150
- shipping: z7.number().int().min(1).optional(),
149
+ textbook: z7.number().int().min(0).optional(),
150
+ shipping: z7.number().int().min(0).optional(),
151
151
  paid: z7.nativeEnum(PaymentMethod).optional(),
152
152
  notes: z7.string().optional(),
153
153
  createdBy: z7.instanceof(Types5.ObjectId).or(z7.string()),
154
- lastEditBy: z7.instanceof(Types5.ObjectId).optional()
154
+ lastEditBy: z7.instanceof(Types5.ObjectId).or(z7.string()).optional()
155
155
  });
156
156
  var zMInvoice = extendZodObjectForMongoose(zInvoice);
157
157
 
@@ -398,7 +398,7 @@ var zMSemester = extendZodObjectForMongoose(zSemester);
398
398
 
399
399
  // src/interface/tournament/tConfig.ts
400
400
  import { Types as Types12 } from "mongoose";
401
- import { z as z21 } from "zod";
401
+ import { z as z22 } from "zod";
402
402
 
403
403
  // src/interface/tournament/table.ts
404
404
  import { z as z20 } from "zod";
@@ -409,44 +409,67 @@ var zDetailsTable = z20.object({
409
409
  });
410
410
  var zScheduleTable = z20.object({
411
411
  fields: z20.array(z20.string()).length(2),
412
- data: z20.map(z20.string(), zTable)
412
+ data: z20.record(z20.string(), zTable)
413
413
  });
414
414
 
415
+ // src/interface/tournament/tTicket.ts
416
+ import { z as z21 } from "zod";
417
+ var zTTicket = z21.object({
418
+ name: z21.string(),
419
+ /**
420
+ * Price in cents
421
+ */
422
+ price: z21.number(),
423
+ /**
424
+ * @optional description of the ticket
425
+ */
426
+ description: z21.string().optional(),
427
+ /**
428
+ * @optional The ticket cannot be purchased if true
429
+ */
430
+ isNotBuyable: z21.boolean().optional(),
431
+ /**
432
+ * @optional If date is provided and in the past, ticket cannot be purchased
433
+ */
434
+ lastBuyableDate: z21.coerce.date().optional()
435
+ });
436
+ var zMTTicket = extendZodObjectForMongoose(zTTicket);
437
+
415
438
  // src/interface/tournament/tConfig.ts
416
- var zTConfig = z21.object({
439
+ var zTConfig = z22.object({
417
440
  /**
418
441
  * Location of the event
419
442
  */
420
- location: z21.string().optional(),
443
+ location: z22.string().optional(),
421
444
  /**
422
445
  * URL of the tournament on the official website
423
446
  * Must be a valid URL link
424
447
  */
425
- url: z21.string(),
448
+ url: z22.string(),
426
449
  /**
427
450
  * Full name of the tournament
428
451
  */
429
- title: z21.string(),
452
+ title: z22.string(),
430
453
  /**
431
454
  * Abbreviated title of the tournament
432
455
  */
433
- shortTitle: z21.string(),
456
+ shortTitle: z22.string(),
434
457
  /**
435
458
  * Tournament start date and time
436
459
  */
437
- tStart: z21.coerce.date(),
460
+ tStart: z22.coerce.date(),
438
461
  /**
439
462
  * Tournament end date and time
440
463
  */
441
- tEnd: z21.coerce.date(),
464
+ tEnd: z22.coerce.date(),
442
465
  /**
443
466
  * Short description for tournament card
444
467
  */
445
- shortDescription: z21.string(),
468
+ shortDescription: z22.string(),
446
469
  /**
447
470
  * Full description
448
471
  */
449
- description: z21.string(),
472
+ description: z22.string(),
450
473
  /**
451
474
  * Defines the tournament details table with 2 columns
452
475
  * typically Time and Event
@@ -460,80 +483,61 @@ var zTConfig = z21.object({
460
483
  /**
461
484
  * List of ticket object IDs for this tournament
462
485
  */
463
- tickets: z21.array(z21.instanceof(Types12.ObjectId).or(z21.string())),
486
+ tickets: z22.array(z22.instanceof(Types12.ObjectId).or(z22.string())),
464
487
  /**
465
488
  * If false, the tournament registration is closed
466
489
  */
467
- canRegister: z21.boolean(),
490
+ canRegister: z22.boolean(),
468
491
  /**
469
492
  * If true, free form donation amounts are disabled.
470
493
  */
471
- donationsDisabled: z21.boolean().optional(),
494
+ donationsDisabled: z22.boolean().optional(),
472
495
  /**
473
496
  * Defines URL, height, width of the image
474
497
  */
475
498
  image: zImageDef.optional()
476
499
  });
500
+ var zTConfigResponse = zTConfig.extend({
501
+ tickets: z22.array(zTTicket)
502
+ });
477
503
  var zMTConfig = extendZodObjectForMongoose(zTConfig);
504
+ var zMTConfigResponse = extendZodObjectForMongoose(zTConfigResponse);
478
505
 
479
506
  // src/interface/tournament/tReg.ts
480
507
  import { Types as Types14 } from "mongoose";
481
- import { z as z23 } from "zod";
508
+ import { z as z24 } from "zod";
482
509
 
483
510
  // src/interface/tournament/tTicketReg.ts
484
- import { z as z22 } from "zod";
511
+ import { z as z23 } from "zod";
485
512
  import { Types as Types13 } from "mongoose";
486
- var zTTicketReg = z22.object({
487
- ticket: z22.instanceof(Types13.ObjectId).or(z22.string()),
513
+ var zTTicketReg = z23.object({
514
+ ticket: z23.instanceof(Types13.ObjectId).or(z23.string()),
488
515
  /**
489
516
  * integer minimum 1, otherwise no ticket is being bought
490
517
  */
491
- amount: z22.number().int().min(1)
518
+ amount: z23.number().int().min(1)
492
519
  });
493
520
 
494
521
  // src/interface/tournament/tReg.ts
495
- var zTReg = z23.object({
496
- agaId: z23.string(),
497
- tournamentId: z23.instanceof(Types14.ObjectId).or(z23.string()),
498
- tickets: z23.array(zTTicketReg),
522
+ var zTReg = z24.object({
523
+ agaId: z24.string(),
524
+ tournamentId: z24.instanceof(Types14.ObjectId).or(z24.string()),
525
+ tickets: z24.array(zTTicketReg),
499
526
  /**
500
527
  * @units CENTS - Donation in cents
501
528
  */
502
- donation: z23.number().optional(),
529
+ donation: z24.number().optional(),
503
530
  /**
504
531
  * How the registration was created, namely through public endpoint or admin
505
532
  */
506
- createMethod: z23.string().optional(),
533
+ createMethod: z24.string().optional(),
507
534
  /**
508
535
  * Mongoose ID of the admin that edited the registration
509
536
  */
510
- edited: z23.instanceof(Types14.ObjectId).optional()
537
+ edited: z24.instanceof(Types14.ObjectId).optional()
511
538
  }).merge(zBUserInfo).merge(zBPaymentInfo);
512
539
  var zMTReg = extendZodObjectForMongoose(zTReg);
513
540
 
514
- // src/interface/tournament/tTicket.ts
515
- import { z as z24 } from "zod";
516
- var zTTicket = z24.object({
517
- name: z24.string(),
518
- /**
519
- * Price in cents
520
- */
521
- price: z24.number(),
522
- /**
523
- * @optional description of the ticket
524
- */
525
- description: z24.string().optional(),
526
- /**
527
- * @optional The ticket cannot be purchased if true
528
- */
529
- isNotBuyable: z24.boolean().optional(),
530
- /**
531
- * @optional If date is provided and in the past, ticket cannot be purchased
532
- */
533
- lastBuyableDate: z24.coerce.date().optional()
534
- });
535
- var zMTTicket = extendZodObjectForMongoose(zTTicket);
536
-
537
541
  // src/interface/user/goRank.ts
538
542
  var GoRank = /* @__PURE__ */ ((GoRank2) => {
539
543
  GoRank2["KYU1"] = "1k";
@@ -684,6 +688,7 @@ export {
684
688
  zMSemester,
685
689
  zMStudent,
686
690
  zMTConfig,
691
+ zMTConfigResponse,
687
692
  zMTReg,
688
693
  zMTTicket,
689
694
  zMTeacher,
@@ -696,6 +701,7 @@ export {
696
701
  zSemester,
697
702
  zStudent,
698
703
  zTConfig,
704
+ zTConfigResponse,
699
705
  zTReg,
700
706
  zTTicket,
701
707
  zTTicketReg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyig/models",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
4
4
  "license": "MIT",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",