@timardex/cluemart-server-shared 3.0.1 → 4.0.0

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/dist/index.cjs CHANGED
@@ -37,7 +37,9 @@ __export(index_exports, {
37
37
  AdBookingModel: () => AdBookingModel,
38
38
  AdMetricsModel: () => AdMetricsModel,
39
39
  AdModel: () => AdModel,
40
+ AdPurchaseModel: () => AdPurchaseModel,
40
41
  AffiliateModel: () => AffiliateModel,
42
+ AiImportedMarketModel: () => AiImportedMarketModel,
41
43
  AppSettingModel: () => AppSettingModel,
42
44
  AuthHandoffTokenModel: () => AuthHandoffTokenModel,
43
45
  BILLING_CATALOG_COLLECTION_NAME: () => BILLING_CATALOG_COLLECTION_NAME,
@@ -69,6 +71,7 @@ __export(index_exports, {
69
71
  ResourceImageTypeSchema: () => ResourceImageTypeSchema,
70
72
  SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
71
73
  SchoolModel: () => SchoolModel,
74
+ ScrapeSiteModel: () => ScrapeSiteModel,
72
75
  SocialMediaTypeSchema: () => SocialMediaTypeSchema,
73
76
  StallTypeSchema: () => StallTypeSchema,
74
77
  UnregisteredVendorModel: () => UnregisteredVendorModel,
@@ -123,7 +126,7 @@ __export(index_exports, {
123
126
  locationGeoSchema: () => locationGeoSchema,
124
127
  locationsSchema: () => locationsSchema,
125
128
  mapVendorLicenceToSubscriptionRewardType: () => mapVendorLicenceToSubscriptionRewardType,
126
- mongoose: () => import_mongoose38.default,
129
+ mongoose: () => import_mongoose41.default,
127
130
  normalizeAffiliatePromoCodes: () => normalizeAffiliatePromoCodes,
128
131
  normalizePromoCode: () => normalizePromoCode,
129
132
  notifyUsers: () => notifyUsers,
@@ -152,7 +155,7 @@ __export(index_exports, {
152
155
  updateAdStatuses: () => updateAdStatuses,
153
156
  updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
154
157
  updateRelationDatesToCanceled: () => updateRelationDatesToCanceled,
155
- updateSingleDateTimeStatus: () => import_cluemart_shared36.updateSingleDateTimeStatus,
158
+ updateSingleDateTimeStatus: () => import_cluemart_shared37.updateSingleDateTimeStatus,
156
159
  upgradeUserToLicence: () => upgradeUserToLicence,
157
160
  userLicenseSchema: () => userLicenseSchema,
158
161
  vendorOwnerHasProLicence: () => vendorOwnerHasProLicence,
@@ -426,10 +429,49 @@ schema3.index(
426
429
  );
427
430
  var AdBookingModel = import_mongoose3.default.models.AdBooking || import_mongoose3.default.model("AdBooking", schema3);
428
431
 
432
+ // src/mongoose/ad/AdPurchase.ts
433
+ var import_mongoose4 = __toESM(require("mongoose"));
434
+ var schema4 = new import_mongoose4.default.Schema(
435
+ {
436
+ _id: { required: true, type: String },
437
+ approvalRequired: { type: Boolean },
438
+ bookingIds: { required: true, type: [String] },
439
+ checkoutAttemptId: { required: true, type: String },
440
+ checkoutLeaseUntil: { type: Date },
441
+ checkoutLeaseToken: { type: String },
442
+ createdAt: { default: Date.now, required: true, type: Date },
443
+ expiresAt: { required: true, type: Date },
444
+ holdsReleased: { type: Boolean },
445
+ quote: { required: true, type: import_mongoose4.default.Schema.Types.Mixed },
446
+ resource: { required: true, type: schemaAdresource },
447
+ selectionKey: { required: true, type: String },
448
+ state: {
449
+ enum: ["reserving", "checkout", "paid", "failed", "cancelled"],
450
+ required: true,
451
+ type: String
452
+ },
453
+ stripeCheckoutSessionId: { default: null, type: String },
454
+ stripePaymentIntentId: { default: null, type: String },
455
+ stripeRequestStartedAt: { type: Date },
456
+ userId: { required: true, type: String }
457
+ },
458
+ { collection: "adPurchases" }
459
+ );
460
+ schema4.index({ userId: 1, checkoutAttemptId: 1 }, { unique: true });
461
+ schema4.index(
462
+ { stripeCheckoutSessionId: 1 },
463
+ {
464
+ unique: true,
465
+ partialFilterExpression: { stripeCheckoutSessionId: { $type: "string" } }
466
+ }
467
+ );
468
+ schema4.index({ state: 1, expiresAt: 1 });
469
+ var AdPurchaseModel = import_mongoose4.default.models.AdPurchase || import_mongoose4.default.model("AdPurchase", schema4);
470
+
429
471
  // src/mongoose/ad/AdMetrics.ts
430
472
  var import_cluemart_shared4 = require("@timardex/cluemart-shared");
431
- var import_mongoose4 = __toESM(require("mongoose"));
432
- var ResourceMetricsSchema = new import_mongoose4.default.Schema(
473
+ var import_mongoose5 = __toESM(require("mongoose"));
474
+ var ResourceMetricsSchema = new import_mongoose5.default.Schema(
433
475
  {
434
476
  clicks: { default: 0, required: true, type: Number },
435
477
  date: {
@@ -457,15 +499,15 @@ var ResourceMetricsSchema = new import_mongoose4.default.Schema(
457
499
  },
458
500
  { _id: false }
459
501
  );
460
- var schema4 = new import_mongoose4.default.Schema(
502
+ var schema5 = new import_mongoose5.default.Schema(
461
503
  {
462
504
  adId: { ref: "Ad", required: true, type: String },
463
505
  resource: { default: [], type: [ResourceMetricsSchema] }
464
506
  },
465
507
  { timestamps: true }
466
508
  );
467
- schema4.index({ adId: 1 }, { unique: true });
468
- schema4.index(
509
+ schema5.index({ adId: 1 }, { unique: true });
510
+ schema5.index(
469
511
  {
470
512
  adId: 1,
471
513
  "resource.date": 1,
@@ -474,12 +516,12 @@ schema4.index(
474
516
  },
475
517
  { unique: true }
476
518
  );
477
- var AdMetricsModel = import_mongoose4.default.models.AdMetrics || import_mongoose4.default.model("AdMetrics", schema4);
519
+ var AdMetricsModel = import_mongoose5.default.models.AdMetrics || import_mongoose5.default.model("AdMetrics", schema5);
478
520
 
479
521
  // src/mongoose/BillingCatalog.ts
480
522
  var import_cluemart_shared5 = require("@timardex/cluemart-shared");
481
- var import_mongoose5 = __toESM(require("mongoose"));
482
- var MongooseSchema2 = import_mongoose5.default.Schema;
523
+ var import_mongoose6 = __toESM(require("mongoose"));
524
+ var MongooseSchema2 = import_mongoose6.default.Schema;
483
525
  var BILLING_CATALOG_COLLECTION_NAME = "billingCatalog";
484
526
  var paidVendorLicences = [
485
527
  import_cluemart_shared5.EnumUserLicence.PRO_VENDOR,
@@ -526,7 +568,7 @@ var priceHistorySchema = new MongooseSchema2(
526
568
  default: null,
527
569
  ref: "User",
528
570
  required: false,
529
- type: import_mongoose5.default.Schema.Types.ObjectId
571
+ type: import_mongoose6.default.Schema.Types.ObjectId
530
572
  },
531
573
  currency: currencyField,
532
574
  effectiveFrom: { required: true, type: Date },
@@ -537,7 +579,7 @@ var priceHistorySchema = new MongooseSchema2(
537
579
  },
538
580
  { _id: false }
539
581
  );
540
- var schema5 = new MongooseSchema2(
582
+ var schema6 = new MongooseSchema2(
541
583
  {
542
584
  active: { default: true, required: true, type: Boolean },
543
585
  billingPeriod: {
@@ -593,7 +635,7 @@ var schema5 = new MongooseSchema2(
593
635
  default: null,
594
636
  ref: "User",
595
637
  required: false,
596
- type: import_mongoose5.default.Schema.Types.ObjectId
638
+ type: import_mongoose6.default.Schema.Types.ObjectId
597
639
  }
598
640
  },
599
641
  {
@@ -602,7 +644,7 @@ var schema5 = new MongooseSchema2(
602
644
  timestamps: true
603
645
  }
604
646
  );
605
- schema5.pre("validate", function validateDefinition() {
647
+ schema6.pre("validate", function validateDefinition() {
606
648
  if (!(0, import_cluemart_shared5.billingCatalogDefinitionMatches)(this)) {
607
649
  this.invalidate(
608
650
  "key",
@@ -610,18 +652,18 @@ schema5.pre("validate", function validateDefinition() {
610
652
  );
611
653
  }
612
654
  });
613
- schema5.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });
614
- schema5.index({ active: 1, licenceType: 1 });
615
- schema5.index(
655
+ schema6.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });
656
+ schema6.index({ active: 1, licenceType: 1 });
657
+ schema6.index(
616
658
  { stripePriceId: 1 },
617
659
  {
618
660
  partialFilterExpression: { stripePriceId: { $type: "string" } },
619
661
  unique: true
620
662
  }
621
663
  );
622
- var BillingCatalogModel = import_mongoose5.default.models.BillingCatalogEntry || import_mongoose5.default.model(
664
+ var BillingCatalogModel = import_mongoose6.default.models.BillingCatalogEntry || import_mongoose6.default.model(
623
665
  "BillingCatalogEntry",
624
- schema5,
666
+ schema6,
625
667
  BILLING_CATALOG_COLLECTION_NAME
626
668
  );
627
669
  function buildInitialBillingCatalogEntries(now = /* @__PURE__ */ new Date()) {
@@ -647,15 +689,15 @@ function getBillingCatalogDefinition(key) {
647
689
 
648
690
  // src/mongoose/chat/Chat.ts
649
691
  var import_cluemart_shared6 = require("@timardex/cluemart-shared");
650
- var import_mongoose6 = __toESM(require("mongoose"));
651
- var MongooseSchema3 = import_mongoose6.default.Schema;
692
+ var import_mongoose7 = __toESM(require("mongoose"));
693
+ var MongooseSchema3 = import_mongoose7.default.Schema;
652
694
  var MessageReplyPreviewSchema = new MongooseSchema3(
653
695
  {
654
696
  contentPreview: { required: true, type: String },
655
697
  senderId: {
656
698
  ref: "User",
657
699
  required: true,
658
- type: import_mongoose6.default.Schema.Types.ObjectId
700
+ type: import_mongoose7.default.Schema.Types.ObjectId
659
701
  },
660
702
  senderName: { required: true, type: String }
661
703
  },
@@ -667,7 +709,7 @@ var MessageReactionSchema = new MongooseSchema3(
667
709
  userId: {
668
710
  ref: "User",
669
711
  required: true,
670
- type: import_mongoose6.default.Schema.Types.ObjectId
712
+ type: import_mongoose7.default.Schema.Types.ObjectId
671
713
  }
672
714
  },
673
715
  { _id: false }
@@ -678,7 +720,7 @@ var MessageSeenSchema = new MongooseSchema3(
678
720
  userId: {
679
721
  ref: "User",
680
722
  required: true,
681
- type: import_mongoose6.default.Schema.Types.ObjectId
723
+ type: import_mongoose7.default.Schema.Types.ObjectId
682
724
  }
683
725
  },
684
726
  { _id: false }
@@ -694,13 +736,13 @@ var MessageSchema = new MongooseSchema3(
694
736
  replyToMessageId: {
695
737
  ref: "Chat.messages",
696
738
  required: false,
697
- type: import_mongoose6.default.Schema.Types.ObjectId
739
+ type: import_mongoose7.default.Schema.Types.ObjectId
698
740
  },
699
741
  seenBy: { default: [], required: false, type: [MessageSeenSchema] },
700
742
  senderId: {
701
743
  ref: "User",
702
744
  required: true,
703
- type: import_mongoose6.default.Schema.Types.ObjectId
745
+ type: import_mongoose7.default.Schema.Types.ObjectId
704
746
  }
705
747
  },
706
748
  { timestamps: true }
@@ -713,7 +755,7 @@ var ParticipantSchema = new MongooseSchema3(
713
755
  userId: {
714
756
  ref: "User",
715
757
  required: true,
716
- type: import_mongoose6.default.Schema.Types.ObjectId
758
+ type: import_mongoose7.default.Schema.Types.ObjectId
717
759
  },
718
760
  userName: { required: true, type: String }
719
761
  },
@@ -744,12 +786,12 @@ ChatSchema.index({
744
786
  "participants.userId": 1,
745
787
  updatedAt: -1
746
788
  });
747
- var ChatModel = import_mongoose6.default.models.Chat || import_mongoose6.default.model("Chat", ChatSchema);
789
+ var ChatModel = import_mongoose7.default.models.Chat || import_mongoose7.default.model("Chat", ChatSchema);
748
790
 
749
791
  // src/mongoose/chat/ChatReport.ts
750
792
  var import_cluemart_shared7 = require("@timardex/cluemart-shared");
751
- var import_mongoose7 = __toESM(require("mongoose"));
752
- var MongooseSchema4 = import_mongoose7.default.Schema;
793
+ var import_mongoose8 = __toESM(require("mongoose"));
794
+ var MongooseSchema4 = import_mongoose8.default.Schema;
753
795
  var ReasonSchema = new MongooseSchema4(
754
796
  {
755
797
  details: { default: null, required: false, type: String },
@@ -766,18 +808,18 @@ var ChatReportSchema = new MongooseSchema4(
766
808
  chatId: {
767
809
  ref: "Chat",
768
810
  required: true,
769
- type: import_mongoose7.default.Schema.Types.ObjectId
811
+ type: import_mongoose8.default.Schema.Types.ObjectId
770
812
  },
771
813
  reason: { required: true, type: ReasonSchema },
772
814
  reportedUserId: {
773
815
  ref: "User",
774
816
  required: true,
775
- type: import_mongoose7.default.Schema.Types.ObjectId
817
+ type: import_mongoose8.default.Schema.Types.ObjectId
776
818
  },
777
819
  reporterUserId: {
778
820
  ref: "User",
779
821
  required: true,
780
- type: import_mongoose7.default.Schema.Types.ObjectId
822
+ type: import_mongoose8.default.Schema.Types.ObjectId
781
823
  },
782
824
  resolved: { default: false, required: true, type: Boolean }
783
825
  },
@@ -785,19 +827,19 @@ var ChatReportSchema = new MongooseSchema4(
785
827
  );
786
828
  ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
787
829
  ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
788
- var ChatReportModel = import_mongoose7.default.models.ChatReport || import_mongoose7.default.model("ChatReport", ChatReportSchema);
830
+ var ChatReportModel = import_mongoose8.default.models.ChatReport || import_mongoose8.default.model("ChatReport", ChatReportSchema);
789
831
 
790
832
  // src/mongoose/global.ts
791
833
  var import_cluemart_shared8 = require("@timardex/cluemart-shared");
792
- var import_mongoose8 = __toESM(require("mongoose"));
793
- var MongooseSchema5 = import_mongoose8.default.Schema;
834
+ var import_mongoose9 = __toESM(require("mongoose"));
835
+ var MongooseSchema5 = import_mongoose9.default.Schema;
794
836
  var OwnerTypeSchema = new MongooseSchema5(
795
837
  {
796
838
  email: { required: true, type: String },
797
839
  userId: {
798
840
  ref: "User",
799
841
  required: true,
800
- type: import_mongoose8.default.Schema.Types.ObjectId
842
+ type: import_mongoose9.default.Schema.Types.ObjectId
801
843
  }
802
844
  },
803
845
  { _id: false }
@@ -940,7 +982,7 @@ var relatedPostSchema = new MongooseSchema5(
940
982
  postId: {
941
983
  ref: "Post",
942
984
  required: true,
943
- type: import_mongoose8.default.Schema.Types.ObjectId
985
+ type: import_mongoose9.default.Schema.Types.ObjectId
944
986
  },
945
987
  postSlug: { required: true, type: String },
946
988
  postType: {
@@ -965,7 +1007,7 @@ var baseResourceFields = {
965
1007
  adIds: {
966
1008
  ref: "Ad",
967
1009
  required: false,
968
- type: [import_mongoose8.default.Schema.Types.ObjectId]
1010
+ type: [import_mongoose9.default.Schema.Types.ObjectId]
969
1011
  },
970
1012
  approvedAt: { default: null, required: false, type: Date },
971
1013
  contactDetails: { required: false, type: ContactDetailsSchema },
@@ -996,7 +1038,7 @@ var baseResourceFields = {
996
1038
 
997
1039
  // src/mongoose/GoogleImportedMarket.ts
998
1040
  var import_cluemart_shared9 = require("@timardex/cluemart-shared");
999
- var import_mongoose9 = __toESM(require("mongoose"));
1041
+ var import_mongoose10 = __toESM(require("mongoose"));
1000
1042
 
1001
1043
  // src/mongoose/searchNamePlugin.ts
1002
1044
  function deriveSearchName(name) {
@@ -1042,15 +1084,15 @@ function syncSearchNameInUpdate(update) {
1042
1084
  }
1043
1085
  return null;
1044
1086
  }
1045
- function searchNamePlugin(schema25) {
1046
- schema25.add({ searchName: { default: "", required: false, type: String } });
1047
- schema25.index({ searchName: 1 });
1048
- schema25.pre("save", function syncSearchNameOnSave(next) {
1087
+ function searchNamePlugin(schema28) {
1088
+ schema28.add({ searchName: { default: "", required: false, type: String } });
1089
+ schema28.index({ searchName: 1 });
1090
+ schema28.pre("save", function syncSearchNameOnSave(next) {
1049
1091
  const doc = this;
1050
1092
  doc.searchName = deriveSearchName(doc.name);
1051
1093
  next();
1052
1094
  });
1053
- schema25.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
1095
+ schema28.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
1054
1096
  const list = Array.isArray(docs) ? docs : [docs];
1055
1097
  for (const doc of list) {
1056
1098
  if (doc && typeof doc.name === "string") {
@@ -1059,7 +1101,7 @@ function searchNamePlugin(schema25) {
1059
1101
  }
1060
1102
  next();
1061
1103
  });
1062
- schema25.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
1104
+ schema28.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
1063
1105
  for (const op of ops) {
1064
1106
  const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
1065
1107
  if (doc && typeof doc.name === "string") {
@@ -1085,14 +1127,14 @@ function searchNamePlugin(schema25) {
1085
1127
  }
1086
1128
  next();
1087
1129
  };
1088
- schema25.pre(
1130
+ schema28.pre(
1089
1131
  ["findOneAndUpdate", "updateOne", "updateMany"],
1090
1132
  syncSearchNameOnUpdate
1091
1133
  );
1092
1134
  }
1093
1135
 
1094
1136
  // src/mongoose/GoogleImportedMarket.ts
1095
- var MongooseSchema6 = import_mongoose9.default.Schema;
1137
+ var MongooseSchema6 = import_mongoose10.default.Schema;
1096
1138
  var addressComponentSchema = new MongooseSchema6(
1097
1139
  {
1098
1140
  longName: { required: false, type: String },
@@ -1101,7 +1143,7 @@ var addressComponentSchema = new MongooseSchema6(
1101
1143
  },
1102
1144
  { _id: false }
1103
1145
  );
1104
- var schema6 = new MongooseSchema6(
1146
+ var schema7 = new MongooseSchema6(
1105
1147
  {
1106
1148
  active: { default: false, required: true, type: Boolean },
1107
1149
  address: { required: true, type: String },
@@ -1113,7 +1155,7 @@ var schema6 = new MongooseSchema6(
1113
1155
  claimedByUserId: {
1114
1156
  ref: "User",
1115
1157
  required: false,
1116
- type: import_mongoose9.default.Schema.Types.ObjectId
1158
+ type: import_mongoose10.default.Schema.Types.ObjectId
1117
1159
  },
1118
1160
  cover: {
1119
1161
  required: false,
@@ -1125,7 +1167,7 @@ var schema6 = new MongooseSchema6(
1125
1167
  eventId: {
1126
1168
  ref: "Event",
1127
1169
  required: false,
1128
- type: import_mongoose9.default.Schema.Types.ObjectId
1170
+ type: import_mongoose10.default.Schema.Types.ObjectId
1129
1171
  },
1130
1172
  eventType: {
1131
1173
  enum: Object.values(import_cluemart_shared9.EnumEventType),
@@ -1159,33 +1201,144 @@ var schema6 = new MongooseSchema6(
1159
1201
  },
1160
1202
  { timestamps: true }
1161
1203
  );
1162
- schema6.index({ "location.geo": "2dsphere" });
1163
- schema6.index({ name: 1 });
1164
- schema6.index({ region: 1 });
1165
- schema6.index({ deletedAt: 1 });
1166
- schema6.index({ "dateTime.dateStatus": 1 });
1167
- schema6.index({ slug: 1 });
1168
- schema6.index({ description: "text", name: "text" });
1169
- schema6.plugin(searchNamePlugin);
1170
- var GoogleImportedMarketModel = import_mongoose9.default.models.GoogleImportedMarket || import_mongoose9.default.model("GoogleImportedMarket", schema6);
1204
+ schema7.index({ "location.geo": "2dsphere" });
1205
+ schema7.index({ name: 1 });
1206
+ schema7.index({ region: 1 });
1207
+ schema7.index({ deletedAt: 1 });
1208
+ schema7.index({ "dateTime.dateStatus": 1 });
1209
+ schema7.index({ slug: 1 });
1210
+ schema7.index({ description: "text", name: "text" });
1211
+ schema7.plugin(searchNamePlugin);
1212
+ var GoogleImportedMarketModel = import_mongoose10.default.models.GoogleImportedMarket || import_mongoose10.default.model("GoogleImportedMarket", schema7);
1171
1213
 
1172
- // src/mongoose/Notification.ts
1214
+ // src/mongoose/AiImportedMarket.ts
1173
1215
  var import_cluemart_shared10 = require("@timardex/cluemart-shared");
1174
- var import_mongoose10 = __toESM(require("mongoose"));
1175
- var MongooseSchema7 = import_mongoose10.default.Schema;
1176
- var notificationDataSchema = new MongooseSchema7(
1216
+ var import_mongoose11 = __toESM(require("mongoose"));
1217
+ var MongooseSchema7 = import_mongoose11.default.Schema;
1218
+ var addressComponentSchema2 = new MongooseSchema7(
1219
+ {
1220
+ longName: { required: false, type: String },
1221
+ shortName: { required: false, type: String },
1222
+ types: { required: false, type: [String] }
1223
+ },
1224
+ { _id: false }
1225
+ );
1226
+ var schema8 = new MongooseSchema7(
1227
+ {
1228
+ active: { default: false, required: true, type: Boolean },
1229
+ address: { required: true, type: String },
1230
+ addressComponents: { required: false, type: [addressComponentSchema2] },
1231
+ approvedAt: { default: null, required: false, type: Date },
1232
+ claimed: { default: false, required: true, type: Boolean },
1233
+ claimedAt: { default: null, required: false, type: Date },
1234
+ claimedByUserId: {
1235
+ ref: "User",
1236
+ required: false,
1237
+ type: import_mongoose11.default.Schema.Types.ObjectId
1238
+ },
1239
+ cover: {
1240
+ required: false,
1241
+ type: ResourceImageTypeSchema
1242
+ },
1243
+ dateTime: [dateTimeSchema],
1244
+ deletedAt: { default: null, required: false, type: Date },
1245
+ description: { required: true, type: String },
1246
+ eventId: {
1247
+ ref: "Event",
1248
+ required: false,
1249
+ type: import_mongoose11.default.Schema.Types.ObjectId
1250
+ },
1251
+ eventType: {
1252
+ enum: Object.values(import_cluemart_shared10.EnumEventType),
1253
+ required: true,
1254
+ type: String
1255
+ },
1256
+ images: { required: false, type: [ResourceImageTypeSchema] },
1257
+ location: {
1258
+ required: true,
1259
+ type: locationsSchema
1260
+ },
1261
+ logo: { required: false, type: ResourceImageTypeSchema },
1262
+ name: { required: true, type: String },
1263
+ openingHours: { required: false, type: [String] },
1264
+ rainOrShine: { required: true, type: Boolean },
1265
+ rating: { required: false, type: Number },
1266
+ region: { required: false, type: String },
1267
+ rejectReason: { required: false, type: String },
1268
+ reviewCount: { required: false, type: Number },
1269
+ reviewedAt: { default: null, required: false, type: Date },
1270
+ reviewedByUserId: {
1271
+ ref: "User",
1272
+ required: false,
1273
+ type: import_mongoose11.default.Schema.Types.ObjectId
1274
+ },
1275
+ reviewStatus: {
1276
+ default: import_cluemart_shared10.EnumImportedMarketReviewStatus.PENDING,
1277
+ enum: Object.values(import_cluemart_shared10.EnumImportedMarketReviewStatus),
1278
+ required: true,
1279
+ type: String
1280
+ },
1281
+ scrapedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
1282
+ slug: { required: true, type: String },
1283
+ sourceKey: {
1284
+ required: true,
1285
+ type: String,
1286
+ unique: true
1287
+ // unique, indexed
1288
+ },
1289
+ sourceName: { required: true, type: String },
1290
+ sourceUrl: { required: true, type: String },
1291
+ website: { required: false, type: String }
1292
+ },
1293
+ { timestamps: true }
1294
+ );
1295
+ schema8.index({ "location.geo": "2dsphere" });
1296
+ schema8.index({ name: 1 });
1297
+ schema8.index({ region: 1 });
1298
+ schema8.index({ deletedAt: 1 });
1299
+ schema8.index({ "dateTime.dateStatus": 1 });
1300
+ schema8.index({ slug: 1 });
1301
+ schema8.index({ reviewStatus: 1 });
1302
+ schema8.index({ description: "text", name: "text" });
1303
+ schema8.plugin(searchNamePlugin);
1304
+ var AiImportedMarketModel = import_mongoose11.default.models.AiImportedMarket || import_mongoose11.default.model("AiImportedMarket", schema8);
1305
+
1306
+ // src/mongoose/ScrapeSite.ts
1307
+ var import_mongoose12 = __toESM(require("mongoose"));
1308
+ var MongooseSchema8 = import_mongoose12.default.Schema;
1309
+ var schema9 = new MongooseSchema8(
1310
+ {
1311
+ enabled: { default: true, required: true, type: Boolean },
1312
+ lastError: { required: false, type: String },
1313
+ lastScrapedAt: { required: false, type: Date },
1314
+ lastScrapeStatus: { required: false, type: String },
1315
+ name: { required: true, type: String },
1316
+ regionHint: { required: false, type: String },
1317
+ url: { required: true, type: String }
1318
+ },
1319
+ { timestamps: true }
1320
+ );
1321
+ schema9.index({ url: 1 }, { unique: true });
1322
+ schema9.index({ enabled: 1 });
1323
+ var ScrapeSiteModel = import_mongoose12.default.models.ScrapeSite || import_mongoose12.default.model("ScrapeSite", schema9);
1324
+
1325
+ // src/mongoose/Notification.ts
1326
+ var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1327
+ var import_mongoose13 = __toESM(require("mongoose"));
1328
+ var MongooseSchema9 = import_mongoose13.default.Schema;
1329
+ var notificationDataSchema = new MongooseSchema9(
1177
1330
  {
1178
1331
  resourceId: { required: true, type: String },
1179
1332
  resourceName: { required: true, type: String },
1180
1333
  resourceType: {
1181
- enum: Object.values(import_cluemart_shared10.EnumNotificationResourceType),
1334
+ enum: Object.values(import_cluemart_shared11.EnumNotificationResourceType),
1182
1335
  required: true,
1183
1336
  type: String
1184
1337
  }
1185
1338
  },
1186
1339
  { _id: false }
1187
1340
  );
1188
- var schema7 = new MongooseSchema7(
1341
+ var schema10 = new MongooseSchema9(
1189
1342
  {
1190
1343
  data: {
1191
1344
  default: null,
@@ -1196,28 +1349,28 @@ var schema7 = new MongooseSchema7(
1196
1349
  message: { required: true, type: String },
1197
1350
  title: { required: true, type: String },
1198
1351
  type: {
1199
- default: import_cluemart_shared10.EnumNotificationType.SYSTEM,
1200
- enum: Object.values(import_cluemart_shared10.EnumNotificationType),
1352
+ default: import_cluemart_shared11.EnumNotificationType.SYSTEM,
1353
+ enum: Object.values(import_cluemart_shared11.EnumNotificationType),
1201
1354
  required: true,
1202
1355
  type: String
1203
1356
  },
1204
1357
  userId: {
1205
1358
  ref: "User",
1206
1359
  required: true,
1207
- type: import_mongoose10.default.Schema.Types.ObjectId
1360
+ type: import_mongoose13.default.Schema.Types.ObjectId
1208
1361
  }
1209
1362
  },
1210
1363
  { timestamps: true }
1211
1364
  );
1212
- schema7.index({ isRead: 1, userId: 1 });
1213
- schema7.index({ createdAt: -1, userId: 1 });
1214
- var NotificationModel = import_mongoose10.default.models.Notification || import_mongoose10.default.model("Notification", schema7);
1365
+ schema10.index({ isRead: 1, userId: 1 });
1366
+ schema10.index({ createdAt: -1, userId: 1 });
1367
+ var NotificationModel = import_mongoose13.default.models.Notification || import_mongoose13.default.model("Notification", schema10);
1215
1368
 
1216
1369
  // src/mongoose/PushToken.ts
1217
1370
  var import_enums = require("@timardex/cluemart-shared/enums");
1218
- var import_mongoose11 = __toESM(require("mongoose"));
1219
- var MongooseSchema8 = import_mongoose11.default.Schema;
1220
- var schema8 = new MongooseSchema8(
1371
+ var import_mongoose14 = __toESM(require("mongoose"));
1372
+ var MongooseSchema10 = import_mongoose14.default.Schema;
1373
+ var schema11 = new MongooseSchema10(
1221
1374
  {
1222
1375
  platform: {
1223
1376
  enum: Object.values(import_enums.EnumOSPlatform),
@@ -1228,22 +1381,22 @@ var schema8 = new MongooseSchema8(
1228
1381
  userId: {
1229
1382
  ref: "User",
1230
1383
  required: true,
1231
- type: import_mongoose11.default.Schema.Types.ObjectId
1384
+ type: import_mongoose14.default.Schema.Types.ObjectId
1232
1385
  }
1233
1386
  },
1234
1387
  { timestamps: true }
1235
1388
  );
1236
- var PushTokenModel = import_mongoose11.default.models.PushToken || import_mongoose11.default.model("PushToken", schema8);
1389
+ var PushTokenModel = import_mongoose14.default.models.PushToken || import_mongoose14.default.model("PushToken", schema11);
1237
1390
 
1238
1391
  // src/mongoose/Relation.ts
1239
- var import_cluemart_shared12 = require("@timardex/cluemart-shared");
1240
- var import_mongoose13 = __toESM(require("mongoose"));
1392
+ var import_cluemart_shared13 = require("@timardex/cluemart-shared");
1393
+ var import_mongoose16 = __toESM(require("mongoose"));
1241
1394
 
1242
1395
  // src/mongoose/event/EventInfo.ts
1243
- var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1244
- var import_mongoose12 = __toESM(require("mongoose"));
1245
- var MongooseSchema9 = import_mongoose12.default.Schema;
1246
- var StallTypeSchema = new MongooseSchema9(
1396
+ var import_cluemart_shared12 = require("@timardex/cluemart-shared");
1397
+ var import_mongoose15 = __toESM(require("mongoose"));
1398
+ var MongooseSchema11 = import_mongoose15.default.Schema;
1399
+ var StallTypeSchema = new MongooseSchema11(
1247
1400
  {
1248
1401
  label: { required: false, type: String },
1249
1402
  price: { required: false, type: Number },
@@ -1254,10 +1407,10 @@ var StallTypeSchema = new MongooseSchema9(
1254
1407
  // Prevents Mongoose from creating an additional _id field for subdocuments
1255
1408
  }
1256
1409
  );
1257
- var dateTimeSchema2 = new MongooseSchema9(
1410
+ var dateTimeSchema2 = new MongooseSchema11(
1258
1411
  {
1259
1412
  dateStatus: {
1260
- enum: Object.values(import_cluemart_shared11.EnumEventDateStatus),
1413
+ enum: Object.values(import_cluemart_shared12.EnumEventDateStatus),
1261
1414
  required: false,
1262
1415
  type: String
1263
1416
  },
@@ -1270,13 +1423,13 @@ var dateTimeSchema2 = new MongooseSchema9(
1270
1423
  { _id: false }
1271
1424
  // Prevents Mongoose from creating an additional _id field for subdocuments
1272
1425
  );
1273
- var paymentInfoSchema = new MongooseSchema9(
1426
+ var paymentInfoSchema = new MongooseSchema11(
1274
1427
  {
1275
1428
  accountHolderName: { required: false, type: String },
1276
1429
  accountNumber: { required: false, type: String },
1277
1430
  link: { required: false, type: String },
1278
1431
  paymentMethod: {
1279
- enum: Object.values(import_cluemart_shared11.EnumPaymentMethod),
1432
+ enum: Object.values(import_cluemart_shared12.EnumPaymentMethod),
1280
1433
  required: true,
1281
1434
  type: String
1282
1435
  }
@@ -1284,7 +1437,7 @@ var paymentInfoSchema = new MongooseSchema9(
1284
1437
  { _id: false }
1285
1438
  // Prevents Mongoose from creating an additional _id field
1286
1439
  );
1287
- var requirementsSchema = new MongooseSchema9(
1440
+ var requirementsSchema = new MongooseSchema11(
1288
1441
  {
1289
1442
  category: { required: true, type: String },
1290
1443
  label: { required: true, type: String },
@@ -1295,7 +1448,7 @@ var requirementsSchema = new MongooseSchema9(
1295
1448
  // Prevents Mongoose from creating an additional _id field for
1296
1449
  }
1297
1450
  );
1298
- var refundPolicySchema = new MongooseSchema9(
1451
+ var refundPolicySchema = new MongooseSchema11(
1299
1452
  {
1300
1453
  category: { required: true, type: String },
1301
1454
  label: { required: true, type: String },
@@ -1303,7 +1456,7 @@ var refundPolicySchema = new MongooseSchema9(
1303
1456
  },
1304
1457
  { _id: false }
1305
1458
  );
1306
- var schema9 = new MongooseSchema9(
1459
+ var schema12 = new MongooseSchema11(
1307
1460
  {
1308
1461
  active: { default: true, type: Boolean },
1309
1462
  applicationDeadlineHours: { required: true, type: Number },
@@ -1311,7 +1464,7 @@ var schema9 = new MongooseSchema9(
1311
1464
  eventId: {
1312
1465
  ref: "Event",
1313
1466
  required: true,
1314
- type: import_mongoose12.default.Schema.Types.ObjectId
1467
+ type: import_mongoose15.default.Schema.Types.ObjectId
1315
1468
  },
1316
1469
  packInTime: { required: true, type: Number },
1317
1470
  paymentDueHours: { required: true, type: Number },
@@ -1321,15 +1474,15 @@ var schema9 = new MongooseSchema9(
1321
1474
  },
1322
1475
  { timestamps: true }
1323
1476
  );
1324
- schema9.index({ eventId: 1 });
1325
- var EventInfoModel = import_mongoose12.default.models.EventInfo || import_mongoose12.default.model("EventInfo", schema9);
1477
+ schema12.index({ eventId: 1 });
1478
+ var EventInfoModel = import_mongoose15.default.models.EventInfo || import_mongoose15.default.model("EventInfo", schema12);
1326
1479
 
1327
1480
  // src/mongoose/Relation.ts
1328
- var MongooseSchema10 = import_mongoose13.default.Schema;
1329
- var relationDateTimeSchema = new MongooseSchema10(
1481
+ var MongooseSchema12 = import_mongoose16.default.Schema;
1482
+ var relationDateTimeSchema = new MongooseSchema12(
1330
1483
  {
1331
1484
  dateStatus: {
1332
- enum: Object.values(import_cluemart_shared12.EnumEventDateStatus),
1485
+ enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
1333
1486
  required: true,
1334
1487
  type: String
1335
1488
  },
@@ -1341,7 +1494,7 @@ var relationDateTimeSchema = new MongooseSchema10(
1341
1494
  },
1342
1495
  { _id: false }
1343
1496
  );
1344
- var relationDatesSchema = new MongooseSchema10(
1497
+ var relationDatesSchema = new MongooseSchema12(
1345
1498
  {
1346
1499
  dateTime: {
1347
1500
  required: true,
@@ -1353,42 +1506,42 @@ var relationDatesSchema = new MongooseSchema10(
1353
1506
  },
1354
1507
  paymentReference: { required: false, type: String },
1355
1508
  status: {
1356
- enum: Object.values(import_cluemart_shared12.EnumInviteStatus),
1509
+ enum: Object.values(import_cluemart_shared13.EnumInviteStatus),
1357
1510
  required: false,
1358
1511
  type: String
1359
1512
  }
1360
1513
  },
1361
1514
  { _id: false }
1362
1515
  );
1363
- var RelationTypeSchema = new MongooseSchema10(
1516
+ var RelationTypeSchema = new MongooseSchema12(
1364
1517
  {
1365
1518
  active: { default: true, required: true, type: Boolean },
1366
1519
  chatId: {
1367
1520
  ref: "Chat",
1368
1521
  required: true,
1369
- type: import_mongoose13.default.Schema.Types.ObjectId
1522
+ type: import_mongoose16.default.Schema.Types.ObjectId
1370
1523
  },
1371
1524
  deletedAt: { default: null, required: false, type: Date },
1372
1525
  eventId: {
1373
1526
  ref: "Event",
1374
1527
  required: true,
1375
- type: import_mongoose13.default.Schema.Types.ObjectId
1528
+ type: import_mongoose16.default.Schema.Types.ObjectId
1376
1529
  },
1377
1530
  lastUpdateBy: {
1378
- enum: Object.values(import_cluemart_shared12.EnumResourceType),
1531
+ enum: Object.values(import_cluemart_shared13.EnumResourceType),
1379
1532
  required: true,
1380
1533
  type: String
1381
1534
  },
1382
1535
  relationDates: [relationDatesSchema],
1383
1536
  relationType: {
1384
- enum: Object.values(import_cluemart_shared12.EnumRelationResource),
1537
+ enum: Object.values(import_cluemart_shared13.EnumRelationResource),
1385
1538
  required: true,
1386
1539
  type: String
1387
1540
  },
1388
1541
  vendorId: {
1389
1542
  ref: "Vendor",
1390
1543
  required: true,
1391
- type: import_mongoose13.default.Schema.Types.ObjectId
1544
+ type: import_mongoose16.default.Schema.Types.ObjectId
1392
1545
  }
1393
1546
  },
1394
1547
  { timestamps: true }
@@ -1400,21 +1553,21 @@ RelationTypeSchema.index({
1400
1553
  "relationDates.status": 1,
1401
1554
  vendorId: 1
1402
1555
  });
1403
- var RelationModel = import_mongoose13.default.models.Relation || import_mongoose13.default.model("Relation", RelationTypeSchema);
1556
+ var RelationModel = import_mongoose16.default.models.Relation || import_mongoose16.default.model("Relation", RelationTypeSchema);
1404
1557
 
1405
1558
  // src/mongoose/ResourceActivity.ts
1406
- var import_cluemart_shared13 = require("@timardex/cluemart-shared");
1407
- var import_mongoose14 = __toESM(require("mongoose"));
1408
- var MongooseSchema11 = import_mongoose14.default.Schema;
1409
- var ActivitySchema = new MongooseSchema11(
1559
+ var import_cluemart_shared14 = require("@timardex/cluemart-shared");
1560
+ var import_mongoose17 = __toESM(require("mongoose"));
1561
+ var MongooseSchema13 = import_mongoose17.default.Schema;
1562
+ var ActivitySchema = new MongooseSchema13(
1410
1563
  {
1411
1564
  activityType: {
1412
- enum: Object.values(import_cluemart_shared13.EnumActivity),
1565
+ enum: Object.values(import_cluemart_shared14.EnumActivity),
1413
1566
  required: true,
1414
1567
  type: String
1415
1568
  },
1416
1569
  dateStatus: {
1417
- enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
1570
+ enum: Object.values(import_cluemart_shared14.EnumEventDateStatus),
1418
1571
  required: false,
1419
1572
  type: String
1420
1573
  },
@@ -1426,7 +1579,7 @@ var ActivitySchema = new MongooseSchema11(
1426
1579
  startTime: { required: false, type: String },
1427
1580
  timestamp: { default: Date.now, type: Date },
1428
1581
  userAgent: {
1429
- enum: Object.values(import_cluemart_shared13.EnumOSPlatform),
1582
+ enum: Object.values(import_cluemart_shared14.EnumOSPlatform),
1430
1583
  required: true,
1431
1584
  type: String
1432
1585
  },
@@ -1434,61 +1587,61 @@ var ActivitySchema = new MongooseSchema11(
1434
1587
  },
1435
1588
  { _id: false }
1436
1589
  );
1437
- var schema10 = new MongooseSchema11(
1590
+ var schema13 = new MongooseSchema13(
1438
1591
  {
1439
1592
  activity: { default: [], type: [ActivitySchema] },
1440
1593
  resourceId: { required: true, type: String },
1441
1594
  resourceType: {
1442
- enum: Object.values(import_cluemart_shared13.EnumResourceType),
1595
+ enum: Object.values(import_cluemart_shared14.EnumResourceType),
1443
1596
  required: true,
1444
1597
  type: String
1445
1598
  }
1446
1599
  },
1447
1600
  { timestamps: true }
1448
1601
  );
1449
- schema10.index({ resourceId: 1, resourceType: 1 }, { unique: true });
1450
- schema10.index({ "views.location": "2dsphere" });
1451
- var ResourceActivityModel = import_mongoose14.default.models.ResourceActivity || import_mongoose14.default.model("ResourceActivity", schema10);
1602
+ schema13.index({ resourceId: 1, resourceType: 1 }, { unique: true });
1603
+ schema13.index({ "views.location": "2dsphere" });
1604
+ var ResourceActivityModel = import_mongoose17.default.models.ResourceActivity || import_mongoose17.default.model("ResourceActivity", schema13);
1452
1605
 
1453
1606
  // src/mongoose/User.ts
1454
- var import_cluemart_shared14 = require("@timardex/cluemart-shared");
1455
- var import_mongoose15 = __toESM(require("mongoose"));
1456
- var MongooseSchema12 = import_mongoose15.default.Schema;
1457
- var userActivityEventSchema = new MongooseSchema12(
1607
+ var import_cluemart_shared15 = require("@timardex/cluemart-shared");
1608
+ var import_mongoose18 = __toESM(require("mongoose"));
1609
+ var MongooseSchema14 = import_mongoose18.default.Schema;
1610
+ var userActivityEventSchema = new MongooseSchema14(
1458
1611
  {
1459
1612
  dateTime: dateTimeSchema,
1460
1613
  resourceId: {
1461
1614
  ref: "Event",
1462
1615
  required: false,
1463
- type: import_mongoose15.default.Schema.Types.ObjectId
1616
+ type: import_mongoose18.default.Schema.Types.ObjectId
1464
1617
  }
1465
1618
  },
1466
1619
  { _id: false }
1467
1620
  );
1468
- var userActivityFavouritesSchema = new MongooseSchema12(
1621
+ var userActivityFavouritesSchema = new MongooseSchema14(
1469
1622
  {
1470
1623
  events: {
1471
1624
  ref: "Event",
1472
1625
  required: false,
1473
- type: [import_mongoose15.default.Schema.Types.ObjectId]
1626
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1474
1627
  },
1475
1628
  partners: {
1476
1629
  ref: "Partner",
1477
1630
  required: false,
1478
- type: [import_mongoose15.default.Schema.Types.ObjectId]
1631
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1479
1632
  },
1480
1633
  vendors: {
1481
1634
  ref: "Vendor",
1482
1635
  required: false,
1483
- type: [import_mongoose15.default.Schema.Types.ObjectId]
1636
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1484
1637
  }
1485
1638
  },
1486
1639
  { _id: false }
1487
1640
  );
1488
- var stripeSchema = new MongooseSchema12(
1641
+ var stripeSchema = new MongooseSchema14(
1489
1642
  {
1490
1643
  billingPeriod: {
1491
- enum: Object.values(import_cluemart_shared14.EnumBillingPeriod),
1644
+ enum: Object.values(import_cluemart_shared15.EnumBillingPeriod),
1492
1645
  required: false,
1493
1646
  type: String
1494
1647
  },
@@ -1497,7 +1650,7 @@ var stripeSchema = new MongooseSchema12(
1497
1650
  type: Boolean
1498
1651
  },
1499
1652
  currentPlan: {
1500
- enum: Object.values(import_cluemart_shared14.EnumUserLicence),
1653
+ enum: Object.values(import_cluemart_shared15.EnumUserLicence),
1501
1654
  required: false,
1502
1655
  type: String
1503
1656
  },
@@ -1522,7 +1675,7 @@ var stripeSchema = new MongooseSchema12(
1522
1675
  type: String
1523
1676
  },
1524
1677
  pendingBillingPeriod: {
1525
- enum: Object.values(import_cluemart_shared14.EnumBillingPeriod),
1678
+ enum: Object.values(import_cluemart_shared15.EnumBillingPeriod),
1526
1679
  required: false,
1527
1680
  type: String
1528
1681
  },
@@ -1531,7 +1684,7 @@ var stripeSchema = new MongooseSchema12(
1531
1684
  type: Date
1532
1685
  },
1533
1686
  pendingPlan: {
1534
- enum: Object.values(import_cluemart_shared14.EnumUserLicence),
1687
+ enum: Object.values(import_cluemart_shared15.EnumUserLicence),
1535
1688
  required: false,
1536
1689
  type: String
1537
1690
  },
@@ -1548,7 +1701,7 @@ var stripeSchema = new MongooseSchema12(
1548
1701
  type: Date
1549
1702
  },
1550
1703
  status: {
1551
- enum: Object.values(import_cluemart_shared14.EnumSubscriptionStatus),
1704
+ enum: Object.values(import_cluemart_shared15.EnumSubscriptionStatus),
1552
1705
  required: false,
1553
1706
  type: String
1554
1707
  },
@@ -1567,10 +1720,10 @@ var stripeSchema = new MongooseSchema12(
1567
1720
  },
1568
1721
  { _id: false }
1569
1722
  );
1570
- var redeemedRewardSchema = new MongooseSchema12(
1723
+ var redeemedRewardSchema = new MongooseSchema14(
1571
1724
  {
1572
1725
  name: {
1573
- enum: Object.values(import_cluemart_shared14.EnumReward),
1726
+ enum: Object.values(import_cluemart_shared15.EnumReward),
1574
1727
  required: true,
1575
1728
  type: String
1576
1729
  },
@@ -1579,12 +1732,12 @@ var redeemedRewardSchema = new MongooseSchema12(
1579
1732
  },
1580
1733
  { _id: false }
1581
1734
  );
1582
- var userOverallPointsSchema = new MongooseSchema12(
1735
+ var userOverallPointsSchema = new MongooseSchema14(
1583
1736
  {
1584
1737
  createdAt: { required: true, type: Date },
1585
1738
  points: { default: 0, required: true, type: Number },
1586
1739
  pointType: {
1587
- enum: Object.values(import_cluemart_shared14.EnumPointType),
1740
+ enum: Object.values(import_cluemart_shared15.EnumPointType),
1588
1741
  required: true,
1589
1742
  type: String
1590
1743
  },
@@ -1592,13 +1745,13 @@ var userOverallPointsSchema = new MongooseSchema12(
1592
1745
  },
1593
1746
  { _id: false }
1594
1747
  );
1595
- var schema11 = new MongooseSchema12(
1748
+ var schema14 = new MongooseSchema14(
1596
1749
  {
1597
1750
  active: { default: false, required: true, type: Boolean },
1598
1751
  affiliate: {
1599
1752
  ref: "Affiliate",
1600
1753
  required: false,
1601
- type: import_mongoose15.default.Schema.Types.ObjectId
1754
+ type: import_mongoose18.default.Schema.Types.ObjectId
1602
1755
  },
1603
1756
  avatar: {
1604
1757
  required: false,
@@ -1607,28 +1760,28 @@ var schema11 = new MongooseSchema12(
1607
1760
  coupon: {
1608
1761
  ref: "Coupon",
1609
1762
  required: false,
1610
- type: import_mongoose15.default.Schema.Types.ObjectId
1763
+ type: import_mongoose18.default.Schema.Types.ObjectId
1611
1764
  },
1612
1765
  deletedAt: { default: null, required: false, type: Date },
1613
1766
  email: { required: true, type: String },
1614
1767
  emailSentFor: {
1615
- enum: Object.values(import_cluemart_shared14.EnumNotificationResourceType),
1768
+ enum: Object.values(import_cluemart_shared15.EnumNotificationResourceType),
1616
1769
  required: false,
1617
1770
  type: [String]
1618
1771
  },
1619
1772
  events: {
1620
1773
  ref: "Event",
1621
1774
  required: false,
1622
- type: [import_mongoose15.default.Schema.Types.ObjectId]
1775
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1623
1776
  },
1624
1777
  firstName: { required: true, type: String },
1625
1778
  game: {
1626
1779
  ref: "Game",
1627
1780
  required: false,
1628
- type: import_mongoose15.default.Schema.Types.ObjectId
1781
+ type: import_mongoose18.default.Schema.Types.ObjectId
1629
1782
  },
1630
1783
  interests: {
1631
- enum: Object.values(import_cluemart_shared14.EnumResourceType),
1784
+ enum: Object.values(import_cluemart_shared15.EnumResourceType),
1632
1785
  required: false,
1633
1786
  type: [String]
1634
1787
  },
@@ -1651,11 +1804,11 @@ var schema11 = new MongooseSchema12(
1651
1804
  partner: {
1652
1805
  ref: "Partner",
1653
1806
  required: false,
1654
- type: import_mongoose15.default.Schema.Types.ObjectId
1807
+ type: import_mongoose18.default.Schema.Types.ObjectId
1655
1808
  },
1656
1809
  password: { required: true, type: String },
1657
1810
  platform: {
1658
- enum: Object.values(import_cluemart_shared14.EnumOSPlatform),
1811
+ enum: Object.values(import_cluemart_shared15.EnumOSPlatform),
1659
1812
  required: false,
1660
1813
  type: String
1661
1814
  },
@@ -1684,15 +1837,15 @@ var schema11 = new MongooseSchema12(
1684
1837
  type: String
1685
1838
  },
1686
1839
  roles: {
1687
- default: [import_cluemart_shared14.EnumUserRole.CUSTOMER],
1688
- enum: Object.values(import_cluemart_shared14.EnumUserRole),
1840
+ default: [import_cluemart_shared15.EnumUserRole.CUSTOMER],
1841
+ enum: Object.values(import_cluemart_shared15.EnumUserRole),
1689
1842
  required: true,
1690
1843
  type: [String]
1691
1844
  },
1692
1845
  school: {
1693
1846
  ref: "School",
1694
1847
  required: false,
1695
- type: import_mongoose15.default.Schema.Types.ObjectId
1848
+ type: import_mongoose18.default.Schema.Types.ObjectId
1696
1849
  },
1697
1850
  stripe: {
1698
1851
  required: false,
@@ -1717,21 +1870,21 @@ var schema11 = new MongooseSchema12(
1717
1870
  vendor: {
1718
1871
  ref: "Vendor",
1719
1872
  required: false,
1720
- type: import_mongoose15.default.Schema.Types.ObjectId
1873
+ type: import_mongoose18.default.Schema.Types.ObjectId
1721
1874
  }
1722
1875
  },
1723
1876
  { strict: false, timestamps: true }
1724
1877
  );
1725
- schema11.index({ "licences.expiryDate": 1 });
1726
- schema11.index({ "licences.licenceType": 1 });
1727
- schema11.index({ promoCodes: 1, active: 1, deletedAt: 1 });
1728
- schema11.index({ email: "text", firstName: "text", lastName: "text" });
1729
- var UserModel = import_mongoose15.default.models.User || import_mongoose15.default.model("User", schema11);
1878
+ schema14.index({ "licences.expiryDate": 1 });
1879
+ schema14.index({ "licences.licenceType": 1 });
1880
+ schema14.index({ promoCodes: 1, active: 1, deletedAt: 1 });
1881
+ schema14.index({ email: "text", firstName: "text", lastName: "text" });
1882
+ var UserModel = import_mongoose18.default.models.User || import_mongoose18.default.model("User", schema14);
1730
1883
 
1731
1884
  // src/mongoose/VerificationToken.ts
1732
- var import_mongoose16 = __toESM(require("mongoose"));
1733
- var MongooseSchema13 = import_mongoose16.default.Schema;
1734
- var schema12 = new MongooseSchema13(
1885
+ var import_mongoose19 = __toESM(require("mongoose"));
1886
+ var MongooseSchema15 = import_mongoose19.default.Schema;
1887
+ var schema15 = new MongooseSchema15(
1735
1888
  {
1736
1889
  createdAt: {
1737
1890
  default: Date.now,
@@ -1746,13 +1899,13 @@ var schema12 = new MongooseSchema13(
1746
1899
  },
1747
1900
  { timestamps: true }
1748
1901
  );
1749
- var VerificationTokenModel = import_mongoose16.default.models.VerificationToken || import_mongoose16.default.model("VerificationToken", schema12);
1902
+ var VerificationTokenModel = import_mongoose19.default.models.VerificationToken || import_mongoose19.default.model("VerificationToken", schema15);
1750
1903
 
1751
1904
  // src/mongoose/vendor/Vendor.ts
1752
- var import_cluemart_shared15 = require("@timardex/cluemart-shared");
1753
- var import_mongoose17 = __toESM(require("mongoose"));
1754
- var MongooseSchema14 = import_mongoose17.default.Schema;
1755
- var vendorProductTypeSchema = new MongooseSchema14(
1905
+ var import_cluemart_shared16 = require("@timardex/cluemart-shared");
1906
+ var import_mongoose20 = __toESM(require("mongoose"));
1907
+ var MongooseSchema16 = import_mongoose20.default.Schema;
1908
+ var vendorProductTypeSchema = new MongooseSchema16(
1756
1909
  {
1757
1910
  description: { required: false, type: String },
1758
1911
  name: { required: true, type: String },
@@ -1763,18 +1916,18 @@ var vendorProductTypeSchema = new MongooseSchema14(
1763
1916
  },
1764
1917
  { timestamps: true }
1765
1918
  );
1766
- var productWrapperSchema = new MongooseSchema14(
1919
+ var productWrapperSchema = new MongooseSchema16(
1767
1920
  {
1768
1921
  active: { default: false, required: false, type: Boolean },
1769
1922
  productsList: { required: false, type: [vendorProductTypeSchema] }
1770
1923
  },
1771
1924
  { _id: false }
1772
1925
  );
1773
- var calendarSchema = new MongooseSchema14(
1926
+ var calendarSchema = new MongooseSchema16(
1774
1927
  {
1775
1928
  dateTime: {
1776
1929
  dateStatus: {
1777
- enum: Object.values(import_cluemart_shared15.EnumEventDateStatus),
1930
+ enum: Object.values(import_cluemart_shared16.EnumEventDateStatus),
1778
1931
  required: false,
1779
1932
  type: String
1780
1933
  },
@@ -1791,14 +1944,14 @@ var calendarSchema = new MongooseSchema14(
1791
1944
  },
1792
1945
  { _id: false }
1793
1946
  );
1794
- var calendarWrapperSchema = new MongooseSchema14(
1947
+ var calendarWrapperSchema = new MongooseSchema16(
1795
1948
  {
1796
1949
  active: { default: false, required: true, type: Boolean },
1797
1950
  calendarData: { required: false, type: [calendarSchema] }
1798
1951
  },
1799
1952
  { _id: false }
1800
1953
  );
1801
- var vendorAvailabilitySchema = new MongooseSchema14(
1954
+ var vendorAvailabilitySchema = new MongooseSchema16(
1802
1955
  {
1803
1956
  corporate: { default: false, required: false, type: Boolean },
1804
1957
  private: { default: false, required: false, type: Boolean },
@@ -1806,7 +1959,7 @@ var vendorAvailabilitySchema = new MongooseSchema14(
1806
1959
  },
1807
1960
  { _id: false }
1808
1961
  );
1809
- var downgradeSnapshotSchema = new MongooseSchema14(
1962
+ var downgradeSnapshotSchema = new MongooseSchema16(
1810
1963
  {
1811
1964
  availability: { required: false, type: vendorAvailabilitySchema },
1812
1965
  calendarActive: { required: false, type: Boolean },
@@ -1814,7 +1967,7 @@ var downgradeSnapshotSchema = new MongooseSchema14(
1814
1967
  },
1815
1968
  { _id: false }
1816
1969
  );
1817
- var schema13 = new MongooseSchema14(
1970
+ var schema16 = new MongooseSchema16(
1818
1971
  {
1819
1972
  ...baseResourceFields,
1820
1973
  // Importing base resource fields from global.ts
@@ -1833,47 +1986,47 @@ var schema13 = new MongooseSchema14(
1833
1986
  unregisteredVendorId: {
1834
1987
  ref: "UnregisteredVendor",
1835
1988
  required: false,
1836
- type: import_mongoose17.default.Schema.Types.ObjectId
1989
+ type: import_mongoose20.default.Schema.Types.ObjectId
1837
1990
  },
1838
1991
  vendorInfoId: {
1839
1992
  ref: "VendorInfo",
1840
1993
  required: false,
1841
- type: import_mongoose17.default.Schema.Types.ObjectId
1994
+ type: import_mongoose20.default.Schema.Types.ObjectId
1842
1995
  },
1843
1996
  vendorType: {
1844
- enum: Object.values(import_cluemart_shared15.EnumVendorType),
1997
+ enum: Object.values(import_cluemart_shared16.EnumVendorType),
1845
1998
  required: true,
1846
1999
  type: String
1847
2000
  }
1848
2001
  },
1849
2002
  { timestamps: true }
1850
2003
  );
1851
- schema13.index({ name: 1 });
1852
- schema13.index({ description: 1 });
1853
- schema13.index({ region: 1 });
1854
- schema13.index({ "categories.name": 1 });
1855
- schema13.index({ slug: 1 });
1856
- schema13.index({
2004
+ schema16.index({ name: 1 });
2005
+ schema16.index({ description: 1 });
2006
+ schema16.index({ region: 1 });
2007
+ schema16.index({ "categories.name": 1 });
2008
+ schema16.index({ slug: 1 });
2009
+ schema16.index({
1857
2010
  categoriesNames: "text",
1858
2011
  description: "text",
1859
2012
  name: "text"
1860
2013
  });
1861
- schema13.index({ deletedAt: 1, "owner.userId": 1 });
1862
- schema13.plugin(searchNamePlugin);
1863
- var VendorModel = import_mongoose17.default.models.Vendor || import_mongoose17.default.model("Vendor", schema13);
2014
+ schema16.index({ deletedAt: 1, "owner.userId": 1 });
2015
+ schema16.plugin(searchNamePlugin);
2016
+ var VendorModel = import_mongoose20.default.models.Vendor || import_mongoose20.default.model("Vendor", schema16);
1864
2017
 
1865
2018
  // src/mongoose/vendor/VendorInfo.ts
1866
- var import_cluemart_shared16 = require("@timardex/cluemart-shared");
1867
- var import_mongoose18 = __toESM(require("mongoose"));
1868
- var MongooseSchema15 = import_mongoose18.default.Schema;
1869
- var AttributesSchema = new MongooseSchema15(
2019
+ var import_cluemart_shared17 = require("@timardex/cluemart-shared");
2020
+ var import_mongoose21 = __toESM(require("mongoose"));
2021
+ var MongooseSchema17 = import_mongoose21.default.Schema;
2022
+ var AttributesSchema = new MongooseSchema17(
1870
2023
  {
1871
2024
  details: { required: false, type: String },
1872
2025
  isRequired: { default: false, required: true, type: Boolean }
1873
2026
  },
1874
2027
  { _id: false }
1875
2028
  );
1876
- var schema14 = new MongooseSchema15(
2029
+ var schema17 = new MongooseSchema17(
1877
2030
  {
1878
2031
  active: { default: true, type: Boolean },
1879
2032
  compliance: {
@@ -1883,7 +2036,7 @@ var schema14 = new MongooseSchema15(
1883
2036
  documents: [ResourceImageTypeSchema],
1884
2037
  product: {
1885
2038
  foodFlavors: {
1886
- enum: Object.values(import_cluemart_shared16.EnumFoodFlavor),
2039
+ enum: Object.values(import_cluemart_shared17.EnumFoodFlavor),
1887
2040
  required: true,
1888
2041
  type: [String]
1889
2042
  },
@@ -1908,29 +2061,29 @@ var schema14 = new MongooseSchema15(
1908
2061
  vendorId: {
1909
2062
  ref: "Vendor",
1910
2063
  required: true,
1911
- type: import_mongoose18.default.Schema.Types.ObjectId
2064
+ type: import_mongoose21.default.Schema.Types.ObjectId
1912
2065
  }
1913
2066
  },
1914
2067
  { timestamps: true }
1915
2068
  );
1916
- schema14.index({ vendorId: 1 });
1917
- var VendorInfoModel = import_mongoose18.default.models.VendorInfo || import_mongoose18.default.model("VendorInfo", schema14);
2069
+ schema17.index({ vendorId: 1 });
2070
+ var VendorInfoModel = import_mongoose21.default.models.VendorInfo || import_mongoose21.default.model("VendorInfo", schema17);
1918
2071
 
1919
2072
  // src/mongoose/vendor/UnregisteredVendor.ts
1920
- var import_mongoose19 = __toESM(require("mongoose"));
1921
- var MongooseSchema16 = import_mongoose19.default.Schema;
1922
- var invitationSchema = new MongooseSchema16(
2073
+ var import_mongoose22 = __toESM(require("mongoose"));
2074
+ var MongooseSchema18 = import_mongoose22.default.Schema;
2075
+ var invitationSchema = new MongooseSchema18(
1923
2076
  {
1924
2077
  dateTime: { required: true, type: [dateTimeSchema] },
1925
2078
  inviterId: {
1926
2079
  ref: "Event",
1927
2080
  required: true,
1928
- type: import_mongoose19.default.Schema.Types.ObjectId
2081
+ type: import_mongoose22.default.Schema.Types.ObjectId
1929
2082
  }
1930
2083
  },
1931
2084
  { _id: false }
1932
2085
  );
1933
- var schema15 = new MongooseSchema16(
2086
+ var schema18 = new MongooseSchema18(
1934
2087
  {
1935
2088
  active: { default: true, required: true, type: Boolean },
1936
2089
  categoryIds: { required: true, type: [String] },
@@ -1939,7 +2092,7 @@ var schema15 = new MongooseSchema16(
1939
2092
  claimedByUserId: {
1940
2093
  ref: "User",
1941
2094
  required: false,
1942
- type: import_mongoose19.default.Schema.Types.ObjectId
2095
+ type: import_mongoose22.default.Schema.Types.ObjectId
1943
2096
  },
1944
2097
  claimInitiatedAt: { default: null, required: false, type: Date },
1945
2098
  claimToken: { default: null, required: false, type: String },
@@ -1952,15 +2105,15 @@ var schema15 = new MongooseSchema16(
1952
2105
  },
1953
2106
  { timestamps: true }
1954
2107
  );
1955
- schema15.index({ name: 1 });
1956
- schema15.index({ email: 1 });
1957
- var UnregisteredVendorModel = import_mongoose19.default.models.UnregisteredVendor || import_mongoose19.default.model("UnregisteredVendor", schema15);
2108
+ schema18.index({ name: 1 });
2109
+ schema18.index({ email: 1 });
2110
+ var UnregisteredVendorModel = import_mongoose22.default.models.UnregisteredVendor || import_mongoose22.default.model("UnregisteredVendor", schema18);
1958
2111
 
1959
2112
  // src/mongoose/event/Event.ts
1960
- var import_cluemart_shared17 = require("@timardex/cluemart-shared");
1961
- var import_mongoose20 = __toESM(require("mongoose"));
1962
- var MongooseSchema17 = import_mongoose20.default.Schema;
1963
- var schema16 = new MongooseSchema17(
2113
+ var import_cluemart_shared18 = require("@timardex/cluemart-shared");
2114
+ var import_mongoose23 = __toESM(require("mongoose"));
2115
+ var MongooseSchema19 = import_mongoose23.default.Schema;
2116
+ var schema19 = new MongooseSchema19(
1964
2117
  {
1965
2118
  ...baseResourceFields,
1966
2119
  // Importing base resource fields from global.ts
@@ -1969,10 +2122,10 @@ var schema16 = new MongooseSchema17(
1969
2122
  eventInfoId: {
1970
2123
  ref: "EventInfo",
1971
2124
  required: false,
1972
- type: import_mongoose20.default.Schema.Types.ObjectId
2125
+ type: import_mongoose23.default.Schema.Types.ObjectId
1973
2126
  },
1974
2127
  eventType: {
1975
- enum: Object.values(import_cluemart_shared17.EnumEventType),
2128
+ enum: Object.values(import_cluemart_shared18.EnumEventType),
1976
2129
  required: true,
1977
2130
  type: String
1978
2131
  },
@@ -1993,40 +2146,40 @@ var schema16 = new MongooseSchema17(
1993
2146
  },
1994
2147
  { timestamps: true }
1995
2148
  );
1996
- schema16.index({ name: 1 });
1997
- schema16.index({ description: 1 });
1998
- schema16.index({ region: 1 });
1999
- schema16.index({ "location.geo": "2dsphere" });
2000
- schema16.index({ tags: 1 });
2001
- schema16.index({ deletedAt: 1 });
2002
- schema16.index({ "dateTime.dateStatus": 1 });
2003
- schema16.index({ slug: 1 });
2004
- schema16.index({ description: "text", name: "text", tags: "text" });
2005
- schema16.index({ deletedAt: 1, "owner.userId": 1 });
2006
- schema16.plugin(searchNamePlugin);
2007
- var EventModel = import_mongoose20.default.models.Event || import_mongoose20.default.model("Event", schema16);
2149
+ schema19.index({ name: 1 });
2150
+ schema19.index({ description: 1 });
2151
+ schema19.index({ region: 1 });
2152
+ schema19.index({ "location.geo": "2dsphere" });
2153
+ schema19.index({ tags: 1 });
2154
+ schema19.index({ deletedAt: 1 });
2155
+ schema19.index({ "dateTime.dateStatus": 1 });
2156
+ schema19.index({ slug: 1 });
2157
+ schema19.index({ description: "text", name: "text", tags: "text" });
2158
+ schema19.index({ deletedAt: 1, "owner.userId": 1 });
2159
+ schema19.plugin(searchNamePlugin);
2160
+ var EventModel = import_mongoose23.default.models.Event || import_mongoose23.default.model("Event", schema19);
2008
2161
 
2009
2162
  // src/mongoose/event/EventDateArchive.ts
2010
- var import_mongoose21 = __toESM(require("mongoose"));
2011
- var schema17 = new import_mongoose21.default.Schema(
2163
+ var import_mongoose24 = __toESM(require("mongoose"));
2164
+ var schema20 = new import_mongoose24.default.Schema(
2012
2165
  {
2013
2166
  dateTime: { required: true, type: [dateTimeSchema] },
2014
2167
  eventId: {
2015
2168
  ref: "Event",
2016
2169
  required: true,
2017
- type: import_mongoose21.default.Schema.Types.ObjectId
2170
+ type: import_mongoose24.default.Schema.Types.ObjectId
2018
2171
  }
2019
2172
  },
2020
2173
  { timestamps: true }
2021
2174
  );
2022
- schema17.index({ eventId: 1 }, { unique: true });
2023
- var EventDateArchiveModel = import_mongoose21.default.models.EventDateArchive || import_mongoose21.default.model("EventDateArchive", schema17);
2175
+ schema20.index({ eventId: 1 }, { unique: true });
2176
+ var EventDateArchiveModel = import_mongoose24.default.models.EventDateArchive || import_mongoose24.default.model("EventDateArchive", schema20);
2024
2177
 
2025
2178
  // src/mongoose/Partner.ts
2026
- var import_cluemart_shared18 = require("@timardex/cluemart-shared");
2027
- var import_mongoose22 = __toESM(require("mongoose"));
2028
- var MongooseSchema18 = import_mongoose22.default.Schema;
2029
- var schema18 = new MongooseSchema18(
2179
+ var import_cluemart_shared19 = require("@timardex/cluemart-shared");
2180
+ var import_mongoose25 = __toESM(require("mongoose"));
2181
+ var MongooseSchema20 = import_mongoose25.default.Schema;
2182
+ var schema21 = new MongooseSchema20(
2030
2183
  {
2031
2184
  ...baseResourceFields,
2032
2185
  location: {
@@ -2035,53 +2188,53 @@ var schema18 = new MongooseSchema18(
2035
2188
  },
2036
2189
  nzbn: { required: true, type: String },
2037
2190
  partnerType: {
2038
- enum: Object.values(import_cluemart_shared18.EnumPartnerType),
2191
+ enum: Object.values(import_cluemart_shared19.EnumPartnerType),
2039
2192
  required: true,
2040
2193
  type: String
2041
2194
  }
2042
2195
  },
2043
2196
  { timestamps: true }
2044
2197
  );
2045
- schema18.index({ name: 1 });
2046
- schema18.index({ description: 1 });
2047
- schema18.index({ region: 1 });
2048
- schema18.index({ "location.geo": "2dsphere" });
2049
- schema18.index({ slug: 1 });
2050
- schema18.index({ name: "text", description: "text" });
2051
- schema18.index({ "owner.userId": 1, deletedAt: 1 });
2052
- schema18.plugin(searchNamePlugin);
2053
- var PartnerModel = import_mongoose22.default.models.Partner || import_mongoose22.default.model("Partner", schema18);
2198
+ schema21.index({ name: 1 });
2199
+ schema21.index({ description: 1 });
2200
+ schema21.index({ region: 1 });
2201
+ schema21.index({ "location.geo": "2dsphere" });
2202
+ schema21.index({ slug: 1 });
2203
+ schema21.index({ name: "text", description: "text" });
2204
+ schema21.index({ "owner.userId": 1, deletedAt: 1 });
2205
+ schema21.plugin(searchNamePlugin);
2206
+ var PartnerModel = import_mongoose25.default.models.Partner || import_mongoose25.default.model("Partner", schema21);
2054
2207
 
2055
2208
  // src/mongoose/Post.ts
2056
- var import_cluemart_shared19 = require("@timardex/cluemart-shared");
2057
- var import_mongoose23 = __toESM(require("mongoose"));
2058
- var MongooseSchema19 = import_mongoose23.default.Schema;
2059
- var contentSchema = new MongooseSchema19(
2209
+ var import_cluemart_shared20 = require("@timardex/cluemart-shared");
2210
+ var import_mongoose26 = __toESM(require("mongoose"));
2211
+ var MongooseSchema21 = import_mongoose26.default.Schema;
2212
+ var contentSchema = new MongooseSchema21(
2060
2213
  {
2061
- contentData: import_mongoose23.Schema.Types.Mixed,
2214
+ contentData: import_mongoose26.Schema.Types.Mixed,
2062
2215
  contentOrder: { required: true, type: Number },
2063
2216
  contentType: {
2064
- enum: Object.values(import_cluemart_shared19.EnumPostContentType),
2217
+ enum: Object.values(import_cluemart_shared20.EnumPostContentType),
2065
2218
  required: true,
2066
2219
  type: String
2067
2220
  }
2068
2221
  },
2069
2222
  { _id: false }
2070
2223
  );
2071
- var resourceSchema = new MongooseSchema19(
2224
+ var resourceSchema = new MongooseSchema21(
2072
2225
  {
2073
2226
  resourceId: { required: true, type: String },
2074
2227
  resourceRegion: { required: true, type: String },
2075
2228
  resourceSlug: { required: true, type: String },
2076
2229
  resourceType: {
2077
- enum: Object.values(import_cluemart_shared19.EnumResourceType),
2230
+ enum: Object.values(import_cluemart_shared20.EnumResourceType),
2078
2231
  required: true,
2079
2232
  type: String
2080
2233
  }
2081
2234
  },
2082
2235
  { _id: false }
2083
2236
  );
2084
- var schema19 = new MongooseSchema19(
2237
+ var schema22 = new MongooseSchema21(
2085
2238
  {
2086
2239
  active: { default: false, required: true, type: Boolean },
2087
2240
  approvedAt: { default: null, required: false, type: Date },
@@ -2097,7 +2250,7 @@ var schema19 = new MongooseSchema19(
2097
2250
  },
2098
2251
  deletedAt: { default: null, required: false, type: Date },
2099
2252
  postType: {
2100
- enum: Object.values(import_cluemart_shared19.EnumPostType),
2253
+ enum: Object.values(import_cluemart_shared20.EnumPostType),
2101
2254
  required: true,
2102
2255
  type: String
2103
2256
  },
@@ -2112,16 +2265,16 @@ var schema19 = new MongooseSchema19(
2112
2265
  },
2113
2266
  { timestamps: true }
2114
2267
  );
2115
- schema19.index({ title: 1 });
2116
- schema19.index({ tags: 1 });
2117
- schema19.index({ postType: 1, slug: 1 }, { unique: true });
2118
- var PostModel = import_mongoose23.default.models.Post || import_mongoose23.default.model("Post", schema19);
2268
+ schema22.index({ title: 1 });
2269
+ schema22.index({ tags: 1 });
2270
+ schema22.index({ postType: 1, slug: 1 }, { unique: true });
2271
+ var PostModel = import_mongoose26.default.models.Post || import_mongoose26.default.model("Post", schema22);
2119
2272
 
2120
2273
  // src/mongoose/AppSetting.ts
2121
- var import_mongoose24 = __toESM(require("mongoose"));
2122
- var MongooseSchema20 = import_mongoose24.default.Schema;
2274
+ var import_mongoose27 = __toESM(require("mongoose"));
2275
+ var MongooseSchema22 = import_mongoose27.default.Schema;
2123
2276
  var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
2124
- var AppSettingSchema = new MongooseSchema20(
2277
+ var AppSettingSchema = new MongooseSchema22(
2125
2278
  {
2126
2279
  activeSchoolsStudentCountTotal: {
2127
2280
  default: 0,
@@ -2143,6 +2296,8 @@ var AppSettingSchema = new MongooseSchema20(
2143
2296
  validate: Number.isInteger
2144
2297
  },
2145
2298
  mobileDisplayEnabled: { default: false, required: true, type: Boolean },
2299
+ purchasePricing: { type: MongooseSchema22.Types.Mixed },
2300
+ regionPricing: { type: MongooseSchema22.Types.Mixed },
2146
2301
  paidSlotsPerPlacement: { enum: [30], type: Number },
2147
2302
  reservedSlotsPerPlacement: { enum: [7], type: Number },
2148
2303
  rotationSeconds: { enum: [8], type: Number },
@@ -2167,12 +2322,12 @@ var AppSettingSchema = new MongooseSchema20(
2167
2322
  },
2168
2323
  { timestamps: true }
2169
2324
  );
2170
- var AppSettingModel = import_mongoose24.default.models.AppSetting || import_mongoose24.default.model("AppSetting", AppSettingSchema);
2325
+ var AppSettingModel = import_mongoose27.default.models.AppSetting || import_mongoose27.default.model("AppSetting", AppSettingSchema);
2171
2326
 
2172
2327
  // src/mongoose/AuthHandoffToken.ts
2173
- var import_mongoose25 = __toESM(require("mongoose"));
2174
- var MongooseSchema21 = import_mongoose25.default.Schema;
2175
- var schema20 = new MongooseSchema21(
2328
+ var import_mongoose28 = __toESM(require("mongoose"));
2329
+ var MongooseSchema23 = import_mongoose28.default.Schema;
2330
+ var schema23 = new MongooseSchema23(
2176
2331
  {
2177
2332
  expiresAt: { required: true, type: Date },
2178
2333
  jti: { index: true, required: true, type: String, unique: true },
@@ -2181,25 +2336,25 @@ var schema20 = new MongooseSchema21(
2181
2336
  index: true,
2182
2337
  ref: "User",
2183
2338
  required: true,
2184
- type: import_mongoose25.default.Schema.Types.ObjectId
2339
+ type: import_mongoose28.default.Schema.Types.ObjectId
2185
2340
  }
2186
2341
  },
2187
2342
  { timestamps: true }
2188
2343
  );
2189
- schema20.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
2190
- var AuthHandoffTokenModel = import_mongoose25.default.models.AuthHandoffToken || import_mongoose25.default.model("AuthHandoffToken", schema20);
2344
+ schema23.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
2345
+ var AuthHandoffTokenModel = import_mongoose28.default.models.AuthHandoffToken || import_mongoose28.default.model("AuthHandoffToken", schema23);
2191
2346
 
2192
2347
  // src/mongoose/game/Game.ts
2193
- var import_cluemart_shared20 = require("@timardex/cluemart-shared");
2194
- var import_mongoose29 = __toESM(require("mongoose"));
2348
+ var import_cluemart_shared21 = require("@timardex/cluemart-shared");
2349
+ var import_mongoose32 = __toESM(require("mongoose"));
2195
2350
 
2196
2351
  // src/mongoose/game/DailyClue.ts
2197
- var import_mongoose27 = __toESM(require("mongoose"));
2352
+ var import_mongoose30 = __toESM(require("mongoose"));
2198
2353
 
2199
2354
  // src/mongoose/game/utils.ts
2200
- var import_mongoose26 = __toESM(require("mongoose"));
2201
- var MongooseSchema22 = import_mongoose26.default.Schema;
2202
- var schemaGameDate = new MongooseSchema22(
2355
+ var import_mongoose29 = __toESM(require("mongoose"));
2356
+ var MongooseSchema24 = import_mongoose29.default.Schema;
2357
+ var schemaGameDate = new MongooseSchema24(
2203
2358
  {
2204
2359
  endDate: { required: true, type: Date },
2205
2360
  startDate: { required: true, type: Date }
@@ -2208,8 +2363,8 @@ var schemaGameDate = new MongooseSchema22(
2208
2363
  );
2209
2364
 
2210
2365
  // src/mongoose/game/DailyClue.ts
2211
- var MongooseSchema23 = import_mongoose27.default.Schema;
2212
- var schemaLetters = new MongooseSchema23(
2366
+ var MongooseSchema25 = import_mongoose30.default.Schema;
2367
+ var schemaLetters = new MongooseSchema25(
2213
2368
  {
2214
2369
  collected: { required: false, type: [String] },
2215
2370
  solutionShuffled: { required: true, type: [String] }
@@ -2217,14 +2372,14 @@ var schemaLetters = new MongooseSchema23(
2217
2372
  },
2218
2373
  { _id: false }
2219
2374
  );
2220
- var schemaDailyClueBaseGame = new MongooseSchema23(
2375
+ var schemaDailyClueBaseGame = new MongooseSchema25(
2221
2376
  {
2222
2377
  gameDate: { required: true, type: schemaGameDate },
2223
2378
  gameSolution: { required: true, type: String }
2224
2379
  },
2225
2380
  { _id: false }
2226
2381
  );
2227
- var schemaDailyClueGameData = new MongooseSchema23(
2382
+ var schemaDailyClueGameData = new MongooseSchema25(
2228
2383
  {
2229
2384
  gameFields: { required: true, type: schemaDailyClueBaseGame },
2230
2385
  lastFoundDate: { default: null, required: false, type: Date },
@@ -2239,9 +2394,9 @@ var schemaDailyClueGameData = new MongooseSchema23(
2239
2394
  );
2240
2395
 
2241
2396
  // src/mongoose/game/PuzzleGame.ts
2242
- var import_mongoose28 = __toESM(require("mongoose"));
2243
- var MongooseSchema24 = import_mongoose28.default.Schema;
2244
- var schemaPuzzleAnswer = new MongooseSchema24(
2397
+ var import_mongoose31 = __toESM(require("mongoose"));
2398
+ var MongooseSchema26 = import_mongoose31.default.Schema;
2399
+ var schemaPuzzleAnswer = new MongooseSchema26(
2245
2400
  {
2246
2401
  answer: { required: true, type: String },
2247
2402
  answerId: { required: true, type: String },
@@ -2249,7 +2404,7 @@ var schemaPuzzleAnswer = new MongooseSchema24(
2249
2404
  },
2250
2405
  { _id: false }
2251
2406
  );
2252
- var schemaPuzzleQuestion = new MongooseSchema24(
2407
+ var schemaPuzzleQuestion = new MongooseSchema26(
2253
2408
  {
2254
2409
  answers: { required: true, type: [schemaPuzzleAnswer] },
2255
2410
  question: { required: true, type: String },
@@ -2257,20 +2412,20 @@ var schemaPuzzleQuestion = new MongooseSchema24(
2257
2412
  },
2258
2413
  { _id: false }
2259
2414
  );
2260
- var schemaPuzzleBaseGame = new MongooseSchema24(
2415
+ var schemaPuzzleBaseGame = new MongooseSchema26(
2261
2416
  {
2262
2417
  questions: { required: true, type: [schemaPuzzleQuestion] }
2263
2418
  },
2264
2419
  { _id: false }
2265
2420
  );
2266
- var schemaPuzzleAnsweredQuestion = new MongooseSchema24(
2421
+ var schemaPuzzleAnsweredQuestion = new MongooseSchema26(
2267
2422
  {
2268
2423
  questionId: { required: true, type: String },
2269
2424
  selectedAnswerId: { required: true, type: String }
2270
2425
  },
2271
2426
  { _id: false }
2272
2427
  );
2273
- var schemaPuzzleGameData = new MongooseSchema24(
2428
+ var schemaPuzzleGameData = new MongooseSchema26(
2274
2429
  {
2275
2430
  answeredQuestions: {
2276
2431
  default: null,
@@ -2285,30 +2440,30 @@ var schemaPuzzleGameData = new MongooseSchema24(
2285
2440
  );
2286
2441
 
2287
2442
  // src/mongoose/game/Game.ts
2288
- var MongooseSchema25 = import_mongoose29.default.Schema;
2443
+ var MongooseSchema27 = import_mongoose32.default.Schema;
2289
2444
  var gameDataSchemas = {
2290
- [import_cluemart_shared20.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
2291
- [import_cluemart_shared20.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
2292
- [import_cluemart_shared20.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
2445
+ [import_cluemart_shared21.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
2446
+ [import_cluemart_shared21.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
2447
+ [import_cluemart_shared21.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
2293
2448
  };
2294
2449
  var gameDataDefinition = Object.fromEntries(
2295
- Object.entries(gameDataSchemas).map(([key, schema25]) => [
2450
+ Object.entries(gameDataSchemas).map(([key, schema28]) => [
2296
2451
  key,
2297
- { default: null, required: false, type: schema25 }
2452
+ { default: null, required: false, type: schema28 }
2298
2453
  ])
2299
2454
  );
2300
- var gameHistorySchema = new MongooseSchema25(
2455
+ var gameHistorySchema = new MongooseSchema27(
2301
2456
  {
2302
2457
  createdAt: { required: true, type: Date },
2303
2458
  gameDate: { required: true, type: schemaGameDate },
2304
2459
  gameStatus: {
2305
- enum: Object.values(import_cluemart_shared20.EnumGameStatus),
2460
+ enum: Object.values(import_cluemart_shared21.EnumGameStatus),
2306
2461
  required: true,
2307
2462
  type: String
2308
2463
  },
2309
2464
  gameTitle: { required: true, type: String },
2310
2465
  gameType: {
2311
- enum: Object.values(import_cluemart_shared20.EnumGameType),
2466
+ enum: Object.values(import_cluemart_shared21.EnumGameType),
2312
2467
  required: true,
2313
2468
  type: String
2314
2469
  },
@@ -2317,14 +2472,14 @@ var gameHistorySchema = new MongooseSchema25(
2317
2472
  },
2318
2473
  { _id: false }
2319
2474
  );
2320
- var gameTypeSchema = new MongooseSchema25(
2475
+ var gameTypeSchema = new MongooseSchema27(
2321
2476
  {
2322
2477
  active: { default: true, required: true, type: Boolean },
2323
2478
  gameData: gameDataDefinition,
2324
2479
  gameHistory: { default: [], required: true, type: [gameHistorySchema] },
2325
2480
  gameTitle: { required: true, type: String },
2326
2481
  gameType: {
2327
- enum: Object.values(import_cluemart_shared20.EnumGameType),
2482
+ enum: Object.values(import_cluemart_shared21.EnumGameType),
2328
2483
  required: true,
2329
2484
  type: String
2330
2485
  },
@@ -2335,7 +2490,7 @@ var gameTypeSchema = new MongooseSchema25(
2335
2490
  },
2336
2491
  { timestamps: true }
2337
2492
  );
2338
- var schema21 = new MongooseSchema25(
2493
+ var schema24 = new MongooseSchema27(
2339
2494
  {
2340
2495
  active: { default: false, required: true, type: Boolean },
2341
2496
  deletedAt: { default: null, required: false, type: Date },
@@ -2348,12 +2503,12 @@ var schema21 = new MongooseSchema25(
2348
2503
  },
2349
2504
  { timestamps: true }
2350
2505
  );
2351
- var GameModel = import_mongoose29.default.models.Game || import_mongoose29.default.model("Game", schema21);
2506
+ var GameModel = import_mongoose32.default.models.Game || import_mongoose32.default.model("Game", schema24);
2352
2507
 
2353
2508
  // src/mongoose/School.ts
2354
- var import_mongoose30 = __toESM(require("mongoose"));
2355
- var MongooseSchema26 = import_mongoose30.default.Schema;
2356
- var campaignsSchema = new MongooseSchema26(
2509
+ var import_mongoose33 = __toESM(require("mongoose"));
2510
+ var MongooseSchema28 = import_mongoose33.default.Schema;
2511
+ var campaignsSchema = new MongooseSchema28(
2357
2512
  {
2358
2513
  endDate: { required: true, type: Date },
2359
2514
  name: { required: true, type: String },
@@ -2361,7 +2516,7 @@ var campaignsSchema = new MongooseSchema26(
2361
2516
  },
2362
2517
  { _id: false }
2363
2518
  );
2364
- var schema22 = new MongooseSchema26(
2519
+ var schema25 = new MongooseSchema28(
2365
2520
  {
2366
2521
  // New schools are active by default
2367
2522
  active: { default: false, required: true, type: Boolean },
@@ -2388,26 +2543,26 @@ var schema22 = new MongooseSchema26(
2388
2543
  },
2389
2544
  { timestamps: true }
2390
2545
  );
2391
- schema22.index(
2546
+ schema25.index(
2392
2547
  { schoolCode: 1 },
2393
2548
  {
2394
2549
  partialFilterExpression: { active: true, deletedAt: null },
2395
2550
  unique: true
2396
2551
  }
2397
2552
  );
2398
- var SchoolModel = import_mongoose30.default.models.School || import_mongoose30.default.model("School", schema22);
2553
+ var SchoolModel = import_mongoose33.default.models.School || import_mongoose33.default.model("School", schema25);
2399
2554
 
2400
2555
  // src/mongoose/Affiliate.ts
2401
- var import_cluemart_shared21 = require("@timardex/cluemart-shared");
2402
- var import_mongoose31 = __toESM(require("mongoose"));
2403
- var MongooseSchema27 = import_mongoose31.default.Schema;
2404
- var affiliateRewardSchema = new MongooseSchema27(
2556
+ var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2557
+ var import_mongoose34 = __toESM(require("mongoose"));
2558
+ var MongooseSchema29 = import_mongoose34.default.Schema;
2559
+ var affiliateRewardSchema = new MongooseSchema29(
2405
2560
  {
2406
2561
  createdAt: { required: true, type: Date },
2407
2562
  redeemedAt: { default: null, required: false, type: Date },
2408
2563
  rewardDescription: { required: true, type: String },
2409
2564
  rewardType: {
2410
- enum: Object.values(import_cluemart_shared21.EnumAffiliateRewardType),
2565
+ enum: Object.values(import_cluemart_shared22.EnumAffiliateRewardType),
2411
2566
  required: true,
2412
2567
  type: String
2413
2568
  },
@@ -2415,13 +2570,13 @@ var affiliateRewardSchema = new MongooseSchema27(
2415
2570
  },
2416
2571
  { _id: false }
2417
2572
  );
2418
- var affiliateResourceSchema = new MongooseSchema27(
2573
+ var affiliateResourceSchema = new MongooseSchema29(
2419
2574
  {
2420
2575
  resourceActive: { default: true, required: true, type: Boolean },
2421
2576
  resourceDeletedAt: { default: null, required: false, type: Date },
2422
2577
  resourceId: {
2423
2578
  required: true,
2424
- type: import_mongoose31.default.Schema.Types.ObjectId
2579
+ type: import_mongoose34.default.Schema.Types.ObjectId
2425
2580
  },
2426
2581
  resourceName: { required: true, type: String },
2427
2582
  resourceOwner: {
@@ -2429,7 +2584,7 @@ var affiliateResourceSchema = new MongooseSchema27(
2429
2584
  type: OwnerTypeSchema
2430
2585
  },
2431
2586
  resourceType: {
2432
- enum: Object.values(import_cluemart_shared21.EnumResourceType),
2587
+ enum: Object.values(import_cluemart_shared22.EnumResourceType),
2433
2588
  required: true,
2434
2589
  type: String
2435
2590
  },
@@ -2441,20 +2596,20 @@ var affiliateResourceSchema = new MongooseSchema27(
2441
2596
  },
2442
2597
  { _id: false }
2443
2598
  );
2444
- var affiliateContactDetailsSchema = new MongooseSchema27(
2599
+ var affiliateContactDetailsSchema = new MongooseSchema29(
2445
2600
  {
2446
2601
  mobilePhone: { required: true, type: String }
2447
2602
  },
2448
2603
  { _id: false }
2449
2604
  );
2450
- var affiliateBankAccountDetailsSchema = new MongooseSchema27(
2605
+ var affiliateBankAccountDetailsSchema = new MongooseSchema29(
2451
2606
  {
2452
2607
  accountHolderName: { required: true, type: String },
2453
2608
  accountNumber: { required: true, type: String }
2454
2609
  },
2455
2610
  { _id: false }
2456
2611
  );
2457
- var affiliateDetailsSchema = new MongooseSchema27(
2612
+ var affiliateDetailsSchema = new MongooseSchema29(
2458
2613
  {
2459
2614
  bankAccountDetails: {
2460
2615
  required: true,
@@ -2467,7 +2622,7 @@ var affiliateDetailsSchema = new MongooseSchema27(
2467
2622
  lastName: { required: true, type: String },
2468
2623
  location: { required: true, type: locationsSchema },
2469
2624
  participantType: {
2470
- enum: Object.values(import_cluemart_shared21.EnumAffiliateParticipantType),
2625
+ enum: Object.values(import_cluemart_shared22.EnumAffiliateParticipantType),
2471
2626
  required: true,
2472
2627
  type: String
2473
2628
  },
@@ -2476,7 +2631,7 @@ var affiliateDetailsSchema = new MongooseSchema27(
2476
2631
  },
2477
2632
  { _id: false }
2478
2633
  );
2479
- var redeemHistorySchema = new MongooseSchema27(
2634
+ var redeemHistorySchema = new MongooseSchema29(
2480
2635
  {
2481
2636
  paidAt: { default: null, required: false, type: Date },
2482
2637
  redeemedAt: { required: true, type: Date },
@@ -2484,7 +2639,7 @@ var redeemHistorySchema = new MongooseSchema27(
2484
2639
  },
2485
2640
  { _id: false }
2486
2641
  );
2487
- var schema23 = new MongooseSchema27(
2642
+ var schema26 = new MongooseSchema29(
2488
2643
  {
2489
2644
  active: { default: false, required: true, type: Boolean },
2490
2645
  affiliateBonusRewards: {
@@ -2514,26 +2669,26 @@ var schema23 = new MongooseSchema27(
2514
2669
  },
2515
2670
  { timestamps: true }
2516
2671
  );
2517
- schema23.index(
2672
+ schema26.index(
2518
2673
  { affiliateCode: 1 },
2519
2674
  {
2520
2675
  partialFilterExpression: { active: true, deletedAt: null },
2521
2676
  unique: true
2522
2677
  }
2523
2678
  );
2524
- var AffiliateModel = import_mongoose31.default.models.Affiliate || import_mongoose31.default.model("Affiliate", schema23);
2679
+ var AffiliateModel = import_mongoose34.default.models.Affiliate || import_mongoose34.default.model("Affiliate", schema26);
2525
2680
 
2526
2681
  // src/mongoose/Coupon.ts
2527
- var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2528
- var import_mongoose32 = __toESM(require("mongoose"));
2529
- var MongooseSchema28 = import_mongoose32.default.Schema;
2530
- var couponOptionSchema = new MongooseSchema28(
2682
+ var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2683
+ var import_mongoose35 = __toESM(require("mongoose"));
2684
+ var MongooseSchema30 = import_mongoose35.default.Schema;
2685
+ var couponOptionSchema = new MongooseSchema30(
2531
2686
  {
2532
2687
  buy: { required: false, type: Number },
2533
2688
  get: { required: false, type: Number },
2534
2689
  maxRewardCount: { required: false, type: Number },
2535
2690
  type: {
2536
- enum: Object.values(import_cluemart_shared22.EnumCouponQualificationType),
2691
+ enum: Object.values(import_cluemart_shared23.EnumCouponQualificationType),
2537
2692
  required: true,
2538
2693
  type: String
2539
2694
  },
@@ -2542,29 +2697,29 @@ var couponOptionSchema = new MongooseSchema28(
2542
2697
  },
2543
2698
  { _id: false }
2544
2699
  );
2545
- var couponVendorProductSchema = new MongooseSchema28(
2700
+ var couponVendorProductSchema = new MongooseSchema30(
2546
2701
  {
2547
2702
  couponId: {
2548
2703
  required: true,
2549
- type: import_mongoose32.default.Schema.Types.ObjectId
2704
+ type: import_mongoose35.default.Schema.Types.ObjectId
2550
2705
  },
2551
2706
  productId: {
2552
2707
  required: true,
2553
- type: import_mongoose32.default.Schema.Types.ObjectId
2708
+ type: import_mongoose35.default.Schema.Types.ObjectId
2554
2709
  },
2555
2710
  vendorCouponId: {
2556
2711
  required: false,
2557
- type: import_mongoose32.default.Schema.Types.ObjectId
2712
+ type: import_mongoose35.default.Schema.Types.ObjectId
2558
2713
  },
2559
2714
  vendorId: {
2560
2715
  ref: "Vendor",
2561
2716
  required: true,
2562
- type: import_mongoose32.default.Schema.Types.ObjectId
2717
+ type: import_mongoose35.default.Schema.Types.ObjectId
2563
2718
  }
2564
2719
  },
2565
2720
  { _id: false }
2566
2721
  );
2567
- var couponCodeSchema = new MongooseSchema28(
2722
+ var couponCodeSchema = new MongooseSchema30(
2568
2723
  {
2569
2724
  code: { required: true, type: String },
2570
2725
  qrCode: { required: true, type: ResourceImageTypeSchema },
@@ -2572,7 +2727,7 @@ var couponCodeSchema = new MongooseSchema28(
2572
2727
  },
2573
2728
  { _id: false }
2574
2729
  );
2575
- var couponParticipantUserSchema = new MongooseSchema28(
2730
+ var couponParticipantUserSchema = new MongooseSchema30(
2576
2731
  {
2577
2732
  couponCollectedCount: { default: 0, required: true, type: Number },
2578
2733
  couponCycleRedeemed: { default: false, required: true, type: Boolean },
@@ -2581,12 +2736,12 @@ var couponParticipantUserSchema = new MongooseSchema28(
2581
2736
  userId: {
2582
2737
  ref: "User",
2583
2738
  required: true,
2584
- type: import_mongoose32.default.Schema.Types.ObjectId
2739
+ type: import_mongoose35.default.Schema.Types.ObjectId
2585
2740
  }
2586
2741
  },
2587
2742
  { timestamps: true }
2588
2743
  );
2589
- var couponDataSchema = new MongooseSchema28(
2744
+ var couponDataSchema = new MongooseSchema30(
2590
2745
  {
2591
2746
  active: { default: true, required: true, type: Boolean },
2592
2747
  couponCode: { required: false, type: couponCodeSchema },
@@ -2605,7 +2760,7 @@ var couponDataSchema = new MongooseSchema28(
2605
2760
  },
2606
2761
  resourceId: { required: true, type: String },
2607
2762
  resourceType: {
2608
- enum: Object.values(import_cluemart_shared22.EnumResourceType),
2763
+ enum: Object.values(import_cluemart_shared23.EnumResourceType),
2609
2764
  required: true,
2610
2765
  type: String
2611
2766
  },
@@ -2613,7 +2768,7 @@ var couponDataSchema = new MongooseSchema28(
2613
2768
  },
2614
2769
  { timestamps: true }
2615
2770
  );
2616
- var schema24 = new MongooseSchema28(
2771
+ var schema27 = new MongooseSchema30(
2617
2772
  {
2618
2773
  active: { default: true, required: true, type: Boolean },
2619
2774
  couponData: { default: [], required: false, type: [couponDataSchema] },
@@ -2625,62 +2780,62 @@ var schema24 = new MongooseSchema28(
2625
2780
  },
2626
2781
  { timestamps: true }
2627
2782
  );
2628
- schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2629
- schema24.index({ "couponData.participantUsers.userId": 1 });
2630
- var CouponModel = import_mongoose32.default.models.Coupon || import_mongoose32.default.model("Coupon", schema24);
2783
+ schema27.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2784
+ schema27.index({ "couponData.participantUsers.userId": 1 });
2785
+ var CouponModel = import_mongoose35.default.models.Coupon || import_mongoose35.default.model("Coupon", schema27);
2631
2786
 
2632
2787
  // src/mongoose/Impersonation.ts
2633
- var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2634
- var import_mongoose33 = __toESM(require("mongoose"));
2635
- var MongooseSchema29 = import_mongoose33.default.Schema;
2636
- var impersonationSessionSchema = new MongooseSchema29(
2788
+ var import_cluemart_shared24 = require("@timardex/cluemart-shared");
2789
+ var import_mongoose36 = __toESM(require("mongoose"));
2790
+ var MongooseSchema31 = import_mongoose36.default.Schema;
2791
+ var impersonationSessionSchema = new MongooseSchema31(
2637
2792
  {
2638
2793
  expiresAt: { expires: 0, required: true, type: Date },
2639
2794
  impersonatedUserId: {
2640
2795
  index: true,
2641
2796
  ref: "User",
2642
2797
  required: true,
2643
- type: import_mongoose33.default.Schema.Types.ObjectId
2798
+ type: import_mongoose36.default.Schema.Types.ObjectId
2644
2799
  },
2645
2800
  impersonatorUserId: {
2646
2801
  index: true,
2647
2802
  ref: "User",
2648
2803
  required: true,
2649
- type: import_mongoose33.default.Schema.Types.ObjectId
2804
+ type: import_mongoose36.default.Schema.Types.ObjectId
2650
2805
  },
2651
2806
  refreshToken: { required: true, type: String }
2652
2807
  },
2653
2808
  { timestamps: true }
2654
2809
  );
2655
- var ImpersonationSessionModel = import_mongoose33.default.models.ImpersonationSession || import_mongoose33.default.model(
2810
+ var ImpersonationSessionModel = import_mongoose36.default.models.ImpersonationSession || import_mongoose36.default.model(
2656
2811
  "ImpersonationSession",
2657
2812
  impersonationSessionSchema
2658
2813
  );
2659
- var impersonationAuditSchema = new MongooseSchema29(
2814
+ var impersonationAuditSchema = new MongooseSchema31(
2660
2815
  {
2661
2816
  action: { enum: ["start", "end"], required: true, type: String },
2662
2817
  endReason: { type: String },
2663
2818
  impersonatedUserId: {
2664
2819
  ref: "User",
2665
2820
  required: true,
2666
- type: import_mongoose33.default.Schema.Types.ObjectId
2821
+ type: import_mongoose36.default.Schema.Types.ObjectId
2667
2822
  },
2668
2823
  impersonatorUserId: {
2669
2824
  ref: "User",
2670
2825
  required: true,
2671
- type: import_mongoose33.default.Schema.Types.ObjectId
2826
+ type: import_mongoose36.default.Schema.Types.ObjectId
2672
2827
  },
2673
- resourceId: { type: import_mongoose33.default.Schema.Types.ObjectId },
2674
- resourceType: { enum: Object.values(import_cluemart_shared23.EnumResourceType), type: String },
2828
+ resourceId: { type: import_mongoose36.default.Schema.Types.ObjectId },
2829
+ resourceType: { enum: Object.values(import_cluemart_shared24.EnumResourceType), type: String },
2675
2830
  sessionId: {
2676
2831
  ref: "ImpersonationSession",
2677
2832
  required: true,
2678
- type: import_mongoose33.default.Schema.Types.ObjectId
2833
+ type: import_mongoose36.default.Schema.Types.ObjectId
2679
2834
  }
2680
2835
  },
2681
2836
  { timestamps: true }
2682
2837
  );
2683
- var ImpersonationAuditModel = import_mongoose33.default.models.ImpersonationAudit || import_mongoose33.default.model(
2838
+ var ImpersonationAuditModel = import_mongoose36.default.models.ImpersonationAudit || import_mongoose36.default.model(
2684
2839
  "ImpersonationAudit",
2685
2840
  impersonationAuditSchema
2686
2841
  );
@@ -2701,7 +2856,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
2701
2856
  }
2702
2857
 
2703
2858
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2704
- var import_cluemart_shared25 = require("@timardex/cluemart-shared");
2859
+ var import_cluemart_shared26 = require("@timardex/cluemart-shared");
2705
2860
  var import_utils3 = require("@timardex/cluemart-shared/utils");
2706
2861
 
2707
2862
  // src/service/saveNotificationsInDb.ts
@@ -2836,7 +2991,7 @@ async function sendPushNotifications({
2836
2991
  }
2837
2992
 
2838
2993
  // src/service/affiliate/vendorSubscriptionRewards.ts
2839
- var import_cluemart_shared24 = require("@timardex/cluemart-shared");
2994
+ var import_cluemart_shared25 = require("@timardex/cluemart-shared");
2840
2995
  var import_dayjs = __toESM(require("dayjs"));
2841
2996
  var import_timezone = __toESM(require("dayjs/plugin/timezone"));
2842
2997
  var import_utc = __toESM(require("dayjs/plugin/utc"));
@@ -2894,17 +3049,17 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
2894
3049
  // src/service/affiliate/vendorSubscriptionRewards.ts
2895
3050
  import_dayjs.default.extend(import_utc.default);
2896
3051
  import_dayjs.default.extend(import_timezone.default);
2897
- var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared24.NZ_TZ;
3052
+ var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared25.NZ_TZ;
2898
3053
  async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
2899
3054
  const { hasSubscription, validTypes } = await getVendorStripeSubscriptionPlanForRewards(userId, now);
2900
- if (validTypes.has(import_cluemart_shared24.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared24.EnumUserLicence.PRO_PLUS_VENDOR)) {
3055
+ if (validTypes.has(import_cluemart_shared25.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared25.EnumUserLicence.PRO_PLUS_VENDOR)) {
2901
3056
  if (hasSubscription) {
2902
- return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
3057
+ return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
2903
3058
  }
2904
- return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
3059
+ return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2905
3060
  }
2906
- if (validTypes.has(import_cluemart_shared24.EnumUserLicence.STANDARD_VENDOR)) {
2907
- return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
3061
+ if (validTypes.has(import_cluemart_shared25.EnumUserLicence.STANDARD_VENDOR)) {
3062
+ return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2908
3063
  }
2909
3064
  return null;
2910
3065
  }
@@ -2916,7 +3071,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
2916
3071
 
2917
3072
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2918
3073
  function isEligibleVendorResource(resource) {
2919
- return resource.resourceType === import_cluemart_shared25.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
3074
+ return resource.resourceType === import_cluemart_shared26.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2920
3075
  }
2921
3076
  async function findAffiliatesWithActiveVendorReferrals() {
2922
3077
  return await AffiliateModel.find({
@@ -2925,7 +3080,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
2925
3080
  $elemMatch: {
2926
3081
  resourceActive: true,
2927
3082
  resourceDeletedAt: null,
2928
- resourceType: import_cluemart_shared25.EnumResourceType.VENDOR
3083
+ resourceType: import_cluemart_shared26.EnumResourceType.VENDOR
2929
3084
  }
2930
3085
  },
2931
3086
  deletedAt: null
@@ -2959,11 +3114,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
2959
3114
  data: {
2960
3115
  resourceId: String(affiliateId),
2961
3116
  resourceName: resourceNames.join(", "),
2962
- resourceType: import_cluemart_shared25.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
3117
+ resourceType: import_cluemart_shared26.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
2963
3118
  },
2964
3119
  message,
2965
3120
  title: "Affiliate points earned",
2966
- type: import_cluemart_shared25.EnumNotificationType.SYSTEM,
3121
+ type: import_cluemart_shared26.EnumNotificationType.SYSTEM,
2967
3122
  userIds: [affiliateOwnerUserId]
2968
3123
  };
2969
3124
  try {
@@ -2992,7 +3147,7 @@ async function tryAwardSubscriptionReward({
2992
3147
  resourceActive: true,
2993
3148
  resourceDeletedAt: null,
2994
3149
  resourceId: resource.resourceId,
2995
- resourceType: import_cluemart_shared25.EnumResourceType.VENDOR,
3150
+ resourceType: import_cluemart_shared26.EnumResourceType.VENDOR,
2996
3151
  rewards: {
2997
3152
  $not: {
2998
3153
  $elemMatch: {
@@ -3113,7 +3268,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
3113
3268
  }
3114
3269
 
3115
3270
  // src/service/database.ts
3116
- var import_mongoose37 = __toESM(require("mongoose"));
3271
+ var import_mongoose40 = __toESM(require("mongoose"));
3117
3272
  var connectToDatabase = async ({
3118
3273
  appName,
3119
3274
  dbName,
@@ -3126,7 +3281,7 @@ var connectToDatabase = async ({
3126
3281
  // Fallback to MongoDB Atlas connection string
3127
3282
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
3128
3283
  );
3129
- await import_mongoose37.default.connect(mongoUri);
3284
+ await import_mongoose40.default.connect(mongoUri);
3130
3285
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
3131
3286
  console.log(
3132
3287
  `${connectionType} connected from server/src/service/database.ts`
@@ -3139,7 +3294,7 @@ var connectToDatabase = async ({
3139
3294
 
3140
3295
  // src/types/index.ts
3141
3296
  var import_express = __toESM(require("express"));
3142
- var import_mongoose38 = __toESM(require("mongoose"));
3297
+ var import_mongoose41 = __toESM(require("mongoose"));
3143
3298
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
3144
3299
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
3145
3300
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -3194,9 +3349,9 @@ async function notifyUsers({
3194
3349
  }
3195
3350
 
3196
3351
  // src/service/updateAdStatus.ts
3197
- var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3352
+ var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3198
3353
  async function updateAdStatuses() {
3199
- const now = (0, import_cluemart_shared26.nzDayKey)();
3354
+ const now = (0, import_cluemart_shared27.nzDayKey)();
3200
3355
  const invalidResult = await AdModel.updateMany(
3201
3356
  {
3202
3357
  $or: [
@@ -3204,50 +3359,50 @@ async function updateAdStatuses() {
3204
3359
  { end: { $exists: false } },
3205
3360
  { $expr: { $gt: ["$start", "$end"] } }
3206
3361
  ],
3207
- status: { $ne: import_cluemart_shared26.EnumAdStatus.PAUSED }
3362
+ status: { $ne: import_cluemart_shared27.EnumAdStatus.PAUSED }
3208
3363
  },
3209
- { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3364
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
3210
3365
  );
3211
3366
  const expiredResult = await AdModel.updateMany(
3212
- { end: { $lte: now }, status: { $ne: import_cluemart_shared26.EnumAdStatus.EXPIRED } },
3213
- { $set: { status: import_cluemart_shared26.EnumAdStatus.EXPIRED } }
3367
+ { end: { $lte: now }, status: { $ne: import_cluemart_shared27.EnumAdStatus.EXPIRED } },
3368
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.EXPIRED } }
3214
3369
  );
3215
3370
  const eligibleBooking = {
3216
3371
  $or: [
3217
3372
  { bookingKind: { $exists: false } },
3218
3373
  { bookingKind: null },
3219
3374
  {
3220
- approvalStatus: import_cluemart_shared26.EnumAdApprovalStatus.APPROVED,
3221
- bookingKind: import_cluemart_shared26.EnumAdBookingSlotKind.RESERVED
3375
+ approvalStatus: import_cluemart_shared27.EnumAdApprovalStatus.APPROVED,
3376
+ bookingKind: import_cluemart_shared27.EnumAdBookingSlotKind.RESERVED
3222
3377
  },
3223
3378
  {
3224
- approvalStatus: import_cluemart_shared26.EnumAdApprovalStatus.APPROVED,
3225
- bookingKind: import_cluemart_shared26.EnumAdBookingSlotKind.PAID,
3226
- paymentStatus: import_cluemart_shared26.EnumAdPaymentStatus.PAID
3379
+ approvalStatus: import_cluemart_shared27.EnumAdApprovalStatus.APPROVED,
3380
+ bookingKind: import_cluemart_shared27.EnumAdBookingSlotKind.PAID,
3381
+ paymentStatus: import_cluemart_shared27.EnumAdPaymentStatus.PAID
3227
3382
  }
3228
3383
  ]
3229
3384
  };
3230
3385
  const awaitingApprovalResult = await AdModel.updateMany(
3231
3386
  {
3232
3387
  $nor: eligibleBooking.$or,
3233
- bookingKind: { $in: Object.values(import_cluemart_shared26.EnumAdBookingSlotKind) },
3388
+ bookingKind: { $in: Object.values(import_cluemart_shared27.EnumAdBookingSlotKind) },
3234
3389
  end: { $gt: now },
3235
- status: import_cluemart_shared26.EnumAdStatus.ACTIVE
3390
+ status: import_cluemart_shared27.EnumAdStatus.ACTIVE
3236
3391
  },
3237
- { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3392
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
3238
3393
  );
3239
3394
  const activeResult = await AdModel.updateMany(
3240
3395
  {
3241
3396
  end: { $gt: now },
3242
3397
  start: { $lte: now },
3243
- status: { $ne: import_cluemart_shared26.EnumAdStatus.ACTIVE },
3398
+ status: { $ne: import_cluemart_shared27.EnumAdStatus.ACTIVE },
3244
3399
  ...eligibleBooking
3245
3400
  },
3246
- { $set: { status: import_cluemart_shared26.EnumAdStatus.ACTIVE } }
3401
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.ACTIVE } }
3247
3402
  );
3248
3403
  const pausedResult = await AdModel.updateMany(
3249
- { start: { $gt: now }, status: { $ne: import_cluemart_shared26.EnumAdStatus.PAUSED } },
3250
- { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3404
+ { start: { $gt: now }, status: { $ne: import_cluemart_shared27.EnumAdStatus.PAUSED } },
3405
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
3251
3406
  );
3252
3407
  console.log(
3253
3408
  `\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
@@ -3255,15 +3410,15 @@ async function updateAdStatuses() {
3255
3410
  }
3256
3411
 
3257
3412
  // src/service/objectIdToString.ts
3258
- var import_mongoose40 = __toESM(require("mongoose"));
3413
+ var import_mongoose43 = __toESM(require("mongoose"));
3259
3414
  function isValidObjectId(value) {
3260
- return import_mongoose40.default.Types.ObjectId.isValid(value);
3415
+ return import_mongoose43.default.Types.ObjectId.isValid(value);
3261
3416
  }
3262
3417
  function convertObjectIdsToStrings(obj) {
3263
3418
  if (obj === null || obj === void 0) {
3264
3419
  return obj;
3265
3420
  }
3266
- if (obj instanceof import_mongoose40.default.Types.ObjectId) {
3421
+ if (obj instanceof import_mongoose43.default.Types.ObjectId) {
3267
3422
  return obj.toString();
3268
3423
  }
3269
3424
  if (obj instanceof Date) {
@@ -3457,19 +3612,19 @@ function buildUserPointEntryRemovalPipeline(pointType, sourceId) {
3457
3612
  }
3458
3613
 
3459
3614
  // src/service/event/updateAllEventDateTimeStatuses.ts
3460
- var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3615
+ var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3461
3616
  var import_dayjs4 = __toESM(require("dayjs"));
3462
3617
 
3463
3618
  // src/service/event/archiveEndedEventDates.ts
3464
- var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3619
+ var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3465
3620
  var import_dayjs3 = __toESM(require("dayjs"));
3466
3621
  var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
3467
3622
  import_dayjs3.default.extend(import_customParseFormat.default);
3468
3623
  var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
3469
- import_cluemart_shared27.EnumEventDateStatus.ENDED
3624
+ import_cluemart_shared28.EnumEventDateStatus.ENDED
3470
3625
  ]);
3471
3626
  var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
3472
- import_cluemart_shared27.EnumEventDateStatus.INVALID
3627
+ import_cluemart_shared28.EnumEventDateStatus.INVALID
3473
3628
  ]);
3474
3629
  function splitEventDatesForArchive(dateTime) {
3475
3630
  return {
@@ -3492,12 +3647,12 @@ function dedupeArchivedSlotsByStartDateTime(slots) {
3492
3647
  });
3493
3648
  }
3494
3649
  function isPastCanceledEventDate(slot, now) {
3495
- if (slot.dateStatus !== import_cluemart_shared27.EnumEventDateStatus.CANCELED) {
3650
+ if (slot.dateStatus !== import_cluemart_shared28.EnumEventDateStatus.CANCELED) {
3496
3651
  return false;
3497
3652
  }
3498
3653
  const endDateTime = (0, import_dayjs3.default)(
3499
3654
  `${slot.endDate} ${slot.endTime}`,
3500
- `${import_cluemart_shared27.dateFormat} ${import_cluemart_shared27.timeFormat}`,
3655
+ `${import_cluemart_shared28.dateFormat} ${import_cluemart_shared28.timeFormat}`,
3501
3656
  true
3502
3657
  );
3503
3658
  return endDateTime.isValid() && endDateTime.isBefore(now);
@@ -3543,7 +3698,7 @@ async function updateModelDateTimeStatuses(model, now) {
3543
3698
  try {
3544
3699
  for await (const doc of cursor) {
3545
3700
  const dateTime = doc.dateTime.map(
3546
- (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3701
+ (slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
3547
3702
  );
3548
3703
  if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
3549
3704
  continue;
@@ -3567,9 +3722,9 @@ async function updateModelDateTimeStatuses(model, now) {
3567
3722
  var ARCHIVABLE_EVENT_FILTER = {
3568
3723
  "dateTime.dateStatus": {
3569
3724
  $in: [
3570
- import_cluemart_shared28.EnumEventDateStatus.ENDED,
3571
- import_cluemart_shared28.EnumEventDateStatus.INVALID,
3572
- import_cluemart_shared28.EnumEventDateStatus.CANCELED
3725
+ import_cluemart_shared29.EnumEventDateStatus.ENDED,
3726
+ import_cluemart_shared29.EnumEventDateStatus.INVALID,
3727
+ import_cluemart_shared29.EnumEventDateStatus.CANCELED
3573
3728
  ]
3574
3729
  },
3575
3730
  deletedAt: null
@@ -3594,7 +3749,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3594
3749
  try {
3595
3750
  for await (const doc of cursor) {
3596
3751
  const updated = doc.dateTime.map(
3597
- (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3752
+ (slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
3598
3753
  );
3599
3754
  const { archive, discard } = splitEventDatesForArchive(updated);
3600
3755
  const pastCanceled = updated.filter(
@@ -3618,13 +3773,13 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3618
3773
  if (archive.length > 0 || discard.length > 0) {
3619
3774
  pullConditions.push({
3620
3775
  dateStatus: {
3621
- $in: [import_cluemart_shared28.EnumEventDateStatus.ENDED, import_cluemart_shared28.EnumEventDateStatus.INVALID]
3776
+ $in: [import_cluemart_shared29.EnumEventDateStatus.ENDED, import_cluemart_shared29.EnumEventDateStatus.INVALID]
3622
3777
  }
3623
3778
  });
3624
3779
  }
3625
3780
  for (const slot of pastCanceled) {
3626
3781
  pullConditions.push({
3627
- dateStatus: import_cluemart_shared28.EnumEventDateStatus.CANCELED,
3782
+ dateStatus: import_cluemart_shared29.EnumEventDateStatus.CANCELED,
3628
3783
  startDate: slot.startDate,
3629
3784
  startTime: slot.startTime
3630
3785
  });
@@ -3666,9 +3821,9 @@ async function cleanEventInfoDates(now) {
3666
3821
  try {
3667
3822
  for await (const doc of cursor) {
3668
3823
  const updated = doc.dateTime.map(
3669
- (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3824
+ (slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
3670
3825
  );
3671
- const kept = (0, import_cluemart_shared28.filterDatesByFutureStatus)(updated);
3826
+ const kept = (0, import_cluemart_shared29.filterDatesByFutureStatus)(updated);
3672
3827
  if (kept.length === updated.length) {
3673
3828
  continue;
3674
3829
  }
@@ -3691,15 +3846,19 @@ async function cleanEventInfoDates(now) {
3691
3846
  }
3692
3847
  async function updateAllEventDateTimeStatuses() {
3693
3848
  const now = (0, import_dayjs4.default)();
3694
- const [eventCount, marketCount] = await Promise.all([
3849
+ const [eventCount, marketCount, aiMarketCount] = await Promise.all([
3695
3850
  updateModelDateTimeStatuses(EventModel, now),
3696
3851
  updateModelDateTimeStatuses(
3697
3852
  GoogleImportedMarketModel,
3698
3853
  now
3854
+ ),
3855
+ updateModelDateTimeStatuses(
3856
+ AiImportedMarketModel,
3857
+ now
3699
3858
  )
3700
3859
  ]);
3701
3860
  console.log(
3702
- `\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed`
3861
+ `\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed, ai imported markets=${aiMarketCount} changed`
3703
3862
  );
3704
3863
  const archivedCount = await archiveEndedAndDiscardInvalidEventDates(now);
3705
3864
  if (archivedCount > 0) {
@@ -3714,7 +3873,7 @@ async function updateAllEventDateTimeStatuses() {
3714
3873
  }
3715
3874
 
3716
3875
  // src/service/index.ts
3717
- var import_cluemart_shared36 = require("@timardex/cluemart-shared");
3876
+ var import_cluemart_shared37 = require("@timardex/cluemart-shared");
3718
3877
 
3719
3878
  // src/service/event/findEventOrImportedMarketById.ts
3720
3879
  async function findEventOrImportedMarketById(resourceId) {
@@ -3722,15 +3881,16 @@ async function findEventOrImportedMarketById(resourceId) {
3722
3881
  return null;
3723
3882
  }
3724
3883
  const normalizedId = convertObjectIdsToStrings(resourceId);
3725
- const [eventDoc, googleImportedDoc] = await Promise.all([
3884
+ const [eventDoc, googleImportedDoc, aiImportedDoc] = await Promise.all([
3726
3885
  EventModel.findById(normalizedId).select("_id name dateTime owner").lean().exec(),
3727
- GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
3886
+ GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
3887
+ AiImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
3728
3888
  ]);
3729
- return eventDoc ?? googleImportedDoc;
3889
+ return eventDoc ?? googleImportedDoc ?? aiImportedDoc;
3730
3890
  }
3731
3891
 
3732
3892
  // src/service/relations.ts
3733
- var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3893
+ var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3734
3894
  function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
3735
3895
  if (!previousDateTime?.length) {
3736
3896
  return false;
@@ -3746,8 +3906,8 @@ function didRemoveAnyStartedDates(previousDateTime, nextDateTime) {
3746
3906
  return false;
3747
3907
  }
3748
3908
  return previousDateTime.some(
3749
- (prev) => prev.dateStatus === import_cluemart_shared29.EnumEventDateStatus.STARTED && !nextDateTime?.some(
3750
- (next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared29.EnumEventDateStatus.STARTED
3909
+ (prev) => prev.dateStatus === import_cluemart_shared30.EnumEventDateStatus.STARTED && !nextDateTime?.some(
3910
+ (next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared30.EnumEventDateStatus.STARTED
3751
3911
  )
3752
3912
  );
3753
3913
  }
@@ -3758,7 +3918,7 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
3758
3918
  ) ?? false;
3759
3919
  return {
3760
3920
  ...relationDate,
3761
- status: existsInEvent ? relationDate.status : import_cluemart_shared29.EnumInviteStatus.CANCELED
3921
+ status: existsInEvent ? relationDate.status : import_cluemart_shared30.EnumInviteStatus.CANCELED
3762
3922
  };
3763
3923
  });
3764
3924
  }
@@ -3767,15 +3927,15 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
3767
3927
  var import_dayjs8 = __toESM(require("dayjs"));
3768
3928
 
3769
3929
  // src/service/license/compliance/utils.ts
3770
- var import_cluemart_shared34 = require("@timardex/cluemart-shared");
3930
+ var import_cluemart_shared35 = require("@timardex/cluemart-shared");
3771
3931
  var import_dayjs7 = __toESM(require("dayjs"));
3772
3932
 
3773
3933
  // src/service/license/compliance/event.ts
3774
- var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3934
+ var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3775
3935
  var eventLicences = [
3776
- import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT,
3777
- import_cluemart_shared30.EnumUserLicence.PRO_EVENT,
3778
- import_cluemart_shared30.EnumUserLicence.PRO_PLUS_EVENT
3936
+ import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
3937
+ import_cluemart_shared31.EnumUserLicence.PRO_EVENT,
3938
+ import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT
3779
3939
  ];
3780
3940
  async function handleEventLicenceCompliance(user, now) {
3781
3941
  if (!user.licences || !user.events?.length) {
@@ -3987,9 +4147,9 @@ function buildLicenceExpiryPipeline(params) {
3987
4147
  }
3988
4148
 
3989
4149
  // src/service/license/compliance/partner.ts
3990
- var import_cluemart_shared31 = require("@timardex/cluemart-shared");
4150
+ var import_cluemart_shared32 = require("@timardex/cluemart-shared");
3991
4151
  var partnerLicences = [
3992
- import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER
4152
+ import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER
3993
4153
  ];
3994
4154
  async function handlePartnerLicenceCompliance(user, now) {
3995
4155
  if (!user.licences || !user.partner) {
@@ -3999,11 +4159,11 @@ async function handlePartnerLicenceCompliance(user, now) {
3999
4159
  }
4000
4160
 
4001
4161
  // src/service/license/compliance/vendor.ts
4002
- var import_cluemart_shared33 = require("@timardex/cluemart-shared");
4162
+ var import_cluemart_shared34 = require("@timardex/cluemart-shared");
4003
4163
  var import_dayjs6 = __toESM(require("dayjs"));
4004
4164
 
4005
4165
  // src/service/license/models.ts
4006
- var import_cluemart_shared32 = require("@timardex/cluemart-shared");
4166
+ var import_cluemart_shared33 = require("@timardex/cluemart-shared");
4007
4167
  var import_dayjs5 = __toESM(require("dayjs"));
4008
4168
  var import_graphql = require("graphql");
4009
4169
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
@@ -4015,31 +4175,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
4015
4175
  return LicenceCategory2;
4016
4176
  })(LicenceCategory || {});
4017
4177
  var licenceCategoryMapping = {
4018
- [import_cluemart_shared32.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
4019
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
4020
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
4021
- [import_cluemart_shared32.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
4022
- [import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
4023
- [import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
4024
- [import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
4025
- [import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
4026
- [import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
4178
+ [import_cluemart_shared33.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
4179
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
4180
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
4181
+ [import_cluemart_shared33.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
4182
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
4183
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
4184
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
4185
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
4186
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
4027
4187
  };
4028
4188
  var licencePriority = {
4029
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT]: 3,
4030
- [import_cluemart_shared32.EnumUserLicence.PRO_EVENT]: 2,
4031
- [import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT]: 1,
4032
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
4033
- [import_cluemart_shared32.EnumUserLicence.PRO_VENDOR]: 2,
4034
- [import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR]: 1,
4035
- [import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER]: 1,
4036
- [import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE]: 1,
4037
- [import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL]: 1
4189
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_EVENT]: 3,
4190
+ [import_cluemart_shared33.EnumUserLicence.PRO_EVENT]: 2,
4191
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT]: 1,
4192
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
4193
+ [import_cluemart_shared33.EnumUserLicence.PRO_VENDOR]: 2,
4194
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR]: 1,
4195
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER]: 1,
4196
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE]: 1,
4197
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL]: 1
4038
4198
  };
4039
4199
  var standardLicences = [
4040
- import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR,
4041
- import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
4042
- import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER
4200
+ import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR,
4201
+ import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT,
4202
+ import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER
4043
4203
  ];
4044
4204
  var standardLicenceSet = new Set(standardLicences);
4045
4205
  function isStandardLicence(licence) {
@@ -4053,11 +4213,11 @@ var categoryRegexMapping = {
4053
4213
  ["school" /* SCHOOL */]: /_school$/
4054
4214
  };
4055
4215
  var categoryFallbackLicence = {
4056
- ["event" /* EVENT */]: import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
4057
- ["partner" /* PARTNER */]: import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER,
4058
- ["vendor" /* VENDOR */]: import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR,
4059
- ["affiliate" /* AFFILIATE */]: import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE,
4060
- ["school" /* SCHOOL */]: import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL
4216
+ ["event" /* EVENT */]: import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT,
4217
+ ["partner" /* PARTNER */]: import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER,
4218
+ ["vendor" /* VENDOR */]: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR,
4219
+ ["affiliate" /* AFFILIATE */]: import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE,
4220
+ ["school" /* SCHOOL */]: import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL
4061
4221
  };
4062
4222
  var LicenceFilterInput = {
4063
4223
  INPUT_USER_LICENCES: "$licences"
@@ -4087,11 +4247,11 @@ function getHighestLicenceForCategory(licences, category) {
4087
4247
  function createLicenceObject(expiryDate, licenceType) {
4088
4248
  const today = (0, import_dayjs5.default)();
4089
4249
  const expiryDateMapping = {
4090
- [import_cluemart_shared32.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
4091
- [import_cluemart_shared32.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
4092
- [import_cluemart_shared32.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
4093
- [import_cluemart_shared32.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
4094
- [import_cluemart_shared32.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
4250
+ [import_cluemart_shared33.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
4251
+ [import_cluemart_shared33.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
4252
+ [import_cluemart_shared33.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
4253
+ [import_cluemart_shared33.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
4254
+ [import_cluemart_shared33.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
4095
4255
  };
4096
4256
  const licenceObject = {
4097
4257
  expiryDate: expiryDateMapping[expiryDate],
@@ -4195,13 +4355,13 @@ async function checkOwnerHasLicence({
4195
4355
  const owner = await UserModel.findById(userId);
4196
4356
  if (!owner) throw new import_graphql.GraphQLError("Owner not found");
4197
4357
  const categoryByResource = {
4198
- [import_cluemart_shared32.EnumResourceType.EVENT]: "event" /* EVENT */,
4199
- [import_cluemart_shared32.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
4200
- [import_cluemart_shared32.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
4201
- [import_cluemart_shared32.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
4202
- [import_cluemart_shared32.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
4358
+ [import_cluemart_shared33.EnumResourceType.EVENT]: "event" /* EVENT */,
4359
+ [import_cluemart_shared33.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
4360
+ [import_cluemart_shared33.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
4361
+ [import_cluemart_shared33.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
4362
+ [import_cluemart_shared33.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
4203
4363
  };
4204
- if (!(0, import_cluemart_shared32.isNonVisitorResourceType)(resourceType)) {
4364
+ if (!(0, import_cluemart_shared33.isNonVisitorResourceType)(resourceType)) {
4205
4365
  throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
4206
4366
  }
4207
4367
  const requiredCategory = categoryByResource[resourceType];
@@ -4281,7 +4441,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
4281
4441
  return (result?.matchedCount ?? 0) > 0;
4282
4442
  }
4283
4443
  async function downgradeVendorProFeatures(userId, licenceType) {
4284
- const isStandardVendor = licenceType === import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR;
4444
+ const isStandardVendor = licenceType === import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR;
4285
4445
  if (!isStandardVendor) {
4286
4446
  return;
4287
4447
  }
@@ -4328,7 +4488,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
4328
4488
  return (result?.matchedCount ?? 0) > 0;
4329
4489
  }
4330
4490
  async function restoreVendorProFeatures(userId, licenceType) {
4331
- const isProVendor = licenceType === import_cluemart_shared33.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR;
4491
+ const isProVendor = licenceType === import_cluemart_shared34.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR;
4332
4492
  if (!isProVendor) {
4333
4493
  return;
4334
4494
  }
@@ -4349,14 +4509,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
4349
4509
  return false;
4350
4510
  }
4351
4511
  const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs6.default)(stripe.paymentGracePeriodEndsAt) : null;
4352
- const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared33.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared33.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
4512
+ const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared34.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared34.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
4353
4513
  if (hasActivePaymentGracePeriod) {
4354
4514
  return true;
4355
4515
  }
4356
4516
  if (!stripe.subscriptionId) {
4357
4517
  return false;
4358
4518
  }
4359
- if (stripe.status !== import_cluemart_shared33.EnumSubscriptionStatus.ACTIVE) {
4519
+ if (stripe.status !== import_cluemart_shared34.EnumSubscriptionStatus.ACTIVE) {
4360
4520
  return false;
4361
4521
  }
4362
4522
  if (!stripe.endDate) {
@@ -4376,7 +4536,7 @@ async function handleVendorLicenceCompliance(user, now) {
4376
4536
  return;
4377
4537
  }
4378
4538
  const proLicences = vendorLicencesOfUser.filter(
4379
- (licence) => licence.licenceType !== import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
4539
+ (licence) => licence.licenceType !== import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4380
4540
  );
4381
4541
  const expiredProLicences = proLicences.filter(
4382
4542
  (licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now)
@@ -4389,7 +4549,7 @@ async function handleVendorLicenceCompliance(user, now) {
4389
4549
  const expiredProLicence = expiredProLicences.some(
4390
4550
  (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
4391
4551
  );
4392
- const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared33.vendorLicences, now);
4552
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared34.vendorLicences, now);
4393
4553
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
4394
4554
  (licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
4395
4555
  );
@@ -4405,7 +4565,7 @@ async function handleVendorLicenceCompliance(user, now) {
4405
4565
  "owner.userId": user._id
4406
4566
  }).lean().exec();
4407
4567
  }
4408
- const licencesToSync = import_cluemart_shared33.vendorLicences.filter(
4568
+ const licencesToSync = import_cluemart_shared34.vendorLicences.filter(
4409
4569
  (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
4410
4570
  );
4411
4571
  await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
@@ -4420,11 +4580,11 @@ async function handleVendorLicenceCompliance(user, now) {
4420
4580
  data: {
4421
4581
  resourceId: String(vendor._id),
4422
4582
  resourceName: vendor.name,
4423
- resourceType: import_cluemart_shared33.EnumNotificationResourceType.DOWNGRADED_VENDOR
4583
+ resourceType: import_cluemart_shared34.EnumNotificationResourceType.DOWNGRADED_VENDOR
4424
4584
  },
4425
4585
  message: `Your Vendor licence has been downgraded due to licence expiration.`,
4426
4586
  title: `Vendor Licence Downgraded`,
4427
- type: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4587
+ type: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4428
4588
  userIds: [user._id]
4429
4589
  };
4430
4590
  await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
@@ -4457,7 +4617,7 @@ async function vendorOwnerHasProLicence(vendorId) {
4457
4617
  effectiveVendorLicences,
4458
4618
  "vendor" /* VENDOR */
4459
4619
  );
4460
- return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared33.EnumUserLicence.PRO_VENDOR];
4620
+ return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared34.EnumUserLicence.PRO_VENDOR];
4461
4621
  }
4462
4622
 
4463
4623
  // src/service/license/compliance/utils.ts
@@ -4467,12 +4627,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
4467
4627
  const pipeline = buildLicenceExpiryPipeline({
4468
4628
  downgradeBranches: [
4469
4629
  {
4470
- case: import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR,
4471
- then: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4630
+ case: import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR,
4631
+ then: import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
4472
4632
  },
4473
4633
  {
4474
- case: import_cluemart_shared34.EnumUserLicence.PRO_VENDOR,
4475
- then: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4634
+ case: import_cluemart_shared35.EnumUserLicence.PRO_VENDOR,
4635
+ then: import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
4476
4636
  }
4477
4637
  ],
4478
4638
  licenceTypes,
@@ -4601,7 +4761,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
4601
4761
  var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
4602
4762
 
4603
4763
  // src/service/license/reminder/utils.ts
4604
- var import_cluemart_shared35 = require("@timardex/cluemart-shared");
4764
+ var import_cluemart_shared36 = require("@timardex/cluemart-shared");
4605
4765
  var import_utils8 = require("@timardex/cluemart-shared/utils");
4606
4766
  var import_dayjs9 = __toESM(require("dayjs"));
4607
4767
 
@@ -4667,28 +4827,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
4667
4827
  return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
4668
4828
  }
4669
4829
  function getLicenseName(licenceType) {
4670
- return import_cluemart_shared35.licenseNiceNames[licenceType] || licenceType;
4830
+ return import_cluemart_shared36.licenseNiceNames[licenceType] || licenceType;
4671
4831
  }
4672
4832
  function getNotificationTypes(isVendorLicense, isPartnerLicense) {
4673
4833
  if (isVendorLicense) {
4674
4834
  return {
4675
- notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4676
- resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4835
+ notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
4836
+ resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4677
4837
  };
4678
4838
  }
4679
4839
  if (isPartnerLicense) {
4680
4840
  return {
4681
- notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4682
- resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4841
+ notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
4842
+ resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4683
4843
  };
4684
4844
  }
4685
4845
  return {
4686
- notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4687
- resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4846
+ notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
4847
+ resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4688
4848
  };
4689
4849
  }
4690
4850
  async function getLicenseResourceInfo(user, licence) {
4691
- const isVendorLicense = import_cluemart_shared35.vendorLicences.includes(licence.licenceType);
4851
+ const isVendorLicense = import_cluemart_shared36.vendorLicences.includes(licence.licenceType);
4692
4852
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
4693
4853
  const licenceName = getLicenseName(licence.licenceType);
4694
4854
  const { notificationType, resourceType } = getNotificationTypes(
@@ -4736,11 +4896,11 @@ async function getLicenseResourceInfo(user, licence) {
4736
4896
  };
4737
4897
  }
4738
4898
  function getLicenceExpiryMode(licenceType) {
4739
- return licenceType === import_cluemart_shared35.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4899
+ return licenceType === import_cluemart_shared36.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared36.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4740
4900
  }
4741
4901
  async function sendLicenseReminder(user, licence) {
4742
4902
  const licenceName = getLicenseName(licence.licenceType);
4743
- const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared35.dateFormat);
4903
+ const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared36.dateFormat);
4744
4904
  const userId = String(user._id);
4745
4905
  const resourceInfo = await getLicenseResourceInfo(user, licence);
4746
4906
  if (!resourceInfo) {
@@ -4872,7 +5032,9 @@ async function remindUsersAboutLicenseExpiration() {
4872
5032
  AdBookingModel,
4873
5033
  AdMetricsModel,
4874
5034
  AdModel,
5035
+ AdPurchaseModel,
4875
5036
  AffiliateModel,
5037
+ AiImportedMarketModel,
4876
5038
  AppSettingModel,
4877
5039
  AuthHandoffTokenModel,
4878
5040
  BILLING_CATALOG_COLLECTION_NAME,
@@ -4904,6 +5066,7 @@ async function remindUsersAboutLicenseExpiration() {
4904
5066
  ResourceImageTypeSchema,
4905
5067
  SUBSCRIPTION_REWARD_TIMEZONE,
4906
5068
  SchoolModel,
5069
+ ScrapeSiteModel,
4907
5070
  SocialMediaTypeSchema,
4908
5071
  StallTypeSchema,
4909
5072
  UnregisteredVendorModel,