@timardex/cluemart-server-shared 1.1.38 → 1.1.39

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
@@ -35,6 +35,8 @@ __export(index_exports, {
35
35
  AdModel: () => AdModel,
36
36
  AffiliateModel: () => AffiliateModel,
37
37
  AppSettingModel: () => AppSettingModel,
38
+ BILLING_CATALOG_COLLECTION_NAME: () => BILLING_CATALOG_COLLECTION_NAME,
39
+ BillingCatalogModel: () => BillingCatalogModel,
38
40
  CategorySchema: () => CategorySchema,
39
41
  ChatModel: () => ChatModel,
40
42
  ChatReportModel: () => ChatReportModel,
@@ -70,6 +72,7 @@ __export(index_exports, {
70
72
  activeAffiliateCodeExists: () => activeAffiliateCodeExists,
71
73
  awardAffiliateVendorSubscriptionRewards: () => awardAffiliateVendorSubscriptionRewards,
72
74
  baseResourceFields: () => baseResourceFields,
75
+ buildInitialBillingCatalogEntries: () => buildInitialBillingCatalogEntries,
73
76
  buildLicenceExpiryPipeline: () => buildLicenceExpiryPipeline,
74
77
  checkOwnerHasLicence: () => checkOwnerHasLicence,
75
78
  connectToDatabase: () => connectToDatabase,
@@ -78,10 +81,12 @@ __export(index_exports, {
78
81
  dateTimeSchema: () => dateTimeSchema2,
79
82
  didRemoveAnyEventDates: () => didRemoveAnyEventDates,
80
83
  ensureUserLicenseCompliance: () => ensureUserLicenseCompliance,
84
+ ensureUserLicenseComplianceForUser: () => ensureUserLicenseComplianceForUser,
81
85
  eventLicences: () => eventLicences,
82
86
  express: () => import_express.default,
83
87
  findAffiliateByPromoCode: () => findAffiliateByPromoCode,
84
88
  findEventOrImportedMarketById: () => findEventOrImportedMarketById,
89
+ getBillingCatalogDefinition: () => getBillingCatalogDefinition,
85
90
  getEventResourceInfo: () => getEventResourceInfo,
86
91
  getHighestLicenceForCategory: () => getHighestLicenceForCategory,
87
92
  getLicenceCategory: () => getLicenceCategory,
@@ -103,7 +108,7 @@ __export(index_exports, {
103
108
  locationGeoSchema: () => locationGeoSchema,
104
109
  locationsSchema: () => locationsSchema,
105
110
  mapVendorLicenceToSubscriptionRewardType: () => mapVendorLicenceToSubscriptionRewardType,
106
- mongoose: () => import_mongoose31.default,
111
+ mongoose: () => import_mongoose32.default,
107
112
  normalizeAffiliatePromoCodes: () => normalizeAffiliatePromoCodes,
108
113
  normalizePromoCode: () => normalizePromoCode,
109
114
  notifyUsers: () => notifyUsers,
@@ -433,8 +438,8 @@ var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource22) => {
433
438
  return EnumRelationResource22;
434
439
  })(EnumRelationResource || {});
435
440
  var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceType22) => {
436
- EnumNotificationResourceType22["APPROVED_AFFILIATE"] = "approved_affiliate";
437
441
  EnumNotificationResourceType22["AFFILIATE_REWARD_RECEIVED"] = "affiliate_reward_received";
442
+ EnumNotificationResourceType22["APPROVED_AFFILIATE"] = "approved_affiliate";
438
443
  EnumNotificationResourceType22["APPROVED_EVENT"] = "approved_event";
439
444
  EnumNotificationResourceType22["APPROVED_PARTNER"] = "approved_partner";
440
445
  EnumNotificationResourceType22["APPROVED_SCHOOL"] = "approved_school";
@@ -462,6 +467,7 @@ var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceTyp
462
467
  EnumNotificationResourceType22["NEW_POST_CREATED"] = "new_post_created";
463
468
  EnumNotificationResourceType22["REGISTERED_USER_BY_SCHOOL_CODE"] = "registered_user_by_school_code";
464
469
  EnumNotificationResourceType22["SYSTEM_ALERT"] = "system_alert";
470
+ EnumNotificationResourceType22["USER_COUPON_REDEEMED"] = "user_coupon_redeemed";
465
471
  EnumNotificationResourceType22["VENDOR_APPLICATION_TO_EVENT"] = "vendor_application_to_event";
466
472
  EnumNotificationResourceType22["VENDOR_UPDATE_RELATION_TO_EVENT"] = "vendor_update_relation_to_event";
467
473
  return EnumNotificationResourceType22;
@@ -536,6 +542,11 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
536
542
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
537
543
  return EnumSubscriptionStatus22;
538
544
  })(EnumSubscriptionStatus || {});
545
+ var EnumBillingPeriod = /* @__PURE__ */ ((EnumBillingPeriod22) => {
546
+ EnumBillingPeriod22["MONTHLY_CANCEL_ANYTIME"] = "monthly_cancel_anytime";
547
+ EnumBillingPeriod22["YEARLY_ANNUAL_BILLED"] = "yearly_annual_billed";
548
+ return EnumBillingPeriod22;
549
+ })(EnumBillingPeriod || {});
539
550
  var EnumReward = /* @__PURE__ */ ((EnumReward22) => {
540
551
  EnumReward22["MYSTERY_JOY_BOX"] = "mystery_joy_box";
541
552
  EnumReward22["MYSTERY_SQUEEZE_BOX"] = "mystery_squeeze_box";
@@ -1818,6 +1829,80 @@ var availableCategories = assignColorToCategories([
1818
1829
  ...petProductsAndAnimalGoods,
1819
1830
  ...serviceAndExperience
1820
1831
  ]);
1832
+ var BILLING_CATALOG_KEYS = [
1833
+ "pro_vendor_monthly",
1834
+ "pro_vendor_yearly",
1835
+ "pro_plus_vendor_monthly",
1836
+ "pro_plus_vendor_yearly"
1837
+ ];
1838
+ var BILLING_CATALOG_CURRENCY = "nzd";
1839
+ var BILLING_CATALOG_DEFINITIONS = {
1840
+ pro_plus_vendor_monthly: {
1841
+ billingPeriod: "monthly_cancel_anytime",
1842
+ licenceType: "pro_plus_vendor"
1843
+ /* PRO_PLUS_VENDOR */
1844
+ },
1845
+ pro_plus_vendor_yearly: {
1846
+ billingPeriod: "yearly_annual_billed",
1847
+ licenceType: "pro_plus_vendor"
1848
+ /* PRO_PLUS_VENDOR */
1849
+ },
1850
+ pro_vendor_monthly: {
1851
+ billingPeriod: "monthly_cancel_anytime",
1852
+ licenceType: "pro_vendor"
1853
+ /* PRO_VENDOR */
1854
+ },
1855
+ pro_vendor_yearly: {
1856
+ billingPeriod: "yearly_annual_billed",
1857
+ licenceType: "pro_vendor"
1858
+ /* PRO_VENDOR */
1859
+ }
1860
+ };
1861
+ var INITIAL_BILLING_CATALOG = [
1862
+ {
1863
+ active: true,
1864
+ billingPeriod: "monthly_cancel_anytime",
1865
+ currency: BILLING_CATALOG_CURRENCY,
1866
+ key: "pro_vendor_monthly",
1867
+ licenceType: "pro_vendor",
1868
+ taxInclusive: true,
1869
+ unitAmount: 3999
1870
+ },
1871
+ {
1872
+ active: true,
1873
+ billingPeriod: "yearly_annual_billed",
1874
+ currency: BILLING_CATALOG_CURRENCY,
1875
+ key: "pro_vendor_yearly",
1876
+ licenceType: "pro_vendor",
1877
+ taxInclusive: true,
1878
+ unitAmount: 40788
1879
+ },
1880
+ {
1881
+ active: true,
1882
+ billingPeriod: "monthly_cancel_anytime",
1883
+ currency: BILLING_CATALOG_CURRENCY,
1884
+ key: "pro_plus_vendor_monthly",
1885
+ licenceType: "pro_plus_vendor",
1886
+ taxInclusive: true,
1887
+ unitAmount: 6499
1888
+ },
1889
+ {
1890
+ active: true,
1891
+ billingPeriod: "yearly_annual_billed",
1892
+ currency: BILLING_CATALOG_CURRENCY,
1893
+ key: "pro_plus_vendor_yearly",
1894
+ licenceType: "pro_plus_vendor",
1895
+ taxInclusive: true,
1896
+ unitAmount: 62388
1897
+ }
1898
+ ];
1899
+ function billingCatalogDefinitionMatches(entry) {
1900
+ const definition = BILLING_CATALOG_DEFINITIONS[entry.key];
1901
+ if (!definition) {
1902
+ return false;
1903
+ }
1904
+ return definition.billingPeriod === entry.billingPeriod && definition.licenceType === entry.licenceType;
1905
+ }
1821
1906
  var packagingTypes = [
1822
1907
  "Biodegradable",
1823
1908
  "Compostable",
@@ -2262,12 +2347,19 @@ var REDEEMED_REWARD_FIELDS_FRAGMENT = gql`
2262
2347
  `;
2263
2348
  var STRIPE_FIELDS_FRAGMENT = gql`
2264
2349
  fragment StripeSubscriptionFields on StripeSubscriptionType {
2350
+ billingPeriod
2351
+ cancelAtPeriodEnd
2265
2352
  customerId
2266
2353
  subscriptionId
2267
2354
  status
2268
2355
  currentPlan
2269
2356
  startDate
2270
2357
  endDate
2358
+ pendingPlan
2359
+ pendingBillingPeriod
2360
+ pendingChangeEffectiveAt
2361
+ priceId
2362
+ scheduleId
2271
2363
  }
2272
2364
  `;
2273
2365
  var USER_FIELDS_FRAGMENT = gql`
@@ -4301,11 +4393,8 @@ var GET_RESOURCE_ACTIVITY = gql`
4301
4393
  ${RESOURCE_ACTIVITY_FIELDS_FRAGMENT}
4302
4394
  `;
4303
4395
  var CREATE_CHECKOUT_SESSION_MUTATION = gql`
4304
- mutation createCheckoutSession(
4305
- $planId: LicencesEnumType!
4306
- $billingPeriod: BillingPeriodEnumType
4307
- ) {
4308
- createCheckoutSession(planId: $planId, billingPeriod: $billingPeriod) {
4396
+ mutation createCheckoutSession($input: CreateCheckoutSessionInputType!) {
4397
+ createCheckoutSession(input: $input) {
4309
4398
  data {
4310
4399
  sessionId
4311
4400
  checkoutUrl
@@ -4317,25 +4406,38 @@ var CREATE_CHECKOUT_SESSION_MUTATION = gql`
4317
4406
  var CANCEL_SUBSCRIPTION_MUTATION = gql`
4318
4407
  mutation cancelSubscription {
4319
4408
  cancelSubscription {
4320
- data
4409
+ data {
4410
+ billingPeriod
4411
+ cancelAtPeriodEnd
4412
+ currentPlan
4413
+ endDate
4414
+ pendingBillingPeriod
4415
+ pendingChangeEffectiveAt
4416
+ pendingPlan
4417
+ priceId
4418
+ scheduleId
4419
+ status
4420
+ subscriptionId
4421
+ }
4321
4422
  message
4322
4423
  }
4323
4424
  }
4324
4425
  `;
4325
4426
  var UPDATE_SUBSCRIPTION_PLAN_MUTATION = gql`
4326
- mutation updateSubscriptionPlan(
4327
- $newPlanId: LicencesEnumType!
4328
- $billingPeriod: BillingPeriodEnumType
4329
- ) {
4330
- updateSubscriptionPlan(
4331
- newPlanId: $newPlanId
4332
- billingPeriod: $billingPeriod
4333
- ) {
4427
+ mutation updateSubscriptionPlan($input: UpdateSubscriptionPlanInputType!) {
4428
+ updateSubscriptionPlan(input: $input) {
4334
4429
  data {
4335
- subscriptionId
4336
- status
4337
- priceId
4430
+ billingPeriod
4431
+ cancelAtPeriodEnd
4338
4432
  currentPlan
4433
+ endDate
4434
+ pendingBillingPeriod
4435
+ pendingChangeEffectiveAt
4436
+ pendingPlan
4437
+ priceId
4438
+ scheduleId
4439
+ status
4440
+ subscriptionId
4339
4441
  }
4340
4442
  message
4341
4443
  }
@@ -4351,36 +4453,20 @@ var CREATE_CUSTOMER_PORTAL = gql`
4351
4453
  }
4352
4454
  }
4353
4455
  `;
4354
- var SELECT_PACKAGE_MUTATION = gql`
4355
- mutation selectPackage(
4356
- $billingPeriod: BillingPeriodEnumType
4357
- $selectedLicence: LicencesEnumType!
4358
- $useStripe: Boolean
4359
- ) {
4360
- selectPackage(
4361
- billingPeriod: $billingPeriod
4362
- selectedLicence: $selectedLicence
4363
- useStripe: $useStripe
4364
- ) {
4365
- data {
4366
- checkoutUrl
4367
- licences {
4368
- ...LicenceFields
4369
- }
4370
- userId
4371
- }
4372
- message
4373
- }
4374
- }
4375
- ${LICENCE_FIELDS_FRAGMENT}
4376
- `;
4377
4456
  var GET_SUBSCRIPTION_STATUS = gql`
4378
4457
  query getSubscriptionStatus {
4379
4458
  getSubscriptionStatus {
4380
- subscriptionId
4381
- status
4382
- priceId
4459
+ billingPeriod
4460
+ cancelAtPeriodEnd
4383
4461
  currentPlan
4462
+ endDate
4463
+ pendingBillingPeriod
4464
+ pendingChangeEffectiveAt
4465
+ pendingPlan
4466
+ priceId
4467
+ scheduleId
4468
+ status
4469
+ subscriptionId
4384
4470
  }
4385
4471
  }
4386
4472
  `;
@@ -4407,7 +4493,6 @@ var GET_SUBSCRIPTION_PLANS = gql`
4407
4493
  }
4408
4494
  }
4409
4495
  isNewUser
4410
- isTester
4411
4496
  appliedDiscountType
4412
4497
  }
4413
4498
  }
@@ -4515,6 +4600,57 @@ var GET_APP_SETTINGS = gql`
4515
4600
  }
4516
4601
  ${APP_SETTINGS_FIELDS_FRAGMENT}
4517
4602
  `;
4603
+ var BILLING_CATALOG_FIELDS_FRAGMENT = gql`
4604
+ fragment BillingCatalogFields on BillingCatalogEntryType {
4605
+ _id
4606
+ active
4607
+ billingPeriod
4608
+ createdAt
4609
+ currency
4610
+ effectiveFrom
4611
+ key
4612
+ licenceType
4613
+ revision
4614
+ stripePriceId
4615
+ stripeProductId
4616
+ taxInclusive
4617
+ unitAmount
4618
+ updatedAt
4619
+ updatedBy
4620
+ }
4621
+ `;
4622
+ var GET_BILLING_CATALOG = gql`
4623
+ query getBillingCatalog {
4624
+ billingCatalog {
4625
+ ...BillingCatalogFields
4626
+ }
4627
+ }
4628
+ ${BILLING_CATALOG_FIELDS_FRAGMENT}
4629
+ `;
4630
+ var UPDATE_BILLING_CATALOG_PRICE_MUTATION = gql`
4631
+ mutation updateBillingCatalogPrice(
4632
+ $input: UpdateBillingCatalogPriceInputType!
4633
+ ) {
4634
+ updateBillingCatalogPrice(input: $input) {
4635
+ data {
4636
+ ...BillingCatalogFields
4637
+ }
4638
+ message
4639
+ }
4640
+ }
4641
+ ${BILLING_CATALOG_FIELDS_FRAGMENT}
4642
+ `;
4643
+ var SYNC_BILLING_CATALOG_PRICE_MUTATION = gql`
4644
+ mutation syncBillingCatalogPrice($input: SyncBillingCatalogPriceInputType!) {
4645
+ syncBillingCatalogPrice(input: $input) {
4646
+ data {
4647
+ ...BillingCatalogFields
4648
+ }
4649
+ message
4650
+ }
4651
+ }
4652
+ ${BILLING_CATALOG_FIELDS_FRAGMENT}
4653
+ `;
4518
4654
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
4519
4655
  fragment GameHistoryFields on GameHistoryType {
4520
4656
  createdAt
@@ -5353,46 +5489,220 @@ schema.index({
5353
5489
  start: 1,
5354
5490
  status: 1
5355
5491
  });
5492
+ schema.index({
5493
+ status: 1,
5494
+ targetRegion: 1,
5495
+ // eslint-disable-next-line sort-keys
5496
+ start: -1
5497
+ });
5356
5498
  var AdModel = import_mongoose.default.models.Ad || import_mongoose.default.model("Ad", schema);
5357
5499
 
5358
- // src/mongoose/chat/Chat.ts
5500
+ // src/mongoose/BillingCatalog.ts
5359
5501
  var import_mongoose2 = __toESM(require("mongoose"));
5360
5502
  var MongooseSchema2 = import_mongoose2.default.Schema;
5361
- var MessageReplyPreviewSchema = new MongooseSchema2(
5503
+ var BILLING_CATALOG_COLLECTION_NAME = "billingCatalog";
5504
+ var paidVendorLicences = [
5505
+ EnumUserLicence.PRO_VENDOR,
5506
+ EnumUserLicence.PRO_PLUS_VENDOR
5507
+ ];
5508
+ var supportedBillingPeriods = [
5509
+ EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,
5510
+ EnumBillingPeriod.YEARLY_ANNUAL_BILLED
5511
+ ];
5512
+ var unitAmountField = {
5513
+ min: 1,
5514
+ required: true,
5515
+ type: Number,
5516
+ validate: {
5517
+ message: "Billing catalogue price must be a positive integer.",
5518
+ validator: Number.isInteger
5519
+ }
5520
+ };
5521
+ var currencyField = {
5522
+ default: BILLING_CATALOG_CURRENCY,
5523
+ enum: [BILLING_CATALOG_CURRENCY],
5524
+ immutable: true,
5525
+ lowercase: true,
5526
+ required: true,
5527
+ trim: true,
5528
+ type: String
5529
+ };
5530
+ var stripePriceIdField = {
5531
+ default: null,
5532
+ required: false,
5533
+ trim: true,
5534
+ type: String
5535
+ };
5536
+ var stripeProductIdField = {
5537
+ default: null,
5538
+ required: false,
5539
+ trim: true,
5540
+ type: String
5541
+ };
5542
+ var priceHistorySchema = new MongooseSchema2(
5543
+ {
5544
+ changedAt: { required: true, type: Date },
5545
+ changedBy: {
5546
+ default: null,
5547
+ ref: "User",
5548
+ required: false,
5549
+ type: import_mongoose2.default.Schema.Types.ObjectId
5550
+ },
5551
+ currency: currencyField,
5552
+ effectiveFrom: { required: true, type: Date },
5553
+ effectiveTo: { required: true, type: Date },
5554
+ stripePriceId: stripePriceIdField,
5555
+ stripeProductId: stripeProductIdField,
5556
+ unitAmount: unitAmountField
5557
+ },
5558
+ { _id: false }
5559
+ );
5560
+ var schema2 = new MongooseSchema2(
5561
+ {
5562
+ active: { default: true, required: true, type: Boolean },
5563
+ billingPeriod: {
5564
+ enum: supportedBillingPeriods,
5565
+ immutable: true,
5566
+ required: true,
5567
+ type: String
5568
+ },
5569
+ currency: currencyField,
5570
+ effectiveFrom: { default: Date.now, required: true, type: Date },
5571
+ key: {
5572
+ enum: BILLING_CATALOG_KEYS,
5573
+ immutable: true,
5574
+ required: true,
5575
+ type: String,
5576
+ unique: true
5577
+ },
5578
+ licenceType: {
5579
+ enum: paidVendorLicences,
5580
+ immutable: true,
5581
+ required: true,
5582
+ type: String
5583
+ },
5584
+ priceHistory: {
5585
+ default: [],
5586
+ required: true,
5587
+ type: [priceHistorySchema]
5588
+ },
5589
+ revision: {
5590
+ default: 1,
5591
+ min: 1,
5592
+ required: true,
5593
+ type: Number,
5594
+ validate: {
5595
+ message: "Billing catalogue revision must be a positive integer.",
5596
+ validator: Number.isInteger
5597
+ }
5598
+ },
5599
+ stripePriceId: stripePriceIdField,
5600
+ stripeProductId: stripeProductIdField,
5601
+ taxInclusive: {
5602
+ default: true,
5603
+ immutable: true,
5604
+ required: true,
5605
+ type: Boolean,
5606
+ validate: {
5607
+ message: "Billing catalogue prices must include GST.",
5608
+ validator: (value) => value === true
5609
+ }
5610
+ },
5611
+ unitAmount: unitAmountField,
5612
+ updatedBy: {
5613
+ default: null,
5614
+ ref: "User",
5615
+ required: false,
5616
+ type: import_mongoose2.default.Schema.Types.ObjectId
5617
+ }
5618
+ },
5619
+ {
5620
+ collection: BILLING_CATALOG_COLLECTION_NAME,
5621
+ strict: true,
5622
+ timestamps: true
5623
+ }
5624
+ );
5625
+ schema2.pre("validate", function validateDefinition() {
5626
+ if (!billingCatalogDefinitionMatches(this)) {
5627
+ this.invalidate(
5628
+ "key",
5629
+ "Billing catalogue key does not match its licence and billing period."
5630
+ );
5631
+ }
5632
+ });
5633
+ schema2.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });
5634
+ schema2.index({ active: 1, licenceType: 1 });
5635
+ schema2.index(
5636
+ { stripePriceId: 1 },
5637
+ {
5638
+ partialFilterExpression: { stripePriceId: { $type: "string" } },
5639
+ unique: true
5640
+ }
5641
+ );
5642
+ var BillingCatalogModel = import_mongoose2.default.models.BillingCatalogEntry || import_mongoose2.default.model(
5643
+ "BillingCatalogEntry",
5644
+ schema2,
5645
+ BILLING_CATALOG_COLLECTION_NAME
5646
+ );
5647
+ function buildInitialBillingCatalogEntries(now = /* @__PURE__ */ new Date()) {
5648
+ return INITIAL_BILLING_CATALOG.map((entry) => ({
5649
+ active: entry.active,
5650
+ billingPeriod: entry.billingPeriod,
5651
+ currency: entry.currency,
5652
+ effectiveFrom: new Date(now.getTime()),
5653
+ key: entry.key,
5654
+ licenceType: entry.licenceType,
5655
+ priceHistory: [],
5656
+ revision: 1,
5657
+ stripePriceId: null,
5658
+ stripeProductId: null,
5659
+ taxInclusive: entry.taxInclusive,
5660
+ unitAmount: entry.unitAmount,
5661
+ updatedBy: null
5662
+ }));
5663
+ }
5664
+ function getBillingCatalogDefinition(key) {
5665
+ return BILLING_CATALOG_DEFINITIONS[key];
5666
+ }
5667
+
5668
+ // src/mongoose/chat/Chat.ts
5669
+ var import_mongoose3 = __toESM(require("mongoose"));
5670
+ var MongooseSchema3 = import_mongoose3.default.Schema;
5671
+ var MessageReplyPreviewSchema = new MongooseSchema3(
5362
5672
  {
5363
5673
  contentPreview: { required: true, type: String },
5364
5674
  senderId: {
5365
5675
  ref: "User",
5366
5676
  required: true,
5367
- type: import_mongoose2.default.Schema.Types.ObjectId
5677
+ type: import_mongoose3.default.Schema.Types.ObjectId
5368
5678
  },
5369
5679
  senderName: { required: true, type: String }
5370
5680
  },
5371
5681
  { _id: false }
5372
5682
  );
5373
- var MessageReactionSchema = new MongooseSchema2(
5683
+ var MessageReactionSchema = new MongooseSchema3(
5374
5684
  {
5375
5685
  createdAt: { required: true, type: Date },
5376
5686
  userId: {
5377
5687
  ref: "User",
5378
5688
  required: true,
5379
- type: import_mongoose2.default.Schema.Types.ObjectId
5689
+ type: import_mongoose3.default.Schema.Types.ObjectId
5380
5690
  }
5381
5691
  },
5382
5692
  { _id: false }
5383
5693
  );
5384
- var MessageSeenSchema = new MongooseSchema2(
5694
+ var MessageSeenSchema = new MongooseSchema3(
5385
5695
  {
5386
5696
  seenAt: { required: true, type: Date },
5387
5697
  userId: {
5388
5698
  ref: "User",
5389
5699
  required: true,
5390
- type: import_mongoose2.default.Schema.Types.ObjectId
5700
+ type: import_mongoose3.default.Schema.Types.ObjectId
5391
5701
  }
5392
5702
  },
5393
5703
  { _id: false }
5394
5704
  );
5395
- var MessageSchema = new MongooseSchema2(
5705
+ var MessageSchema = new MongooseSchema3(
5396
5706
  {
5397
5707
  content: { required: true, type: String },
5398
5708
  likedBy: { default: [], required: false, type: [MessageReactionSchema] },
@@ -5403,18 +5713,18 @@ var MessageSchema = new MongooseSchema2(
5403
5713
  replyToMessageId: {
5404
5714
  ref: "Chat.messages",
5405
5715
  required: false,
5406
- type: import_mongoose2.default.Schema.Types.ObjectId
5716
+ type: import_mongoose3.default.Schema.Types.ObjectId
5407
5717
  },
5408
5718
  seenBy: { default: [], required: false, type: [MessageSeenSchema] },
5409
5719
  senderId: {
5410
5720
  ref: "User",
5411
5721
  required: true,
5412
- type: import_mongoose2.default.Schema.Types.ObjectId
5722
+ type: import_mongoose3.default.Schema.Types.ObjectId
5413
5723
  }
5414
5724
  },
5415
5725
  { timestamps: true }
5416
5726
  );
5417
- var ParticipantSchema = new MongooseSchema2(
5727
+ var ParticipantSchema = new MongooseSchema3(
5418
5728
  {
5419
5729
  active: { default: true, required: true, type: Boolean },
5420
5730
  userAvatar: { required: false, type: String },
@@ -5422,14 +5732,14 @@ var ParticipantSchema = new MongooseSchema2(
5422
5732
  userId: {
5423
5733
  ref: "User",
5424
5734
  required: true,
5425
- type: import_mongoose2.default.Schema.Types.ObjectId
5735
+ type: import_mongoose3.default.Schema.Types.ObjectId
5426
5736
  },
5427
5737
  userName: { required: true, type: String }
5428
5738
  },
5429
5739
  { _id: false }
5430
5740
  // Prevents Mongoose from creating an additional _id field for subdocuments
5431
5741
  );
5432
- var ChatSchema = new MongooseSchema2(
5742
+ var ChatSchema = new MongooseSchema3(
5433
5743
  {
5434
5744
  active: { default: true, required: true, type: Boolean },
5435
5745
  chatDescription: { required: false, type: String },
@@ -5453,12 +5763,12 @@ ChatSchema.index({
5453
5763
  "participants.userId": 1,
5454
5764
  updatedAt: -1
5455
5765
  });
5456
- var ChatModel = import_mongoose2.default.models.Chat || import_mongoose2.default.model("Chat", ChatSchema);
5766
+ var ChatModel = import_mongoose3.default.models.Chat || import_mongoose3.default.model("Chat", ChatSchema);
5457
5767
 
5458
5768
  // src/mongoose/chat/ChatReport.ts
5459
- var import_mongoose3 = __toESM(require("mongoose"));
5460
- var MongooseSchema3 = import_mongoose3.default.Schema;
5461
- var ReasonSchema = new MongooseSchema3(
5769
+ var import_mongoose4 = __toESM(require("mongoose"));
5770
+ var MongooseSchema4 = import_mongoose4.default.Schema;
5771
+ var ReasonSchema = new MongooseSchema4(
5462
5772
  {
5463
5773
  details: { default: null, required: false, type: String },
5464
5774
  reasonType: {
@@ -5469,23 +5779,23 @@ var ReasonSchema = new MongooseSchema3(
5469
5779
  },
5470
5780
  { _id: false }
5471
5781
  );
5472
- var ChatReportSchema = new MongooseSchema3(
5782
+ var ChatReportSchema = new MongooseSchema4(
5473
5783
  {
5474
5784
  chatId: {
5475
5785
  ref: "Chat",
5476
5786
  required: true,
5477
- type: import_mongoose3.default.Schema.Types.ObjectId
5787
+ type: import_mongoose4.default.Schema.Types.ObjectId
5478
5788
  },
5479
5789
  reason: { required: true, type: ReasonSchema },
5480
5790
  reportedUserId: {
5481
5791
  ref: "User",
5482
5792
  required: true,
5483
- type: import_mongoose3.default.Schema.Types.ObjectId
5793
+ type: import_mongoose4.default.Schema.Types.ObjectId
5484
5794
  },
5485
5795
  reporterUserId: {
5486
5796
  ref: "User",
5487
5797
  required: true,
5488
- type: import_mongoose3.default.Schema.Types.ObjectId
5798
+ type: import_mongoose4.default.Schema.Types.ObjectId
5489
5799
  },
5490
5800
  resolved: { default: false, required: true, type: Boolean }
5491
5801
  },
@@ -5493,18 +5803,18 @@ var ChatReportSchema = new MongooseSchema3(
5493
5803
  );
5494
5804
  ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
5495
5805
  ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
5496
- var ChatReportModel = import_mongoose3.default.models.ChatReport || import_mongoose3.default.model("ChatReport", ChatReportSchema);
5806
+ var ChatReportModel = import_mongoose4.default.models.ChatReport || import_mongoose4.default.model("ChatReport", ChatReportSchema);
5497
5807
 
5498
5808
  // src/mongoose/global.ts
5499
- var import_mongoose6 = __toESM(require("mongoose"));
5809
+ var import_mongoose7 = __toESM(require("mongoose"));
5500
5810
 
5501
5811
  // src/mongoose/Relation.ts
5502
- var import_mongoose5 = __toESM(require("mongoose"));
5812
+ var import_mongoose6 = __toESM(require("mongoose"));
5503
5813
 
5504
5814
  // src/mongoose/event/EventInfo.ts
5505
- var import_mongoose4 = __toESM(require("mongoose"));
5506
- var MongooseSchema4 = import_mongoose4.default.Schema;
5507
- var StallTypeSchema = new MongooseSchema4(
5815
+ var import_mongoose5 = __toESM(require("mongoose"));
5816
+ var MongooseSchema5 = import_mongoose5.default.Schema;
5817
+ var StallTypeSchema = new MongooseSchema5(
5508
5818
  {
5509
5819
  label: { required: false, type: String },
5510
5820
  price: { required: false, type: Number },
@@ -5515,7 +5825,7 @@ var StallTypeSchema = new MongooseSchema4(
5515
5825
  // Prevents Mongoose from creating an additional _id field for subdocuments
5516
5826
  }
5517
5827
  );
5518
- var dateTimeSchema = new MongooseSchema4(
5828
+ var dateTimeSchema = new MongooseSchema5(
5519
5829
  {
5520
5830
  dateStatus: {
5521
5831
  enum: Object.values(EnumEventDateStatus),
@@ -5531,7 +5841,7 @@ var dateTimeSchema = new MongooseSchema4(
5531
5841
  { _id: false }
5532
5842
  // Prevents Mongoose from creating an additional _id field for subdocuments
5533
5843
  );
5534
- var paymentInfoSchema = new MongooseSchema4(
5844
+ var paymentInfoSchema = new MongooseSchema5(
5535
5845
  {
5536
5846
  accountHolderName: { required: false, type: String },
5537
5847
  accountNumber: { required: false, type: String },
@@ -5545,7 +5855,7 @@ var paymentInfoSchema = new MongooseSchema4(
5545
5855
  { _id: false }
5546
5856
  // Prevents Mongoose from creating an additional _id field
5547
5857
  );
5548
- var requirementsSchema = new MongooseSchema4(
5858
+ var requirementsSchema = new MongooseSchema5(
5549
5859
  {
5550
5860
  category: { required: true, type: String },
5551
5861
  label: { required: true, type: String },
@@ -5556,7 +5866,7 @@ var requirementsSchema = new MongooseSchema4(
5556
5866
  // Prevents Mongoose from creating an additional _id field for
5557
5867
  }
5558
5868
  );
5559
- var refundPolicySchema = new MongooseSchema4(
5869
+ var refundPolicySchema = new MongooseSchema5(
5560
5870
  {
5561
5871
  category: { required: true, type: String },
5562
5872
  label: { required: true, type: String },
@@ -5564,7 +5874,7 @@ var refundPolicySchema = new MongooseSchema4(
5564
5874
  },
5565
5875
  { _id: false }
5566
5876
  );
5567
- var schema2 = new MongooseSchema4(
5877
+ var schema3 = new MongooseSchema5(
5568
5878
  {
5569
5879
  active: { default: true, type: Boolean },
5570
5880
  applicationDeadlineHours: { required: true, type: Number },
@@ -5572,7 +5882,7 @@ var schema2 = new MongooseSchema4(
5572
5882
  eventId: {
5573
5883
  ref: "Event",
5574
5884
  required: true,
5575
- type: import_mongoose4.default.Schema.Types.ObjectId
5885
+ type: import_mongoose5.default.Schema.Types.ObjectId
5576
5886
  },
5577
5887
  packInTime: { required: true, type: Number },
5578
5888
  paymentDueHours: { required: true, type: Number },
@@ -5582,11 +5892,11 @@ var schema2 = new MongooseSchema4(
5582
5892
  },
5583
5893
  { timestamps: true }
5584
5894
  );
5585
- var EventInfoModel = import_mongoose4.default.models.EventInfo || import_mongoose4.default.model("EventInfo", schema2);
5895
+ var EventInfoModel = import_mongoose5.default.models.EventInfo || import_mongoose5.default.model("EventInfo", schema3);
5586
5896
 
5587
5897
  // src/mongoose/Relation.ts
5588
- var MongooseSchema5 = import_mongoose5.default.Schema;
5589
- var relationDateTimeSchema = new MongooseSchema5(
5898
+ var MongooseSchema6 = import_mongoose6.default.Schema;
5899
+ var relationDateTimeSchema = new MongooseSchema6(
5590
5900
  {
5591
5901
  dateStatus: {
5592
5902
  enum: Object.values(EnumEventDateStatus),
@@ -5601,7 +5911,7 @@ var relationDateTimeSchema = new MongooseSchema5(
5601
5911
  },
5602
5912
  { _id: false }
5603
5913
  );
5604
- var relationDatesSchema = new MongooseSchema5(
5914
+ var relationDatesSchema = new MongooseSchema6(
5605
5915
  {
5606
5916
  dateTime: {
5607
5917
  required: true,
@@ -5620,19 +5930,19 @@ var relationDatesSchema = new MongooseSchema5(
5620
5930
  },
5621
5931
  { _id: false }
5622
5932
  );
5623
- var RelationTypeSchema = new MongooseSchema5(
5933
+ var RelationTypeSchema = new MongooseSchema6(
5624
5934
  {
5625
5935
  active: { default: true, required: true, type: Boolean },
5626
5936
  chatId: {
5627
5937
  ref: "Chat",
5628
5938
  required: true,
5629
- type: import_mongoose5.default.Schema.Types.ObjectId
5939
+ type: import_mongoose6.default.Schema.Types.ObjectId
5630
5940
  },
5631
5941
  deletedAt: { default: null, required: false, type: Date },
5632
5942
  eventId: {
5633
5943
  ref: "Event",
5634
5944
  required: true,
5635
- type: import_mongoose5.default.Schema.Types.ObjectId
5945
+ type: import_mongoose6.default.Schema.Types.ObjectId
5636
5946
  },
5637
5947
  lastUpdateBy: {
5638
5948
  enum: Object.values(EnumResourceType),
@@ -5648,7 +5958,7 @@ var RelationTypeSchema = new MongooseSchema5(
5648
5958
  vendorId: {
5649
5959
  ref: "Vendor",
5650
5960
  required: true,
5651
- type: import_mongoose5.default.Schema.Types.ObjectId
5961
+ type: import_mongoose6.default.Schema.Types.ObjectId
5652
5962
  }
5653
5963
  },
5654
5964
  { timestamps: true }
@@ -5660,23 +5970,23 @@ RelationTypeSchema.index({
5660
5970
  "relationDates.status": 1,
5661
5971
  vendorId: 1
5662
5972
  });
5663
- var RelationModel = import_mongoose5.default.models.Relation || import_mongoose5.default.model("Relation", RelationTypeSchema);
5973
+ var RelationModel = import_mongoose6.default.models.Relation || import_mongoose6.default.model("Relation", RelationTypeSchema);
5664
5974
 
5665
5975
  // src/mongoose/global.ts
5666
- var MongooseSchema6 = import_mongoose6.default.Schema;
5667
- var OwnerTypeSchema = new MongooseSchema6(
5976
+ var MongooseSchema7 = import_mongoose7.default.Schema;
5977
+ var OwnerTypeSchema = new MongooseSchema7(
5668
5978
  {
5669
5979
  email: { required: true, type: String },
5670
5980
  userId: {
5671
5981
  ref: "User",
5672
5982
  required: true,
5673
- type: import_mongoose6.default.Schema.Types.ObjectId
5983
+ type: import_mongoose7.default.Schema.Types.ObjectId
5674
5984
  }
5675
5985
  },
5676
5986
  { _id: false }
5677
5987
  // Prevents Mongoose from creating an additional _id field for subdocuments
5678
5988
  );
5679
- var SocialMediaTypeSchema = new MongooseSchema6(
5989
+ var SocialMediaTypeSchema = new MongooseSchema7(
5680
5990
  {
5681
5991
  link: { required: true, type: String },
5682
5992
  name: { required: true, type: String }
@@ -5684,7 +5994,7 @@ var SocialMediaTypeSchema = new MongooseSchema6(
5684
5994
  { _id: false }
5685
5995
  // Prevents Mongoose from creating an additional _id field
5686
5996
  );
5687
- var ResourceImageTypeSchema = new MongooseSchema6(
5997
+ var ResourceImageTypeSchema = new MongooseSchema7(
5688
5998
  {
5689
5999
  active: { default: true, required: true, type: Boolean },
5690
6000
  source: { required: false, type: String },
@@ -5693,7 +6003,7 @@ var ResourceImageTypeSchema = new MongooseSchema6(
5693
6003
  { _id: false }
5694
6004
  // Prevents Mongoose from creating an additional _id field for subdocuments
5695
6005
  );
5696
- var SubCategorySchema = new MongooseSchema6(
6006
+ var SubCategorySchema = new MongooseSchema7(
5697
6007
  {
5698
6008
  id: { required: false, type: String },
5699
6009
  items: [
@@ -5707,7 +6017,7 @@ var SubCategorySchema = new MongooseSchema6(
5707
6017
  { _id: false }
5708
6018
  // Prevents Mongoose from creating an additional _id field for subdocuments
5709
6019
  );
5710
- var CategorySchema = new MongooseSchema6(
6020
+ var CategorySchema = new MongooseSchema7(
5711
6021
  {
5712
6022
  id: { required: true, type: String },
5713
6023
  name: { required: true, type: String },
@@ -5716,7 +6026,7 @@ var CategorySchema = new MongooseSchema6(
5716
6026
  { _id: false }
5717
6027
  // Prevents Mongoose from creating an additional _id field for subdocuments
5718
6028
  );
5719
- var PosterUsageTypeSchema = new MongooseSchema6(
6029
+ var PosterUsageTypeSchema = new MongooseSchema7(
5720
6030
  {
5721
6031
  count: { default: 0, required: false, type: Number },
5722
6032
  month: { required: false, type: String }
@@ -5724,7 +6034,7 @@ var PosterUsageTypeSchema = new MongooseSchema6(
5724
6034
  { _id: false }
5725
6035
  // Prevents Mongoose from creating an additional _id field for subdocuments
5726
6036
  );
5727
- var userLicenseSchema = new MongooseSchema6(
6037
+ var userLicenseSchema = new MongooseSchema7(
5728
6038
  {
5729
6039
  expiryDate: { required: true, type: Date },
5730
6040
  issuedDate: { required: true, type: Date },
@@ -5741,7 +6051,7 @@ var userLicenseSchema = new MongooseSchema6(
5741
6051
  },
5742
6052
  { _id: false, timestamps: false }
5743
6053
  );
5744
- var ContactDetailsSchema = new MongooseSchema6(
6054
+ var ContactDetailsSchema = new MongooseSchema7(
5745
6055
  {
5746
6056
  email: { required: false, type: String },
5747
6057
  landlinePhone: { required: false, type: String },
@@ -5750,7 +6060,7 @@ var ContactDetailsSchema = new MongooseSchema6(
5750
6060
  { _id: false }
5751
6061
  // Prevents Mongoose from creating an additional _id field for subdocuments
5752
6062
  );
5753
- var termsAgreementSchema = new MongooseSchema6(
6063
+ var termsAgreementSchema = new MongooseSchema7(
5754
6064
  {
5755
6065
  appBuildNumber: { required: true, type: String },
5756
6066
  appId: { required: true, type: String },
@@ -5767,7 +6077,7 @@ var termsAgreementSchema = new MongooseSchema6(
5767
6077
  },
5768
6078
  { _id: false }
5769
6079
  );
5770
- var resourceRelationsSchema = new MongooseSchema6(
6080
+ var resourceRelationsSchema = new MongooseSchema7(
5771
6081
  {
5772
6082
  relationDates: {
5773
6083
  default: [],
@@ -5777,12 +6087,12 @@ var resourceRelationsSchema = new MongooseSchema6(
5777
6087
  relationId: {
5778
6088
  ref: "Relation",
5779
6089
  required: false,
5780
- type: import_mongoose6.default.Schema.Types.ObjectId
6090
+ type: import_mongoose7.default.Schema.Types.ObjectId
5781
6091
  }
5782
6092
  },
5783
6093
  { _id: false }
5784
6094
  );
5785
- var dateTimeSchema2 = new MongooseSchema6(
6095
+ var dateTimeSchema2 = new MongooseSchema7(
5786
6096
  {
5787
6097
  dateStatus: {
5788
6098
  enum: Object.values(EnumEventDateStatus),
@@ -5797,7 +6107,7 @@ var dateTimeSchema2 = new MongooseSchema6(
5797
6107
  { _id: false }
5798
6108
  // Prevents Mongoose from creating an additional _id field for subdocuments
5799
6109
  );
5800
- var locationGeoSchema = new MongooseSchema6(
6110
+ var locationGeoSchema = new MongooseSchema7(
5801
6111
  {
5802
6112
  coordinates: { required: true, type: [Number] },
5803
6113
  // [longitude, latitude]
@@ -5806,7 +6116,7 @@ var locationGeoSchema = new MongooseSchema6(
5806
6116
  { _id: false }
5807
6117
  // Prevents Mongoose from creating an additional _id field for subdocuments
5808
6118
  );
5809
- var locationsSchema = new MongooseSchema6(
6119
+ var locationsSchema = new MongooseSchema7(
5810
6120
  {
5811
6121
  city: { required: true, type: String },
5812
6122
  country: { required: true, type: String },
@@ -5822,13 +6132,13 @@ var locationsSchema = new MongooseSchema6(
5822
6132
  { _id: false }
5823
6133
  // Prevents Mongoose from creating an additional _id field for subdocuments
5824
6134
  );
5825
- var relatedPostSchema = new MongooseSchema6(
6135
+ var relatedPostSchema = new MongooseSchema7(
5826
6136
  {
5827
6137
  postActive: { default: true, required: true, type: Boolean },
5828
6138
  postId: {
5829
6139
  ref: "Post",
5830
6140
  required: true,
5831
- type: import_mongoose6.default.Schema.Types.ObjectId
6141
+ type: import_mongoose7.default.Schema.Types.ObjectId
5832
6142
  },
5833
6143
  postSlug: { required: true, type: String },
5834
6144
  postType: {
@@ -5840,7 +6150,7 @@ var relatedPostSchema = new MongooseSchema6(
5840
6150
  { _id: false }
5841
6151
  // Prevents Mongoose from creating an additional _id field for subdocuments
5842
6152
  );
5843
- var socialShareResourceSchema = new MongooseSchema6(
6153
+ var socialShareResourceSchema = new MongooseSchema7(
5844
6154
  {
5845
6155
  qrCode: { required: true, type: ResourceImageTypeSchema },
5846
6156
  socialImage: { required: true, type: ResourceImageTypeSchema }
@@ -5853,7 +6163,7 @@ var baseResourceFields = {
5853
6163
  adIds: {
5854
6164
  ref: "Ad",
5855
6165
  required: false,
5856
- type: [import_mongoose6.default.Schema.Types.ObjectId]
6166
+ type: [import_mongoose7.default.Schema.Types.ObjectId]
5857
6167
  },
5858
6168
  approvedAt: { default: null, required: false, type: Date },
5859
6169
  contactDetails: { required: false, type: ContactDetailsSchema },
@@ -5883,9 +6193,9 @@ var baseResourceFields = {
5883
6193
  };
5884
6194
 
5885
6195
  // src/mongoose/GoogleImportedMarket.ts
5886
- var import_mongoose7 = __toESM(require("mongoose"));
5887
- var MongooseSchema7 = import_mongoose7.default.Schema;
5888
- var addressComponentSchema = new MongooseSchema7(
6196
+ var import_mongoose8 = __toESM(require("mongoose"));
6197
+ var MongooseSchema8 = import_mongoose8.default.Schema;
6198
+ var addressComponentSchema = new MongooseSchema8(
5889
6199
  {
5890
6200
  longName: { required: false, type: String },
5891
6201
  shortName: { required: false, type: String },
@@ -5893,7 +6203,7 @@ var addressComponentSchema = new MongooseSchema7(
5893
6203
  },
5894
6204
  { _id: false }
5895
6205
  );
5896
- var schema3 = new MongooseSchema7(
6206
+ var schema4 = new MongooseSchema8(
5897
6207
  {
5898
6208
  active: { default: false, required: true, type: Boolean },
5899
6209
  address: { required: true, type: String },
@@ -5905,7 +6215,7 @@ var schema3 = new MongooseSchema7(
5905
6215
  claimedByUserId: {
5906
6216
  ref: "User",
5907
6217
  required: false,
5908
- type: import_mongoose7.default.Schema.Types.ObjectId
6218
+ type: import_mongoose8.default.Schema.Types.ObjectId
5909
6219
  },
5910
6220
  cover: {
5911
6221
  required: false,
@@ -5917,7 +6227,7 @@ var schema3 = new MongooseSchema7(
5917
6227
  eventId: {
5918
6228
  ref: "Event",
5919
6229
  required: false,
5920
- type: import_mongoose7.default.Schema.Types.ObjectId
6230
+ type: import_mongoose8.default.Schema.Types.ObjectId
5921
6231
  },
5922
6232
  eventType: {
5923
6233
  enum: Object.values(EnumEventType),
@@ -5956,18 +6266,18 @@ var schema3 = new MongooseSchema7(
5956
6266
  },
5957
6267
  { timestamps: true }
5958
6268
  );
5959
- schema3.index({ "location.geo": "2dsphere" });
5960
- schema3.index({ name: 1 });
5961
- schema3.index({ region: 1 });
5962
- schema3.index({ deletedAt: 1 });
5963
- schema3.index({ "dateTime.dateStatus": 1 });
5964
- schema3.index({ slug: 1 });
5965
- var GoogleImportedMarketModel = import_mongoose7.default.models.GoogleImportedMarket || import_mongoose7.default.model("GoogleImportedMarket", schema3);
6269
+ schema4.index({ "location.geo": "2dsphere" });
6270
+ schema4.index({ name: 1 });
6271
+ schema4.index({ region: 1 });
6272
+ schema4.index({ deletedAt: 1 });
6273
+ schema4.index({ "dateTime.dateStatus": 1 });
6274
+ schema4.index({ slug: 1 });
6275
+ var GoogleImportedMarketModel = import_mongoose8.default.models.GoogleImportedMarket || import_mongoose8.default.model("GoogleImportedMarket", schema4);
5966
6276
 
5967
6277
  // src/mongoose/Notification.ts
5968
- var import_mongoose8 = __toESM(require("mongoose"));
5969
- var MongooseSchema8 = import_mongoose8.default.Schema;
5970
- var schema4 = new MongooseSchema8(
6278
+ var import_mongoose9 = __toESM(require("mongoose"));
6279
+ var MongooseSchema9 = import_mongoose9.default.Schema;
6280
+ var schema5 = new MongooseSchema9(
5971
6281
  {
5972
6282
  data: {
5973
6283
  resourceId: { required: true, type: String },
@@ -5990,16 +6300,16 @@ var schema4 = new MongooseSchema8(
5990
6300
  userId: {
5991
6301
  ref: "User",
5992
6302
  required: true,
5993
- type: import_mongoose8.default.Schema.Types.ObjectId
6303
+ type: import_mongoose9.default.Schema.Types.ObjectId
5994
6304
  }
5995
6305
  },
5996
6306
  { timestamps: true }
5997
6307
  );
5998
- schema4.index({ isRead: 1, userId: 1 });
5999
- schema4.index({ createdAt: -1, userId: 1 });
6000
- var NotificationModel = import_mongoose8.default.models.Notification || import_mongoose8.default.model("Notification", schema4);
6308
+ schema5.index({ isRead: 1, userId: 1 });
6309
+ schema5.index({ createdAt: -1, userId: 1 });
6310
+ var NotificationModel = import_mongoose9.default.models.Notification || import_mongoose9.default.model("Notification", schema5);
6001
6311
 
6002
- // node_modules/@timardex/cluemart-shared/dist/chunk-7IB7QPVH.mjs
6312
+ // node_modules/@timardex/cluemart-shared/dist/chunk-P4NLBWEJ.mjs
6003
6313
  var EnumInviteStatus2 = /* @__PURE__ */ ((EnumInviteStatus22) => {
6004
6314
  EnumInviteStatus22["ACCEPTED"] = "Accepted";
6005
6315
  EnumInviteStatus22["COMPLETED"] = "Completed";
@@ -6077,9 +6387,9 @@ var EnumSubscriptionStatus2 = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6077
6387
  })(EnumSubscriptionStatus2 || {});
6078
6388
 
6079
6389
  // src/mongoose/PushToken.ts
6080
- var import_mongoose9 = __toESM(require("mongoose"));
6081
- var MongooseSchema9 = import_mongoose9.default.Schema;
6082
- var schema5 = new MongooseSchema9(
6390
+ var import_mongoose10 = __toESM(require("mongoose"));
6391
+ var MongooseSchema10 = import_mongoose10.default.Schema;
6392
+ var schema6 = new MongooseSchema10(
6083
6393
  {
6084
6394
  platform: {
6085
6395
  enum: Object.values(EnumOSPlatform2),
@@ -6090,17 +6400,17 @@ var schema5 = new MongooseSchema9(
6090
6400
  userId: {
6091
6401
  ref: "User",
6092
6402
  required: true,
6093
- type: import_mongoose9.default.Schema.Types.ObjectId
6403
+ type: import_mongoose10.default.Schema.Types.ObjectId
6094
6404
  }
6095
6405
  },
6096
6406
  { timestamps: true }
6097
6407
  );
6098
- var PushTokenModel = import_mongoose9.default.models.PushToken || import_mongoose9.default.model("PushToken", schema5);
6408
+ var PushTokenModel = import_mongoose10.default.models.PushToken || import_mongoose10.default.model("PushToken", schema6);
6099
6409
 
6100
6410
  // src/mongoose/ResourceActivity.ts
6101
- var import_mongoose10 = __toESM(require("mongoose"));
6102
- var MongooseSchema10 = import_mongoose10.default.Schema;
6103
- var ActivitySchema = new MongooseSchema10(
6411
+ var import_mongoose11 = __toESM(require("mongoose"));
6412
+ var MongooseSchema11 = import_mongoose11.default.Schema;
6413
+ var ActivitySchema = new MongooseSchema11(
6104
6414
  {
6105
6415
  activityType: {
6106
6416
  enum: Object.values(EnumActivity),
@@ -6128,7 +6438,7 @@ var ActivitySchema = new MongooseSchema10(
6128
6438
  },
6129
6439
  { _id: false }
6130
6440
  );
6131
- var schema6 = new MongooseSchema10(
6441
+ var schema7 = new MongooseSchema11(
6132
6442
  {
6133
6443
  activity: { default: [], type: [ActivitySchema] },
6134
6444
  resourceId: { required: true, type: String },
@@ -6140,46 +6450,55 @@ var schema6 = new MongooseSchema10(
6140
6450
  },
6141
6451
  { timestamps: true }
6142
6452
  );
6143
- schema6.index({ resourceId: 1, resourceType: 1 }, { unique: true });
6144
- schema6.index({ "views.location": "2dsphere" });
6145
- var ResourceActivityModel = import_mongoose10.default.models.ResourceActivity || import_mongoose10.default.model("ResourceActivity", schema6);
6453
+ schema7.index({ resourceId: 1, resourceType: 1 }, { unique: true });
6454
+ schema7.index({ "views.location": "2dsphere" });
6455
+ var ResourceActivityModel = import_mongoose11.default.models.ResourceActivity || import_mongoose11.default.model("ResourceActivity", schema7);
6146
6456
 
6147
6457
  // src/mongoose/User.ts
6148
- var import_mongoose11 = __toESM(require("mongoose"));
6149
- var MongooseSchema11 = import_mongoose11.default.Schema;
6150
- var userActivityEventSchema = new MongooseSchema11(
6458
+ var import_mongoose12 = __toESM(require("mongoose"));
6459
+ var MongooseSchema12 = import_mongoose12.default.Schema;
6460
+ var userActivityEventSchema = new MongooseSchema12(
6151
6461
  {
6152
6462
  dateTime: dateTimeSchema2,
6153
6463
  resourceId: {
6154
6464
  ref: "Event",
6155
6465
  required: false,
6156
- type: import_mongoose11.default.Schema.Types.ObjectId
6466
+ type: import_mongoose12.default.Schema.Types.ObjectId
6157
6467
  }
6158
6468
  },
6159
6469
  { _id: false }
6160
6470
  );
6161
- var userActivityFavouritesSchema = new MongooseSchema11(
6471
+ var userActivityFavouritesSchema = new MongooseSchema12(
6162
6472
  {
6163
6473
  events: {
6164
6474
  ref: "Event",
6165
6475
  required: false,
6166
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6476
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6167
6477
  },
6168
6478
  partners: {
6169
6479
  ref: "Partner",
6170
6480
  required: false,
6171
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6481
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6172
6482
  },
6173
6483
  vendors: {
6174
6484
  ref: "Vendor",
6175
6485
  required: false,
6176
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6486
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6177
6487
  }
6178
6488
  },
6179
6489
  { _id: false }
6180
6490
  );
6181
- var stripeSchema = new MongooseSchema11(
6491
+ var stripeSchema = new MongooseSchema12(
6182
6492
  {
6493
+ billingPeriod: {
6494
+ enum: Object.values(EnumBillingPeriod),
6495
+ required: false,
6496
+ type: String
6497
+ },
6498
+ cancelAtPeriodEnd: {
6499
+ required: false,
6500
+ type: Boolean
6501
+ },
6183
6502
  currentPlan: {
6184
6503
  enum: Object.values(EnumUserLicence),
6185
6504
  required: false,
@@ -6193,6 +6512,28 @@ var stripeSchema = new MongooseSchema11(
6193
6512
  required: false,
6194
6513
  type: Date
6195
6514
  },
6515
+ pendingBillingPeriod: {
6516
+ enum: Object.values(EnumBillingPeriod),
6517
+ required: false,
6518
+ type: String
6519
+ },
6520
+ pendingChangeEffectiveAt: {
6521
+ required: false,
6522
+ type: Date
6523
+ },
6524
+ pendingPlan: {
6525
+ enum: Object.values(EnumUserLicence),
6526
+ required: false,
6527
+ type: String
6528
+ },
6529
+ priceId: {
6530
+ required: false,
6531
+ type: String
6532
+ },
6533
+ scheduleId: {
6534
+ required: false,
6535
+ type: String
6536
+ },
6196
6537
  startDate: {
6197
6538
  required: false,
6198
6539
  type: Date
@@ -6205,11 +6546,19 @@ var stripeSchema = new MongooseSchema11(
6205
6546
  subscriptionId: {
6206
6547
  required: false,
6207
6548
  type: String
6549
+ },
6550
+ subscriptionMutationLockExpiresAt: {
6551
+ required: false,
6552
+ type: Date
6553
+ },
6554
+ subscriptionMutationLockId: {
6555
+ required: false,
6556
+ type: String
6208
6557
  }
6209
6558
  },
6210
6559
  { _id: false }
6211
6560
  );
6212
- var redeemedRewardSchema = new MongooseSchema11(
6561
+ var redeemedRewardSchema = new MongooseSchema12(
6213
6562
  {
6214
6563
  name: {
6215
6564
  enum: Object.values(EnumReward),
@@ -6221,13 +6570,13 @@ var redeemedRewardSchema = new MongooseSchema11(
6221
6570
  },
6222
6571
  { _id: false }
6223
6572
  );
6224
- var schema7 = new MongooseSchema11(
6573
+ var schema8 = new MongooseSchema12(
6225
6574
  {
6226
6575
  active: { default: false, required: true, type: Boolean },
6227
6576
  affiliate: {
6228
6577
  ref: "Affiliate",
6229
6578
  required: false,
6230
- type: import_mongoose11.default.Schema.Types.ObjectId
6579
+ type: import_mongoose12.default.Schema.Types.ObjectId
6231
6580
  },
6232
6581
  avatar: {
6233
6582
  required: false,
@@ -6236,7 +6585,7 @@ var schema7 = new MongooseSchema11(
6236
6585
  coupon: {
6237
6586
  ref: "Coupon",
6238
6587
  required: false,
6239
- type: import_mongoose11.default.Schema.Types.ObjectId
6588
+ type: import_mongoose12.default.Schema.Types.ObjectId
6240
6589
  },
6241
6590
  deletedAt: { default: null, required: false, type: Date },
6242
6591
  email: { required: true, type: String },
@@ -6248,13 +6597,13 @@ var schema7 = new MongooseSchema11(
6248
6597
  events: {
6249
6598
  ref: "Event",
6250
6599
  required: false,
6251
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6600
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6252
6601
  },
6253
6602
  firstName: { required: true, type: String },
6254
6603
  game: {
6255
6604
  ref: "Game",
6256
6605
  required: false,
6257
- type: import_mongoose11.default.Schema.Types.ObjectId
6606
+ type: import_mongoose12.default.Schema.Types.ObjectId
6258
6607
  },
6259
6608
  interests: {
6260
6609
  enum: Object.values(EnumResourceType),
@@ -6276,7 +6625,7 @@ var schema7 = new MongooseSchema11(
6276
6625
  partner: {
6277
6626
  ref: "Partner",
6278
6627
  required: false,
6279
- type: import_mongoose11.default.Schema.Types.ObjectId
6628
+ type: import_mongoose12.default.Schema.Types.ObjectId
6280
6629
  },
6281
6630
  password: { required: true, type: String },
6282
6631
  platform: {
@@ -6309,7 +6658,7 @@ var schema7 = new MongooseSchema11(
6309
6658
  school: {
6310
6659
  ref: "School",
6311
6660
  required: false,
6312
- type: import_mongoose11.default.Schema.Types.ObjectId
6661
+ type: import_mongoose12.default.Schema.Types.ObjectId
6313
6662
  },
6314
6663
  stripe: {
6315
6664
  required: false,
@@ -6334,19 +6683,19 @@ var schema7 = new MongooseSchema11(
6334
6683
  vendor: {
6335
6684
  ref: "Vendor",
6336
6685
  required: false,
6337
- type: import_mongoose11.default.Schema.Types.ObjectId
6686
+ type: import_mongoose12.default.Schema.Types.ObjectId
6338
6687
  }
6339
6688
  },
6340
6689
  { strict: false, timestamps: true }
6341
6690
  );
6342
- schema7.index({ "licences.expiryDate": 1 });
6343
- schema7.index({ "licences.licenceType": 1 });
6344
- var UserModel = import_mongoose11.default.models.User || import_mongoose11.default.model("User", schema7);
6691
+ schema8.index({ "licences.expiryDate": 1 });
6692
+ schema8.index({ "licences.licenceType": 1 });
6693
+ var UserModel = import_mongoose12.default.models.User || import_mongoose12.default.model("User", schema8);
6345
6694
 
6346
6695
  // src/mongoose/VerificationToken.ts
6347
- var import_mongoose12 = __toESM(require("mongoose"));
6348
- var MongooseSchema12 = import_mongoose12.default.Schema;
6349
- var schema8 = new MongooseSchema12(
6696
+ var import_mongoose13 = __toESM(require("mongoose"));
6697
+ var MongooseSchema13 = import_mongoose13.default.Schema;
6698
+ var schema9 = new MongooseSchema13(
6350
6699
  {
6351
6700
  createdAt: {
6352
6701
  default: Date.now,
@@ -6361,12 +6710,12 @@ var schema8 = new MongooseSchema12(
6361
6710
  },
6362
6711
  { timestamps: true }
6363
6712
  );
6364
- var VerificationTokenModel = import_mongoose12.default.models.VerificationToken || import_mongoose12.default.model("VerificationToken", schema8);
6713
+ var VerificationTokenModel = import_mongoose13.default.models.VerificationToken || import_mongoose13.default.model("VerificationToken", schema9);
6365
6714
 
6366
6715
  // src/mongoose/vendor/Vendor.ts
6367
- var import_mongoose13 = __toESM(require("mongoose"));
6368
- var MongooseSchema13 = import_mongoose13.default.Schema;
6369
- var vendorProductTypeSchema = new MongooseSchema13(
6716
+ var import_mongoose14 = __toESM(require("mongoose"));
6717
+ var MongooseSchema14 = import_mongoose14.default.Schema;
6718
+ var vendorProductTypeSchema = new MongooseSchema14(
6370
6719
  {
6371
6720
  description: { required: false, type: String },
6372
6721
  name: { required: true, type: String },
@@ -6377,14 +6726,14 @@ var vendorProductTypeSchema = new MongooseSchema13(
6377
6726
  },
6378
6727
  { timestamps: true }
6379
6728
  );
6380
- var productWrapperSchema = new MongooseSchema13(
6729
+ var productWrapperSchema = new MongooseSchema14(
6381
6730
  {
6382
6731
  active: { default: false, required: false, type: Boolean },
6383
6732
  productsList: { required: false, type: [vendorProductTypeSchema] }
6384
6733
  },
6385
6734
  { _id: false }
6386
6735
  );
6387
- var calendarSchema = new MongooseSchema13(
6736
+ var calendarSchema = new MongooseSchema14(
6388
6737
  {
6389
6738
  dateTime: {
6390
6739
  dateStatus: {
@@ -6405,14 +6754,14 @@ var calendarSchema = new MongooseSchema13(
6405
6754
  },
6406
6755
  { _id: false }
6407
6756
  );
6408
- var calendarWrapperSchema = new MongooseSchema13(
6757
+ var calendarWrapperSchema = new MongooseSchema14(
6409
6758
  {
6410
6759
  active: { default: false, required: true, type: Boolean },
6411
6760
  calendarData: { required: false, type: [calendarSchema] }
6412
6761
  },
6413
6762
  { _id: false }
6414
6763
  );
6415
- var schema9 = new MongooseSchema13(
6764
+ var schema10 = new MongooseSchema14(
6416
6765
  {
6417
6766
  ...baseResourceFields,
6418
6767
  // Importing base resource fields from global.ts
@@ -6438,12 +6787,12 @@ var schema9 = new MongooseSchema13(
6438
6787
  unregisteredVendorId: {
6439
6788
  ref: "UnregisteredVendor",
6440
6789
  required: false,
6441
- type: import_mongoose13.default.Schema.Types.ObjectId
6790
+ type: import_mongoose14.default.Schema.Types.ObjectId
6442
6791
  },
6443
6792
  vendorInfoId: {
6444
6793
  ref: "VendorInfo",
6445
6794
  required: false,
6446
- type: import_mongoose13.default.Schema.Types.ObjectId
6795
+ type: import_mongoose14.default.Schema.Types.ObjectId
6447
6796
  },
6448
6797
  vendorType: {
6449
6798
  enum: Object.values(EnumVendorType),
@@ -6453,24 +6802,24 @@ var schema9 = new MongooseSchema13(
6453
6802
  },
6454
6803
  { timestamps: true }
6455
6804
  );
6456
- schema9.index({ name: 1 });
6457
- schema9.index({ description: 1 });
6458
- schema9.index({ region: 1 });
6459
- schema9.index({ "categories.name": 1 });
6460
- schema9.index({ slug: 1 });
6461
- var VendorModel = import_mongoose13.default.models.Vendor || import_mongoose13.default.model("Vendor", schema9);
6805
+ schema10.index({ name: 1 });
6806
+ schema10.index({ description: 1 });
6807
+ schema10.index({ region: 1 });
6808
+ schema10.index({ "categories.name": 1 });
6809
+ schema10.index({ slug: 1 });
6810
+ var VendorModel = import_mongoose14.default.models.Vendor || import_mongoose14.default.model("Vendor", schema10);
6462
6811
 
6463
6812
  // src/mongoose/vendor/VendorInfo.ts
6464
- var import_mongoose14 = __toESM(require("mongoose"));
6465
- var MongooseSchema14 = import_mongoose14.default.Schema;
6466
- var AttributesSchema = new MongooseSchema14(
6813
+ var import_mongoose15 = __toESM(require("mongoose"));
6814
+ var MongooseSchema15 = import_mongoose15.default.Schema;
6815
+ var AttributesSchema = new MongooseSchema15(
6467
6816
  {
6468
6817
  details: { required: false, type: String },
6469
6818
  isRequired: { default: false, required: true, type: Boolean }
6470
6819
  },
6471
6820
  { _id: false }
6472
6821
  );
6473
- var schema10 = new MongooseSchema14(
6822
+ var schema11 = new MongooseSchema15(
6474
6823
  {
6475
6824
  active: { default: true, type: Boolean },
6476
6825
  compliance: {
@@ -6505,28 +6854,28 @@ var schema10 = new MongooseSchema14(
6505
6854
  vendorId: {
6506
6855
  ref: "Vendor",
6507
6856
  required: true,
6508
- type: import_mongoose14.default.Schema.Types.ObjectId
6857
+ type: import_mongoose15.default.Schema.Types.ObjectId
6509
6858
  }
6510
6859
  },
6511
6860
  { timestamps: true }
6512
6861
  );
6513
- var VendorInfoModel = import_mongoose14.default.models.VendorInfo || import_mongoose14.default.model("VendorInfo", schema10);
6862
+ var VendorInfoModel = import_mongoose15.default.models.VendorInfo || import_mongoose15.default.model("VendorInfo", schema11);
6514
6863
 
6515
6864
  // src/mongoose/vendor/UnregisteredVendor.ts
6516
- var import_mongoose15 = __toESM(require("mongoose"));
6517
- var MongooseSchema15 = import_mongoose15.default.Schema;
6518
- var invitationSchema = new MongooseSchema15(
6865
+ var import_mongoose16 = __toESM(require("mongoose"));
6866
+ var MongooseSchema16 = import_mongoose16.default.Schema;
6867
+ var invitationSchema = new MongooseSchema16(
6519
6868
  {
6520
6869
  dateTime: { required: true, type: [dateTimeSchema2] },
6521
6870
  inviterId: {
6522
6871
  ref: "Event",
6523
6872
  required: true,
6524
- type: import_mongoose15.default.Schema.Types.ObjectId
6873
+ type: import_mongoose16.default.Schema.Types.ObjectId
6525
6874
  }
6526
6875
  },
6527
6876
  { _id: false }
6528
6877
  );
6529
- var schema11 = new MongooseSchema15(
6878
+ var schema12 = new MongooseSchema16(
6530
6879
  {
6531
6880
  active: { default: true, required: true, type: Boolean },
6532
6881
  categoryIds: { required: true, type: [String] },
@@ -6535,7 +6884,7 @@ var schema11 = new MongooseSchema15(
6535
6884
  claimedByUserId: {
6536
6885
  ref: "User",
6537
6886
  required: false,
6538
- type: import_mongoose15.default.Schema.Types.ObjectId
6887
+ type: import_mongoose16.default.Schema.Types.ObjectId
6539
6888
  },
6540
6889
  claimInitiatedAt: { default: null, required: false, type: Date },
6541
6890
  claimToken: { default: null, required: false, type: String },
@@ -6548,14 +6897,14 @@ var schema11 = new MongooseSchema15(
6548
6897
  },
6549
6898
  { timestamps: true }
6550
6899
  );
6551
- schema11.index({ name: 1 });
6552
- schema11.index({ email: 1 });
6553
- var UnregisteredVendorModel = import_mongoose15.default.models.UnregisteredVendor || import_mongoose15.default.model("UnregisteredVendor", schema11);
6900
+ schema12.index({ name: 1 });
6901
+ schema12.index({ email: 1 });
6902
+ var UnregisteredVendorModel = import_mongoose16.default.models.UnregisteredVendor || import_mongoose16.default.model("UnregisteredVendor", schema12);
6554
6903
 
6555
6904
  // src/mongoose/event/Event.ts
6556
- var import_mongoose16 = __toESM(require("mongoose"));
6557
- var MongooseSchema16 = import_mongoose16.default.Schema;
6558
- var schema12 = new MongooseSchema16(
6905
+ var import_mongoose17 = __toESM(require("mongoose"));
6906
+ var MongooseSchema17 = import_mongoose17.default.Schema;
6907
+ var schema13 = new MongooseSchema17(
6559
6908
  {
6560
6909
  ...baseResourceFields,
6561
6910
  // Importing base resource fields from global.ts
@@ -6564,7 +6913,7 @@ var schema12 = new MongooseSchema16(
6564
6913
  eventInfoId: {
6565
6914
  ref: "EventInfo",
6566
6915
  required: false,
6567
- type: import_mongoose16.default.Schema.Types.ObjectId
6916
+ type: import_mongoose17.default.Schema.Types.ObjectId
6568
6917
  },
6569
6918
  eventType: {
6570
6919
  enum: Object.values(EnumEventType),
@@ -6593,20 +6942,20 @@ var schema12 = new MongooseSchema16(
6593
6942
  },
6594
6943
  { timestamps: true }
6595
6944
  );
6596
- schema12.index({ name: 1 });
6597
- schema12.index({ description: 1 });
6598
- schema12.index({ region: 1 });
6599
- schema12.index({ "location.geo": "2dsphere" });
6600
- schema12.index({ tags: 1 });
6601
- schema12.index({ deletedAt: 1 });
6602
- schema12.index({ "dateTime.dateStatus": 1 });
6603
- schema12.index({ slug: 1 });
6604
- var EventModel = import_mongoose16.default.models.Event || import_mongoose16.default.model("Event", schema12);
6945
+ schema13.index({ name: 1 });
6946
+ schema13.index({ description: 1 });
6947
+ schema13.index({ region: 1 });
6948
+ schema13.index({ "location.geo": "2dsphere" });
6949
+ schema13.index({ tags: 1 });
6950
+ schema13.index({ deletedAt: 1 });
6951
+ schema13.index({ "dateTime.dateStatus": 1 });
6952
+ schema13.index({ slug: 1 });
6953
+ var EventModel = import_mongoose17.default.models.Event || import_mongoose17.default.model("Event", schema13);
6605
6954
 
6606
6955
  // src/mongoose/Partner.ts
6607
- var import_mongoose17 = __toESM(require("mongoose"));
6608
- var MongooseSchema17 = import_mongoose17.default.Schema;
6609
- var schema13 = new MongooseSchema17(
6956
+ var import_mongoose18 = __toESM(require("mongoose"));
6957
+ var MongooseSchema18 = import_mongoose18.default.Schema;
6958
+ var schema14 = new MongooseSchema18(
6610
6959
  {
6611
6960
  ...baseResourceFields,
6612
6961
  location: {
@@ -6622,19 +6971,19 @@ var schema13 = new MongooseSchema17(
6622
6971
  },
6623
6972
  { timestamps: true }
6624
6973
  );
6625
- schema13.index({ name: 1 });
6626
- schema13.index({ description: 1 });
6627
- schema13.index({ region: 1 });
6628
- schema13.index({ "location.geo": "2dsphere" });
6629
- schema13.index({ slug: 1 });
6630
- var PartnerModel = import_mongoose17.default.models.Partner || import_mongoose17.default.model("Partner", schema13);
6974
+ schema14.index({ name: 1 });
6975
+ schema14.index({ description: 1 });
6976
+ schema14.index({ region: 1 });
6977
+ schema14.index({ "location.geo": "2dsphere" });
6978
+ schema14.index({ slug: 1 });
6979
+ var PartnerModel = import_mongoose18.default.models.Partner || import_mongoose18.default.model("Partner", schema14);
6631
6980
 
6632
6981
  // src/mongoose/Post.ts
6633
- var import_mongoose18 = __toESM(require("mongoose"));
6634
- var MongooseSchema18 = import_mongoose18.default.Schema;
6635
- var contentSchema = new MongooseSchema18(
6982
+ var import_mongoose19 = __toESM(require("mongoose"));
6983
+ var MongooseSchema19 = import_mongoose19.default.Schema;
6984
+ var contentSchema = new MongooseSchema19(
6636
6985
  {
6637
- contentData: import_mongoose18.Schema.Types.Mixed,
6986
+ contentData: import_mongoose19.Schema.Types.Mixed,
6638
6987
  contentOrder: { required: true, type: Number },
6639
6988
  contentType: {
6640
6989
  enum: Object.values(EnumPostContentType),
@@ -6644,7 +6993,7 @@ var contentSchema = new MongooseSchema18(
6644
6993
  },
6645
6994
  { _id: false }
6646
6995
  );
6647
- var resourceSchema = new MongooseSchema18(
6996
+ var resourceSchema = new MongooseSchema19(
6648
6997
  {
6649
6998
  resourceId: { required: true, type: String },
6650
6999
  resourceRegion: { required: true, type: String },
@@ -6657,7 +7006,7 @@ var resourceSchema = new MongooseSchema18(
6657
7006
  },
6658
7007
  { _id: false }
6659
7008
  );
6660
- var schema14 = new MongooseSchema18(
7009
+ var schema15 = new MongooseSchema19(
6661
7010
  {
6662
7011
  active: { default: false, required: true, type: Boolean },
6663
7012
  approvedAt: { default: null, required: false, type: Date },
@@ -6688,16 +7037,16 @@ var schema14 = new MongooseSchema18(
6688
7037
  },
6689
7038
  { timestamps: true }
6690
7039
  );
6691
- schema14.index({ title: 1 });
6692
- schema14.index({ tags: 1 });
6693
- schema14.index({ postType: 1, slug: 1 }, { unique: true });
6694
- var PostModel = import_mongoose18.default.models.Post || import_mongoose18.default.model("Post", schema14);
7040
+ schema15.index({ title: 1 });
7041
+ schema15.index({ tags: 1 });
7042
+ schema15.index({ postType: 1, slug: 1 }, { unique: true });
7043
+ var PostModel = import_mongoose19.default.models.Post || import_mongoose19.default.model("Post", schema15);
6695
7044
 
6696
7045
  // src/mongoose/AppSetting.ts
6697
- var import_mongoose19 = __toESM(require("mongoose"));
6698
- var MongooseSchema19 = import_mongoose19.default.Schema;
7046
+ var import_mongoose20 = __toESM(require("mongoose"));
7047
+ var MongooseSchema20 = import_mongoose20.default.Schema;
6699
7048
  var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
6700
- var AppSettingSchema = new MongooseSchema19(
7049
+ var AppSettingSchema = new MongooseSchema20(
6701
7050
  {
6702
7051
  activeSchoolsStudentCountTotal: {
6703
7052
  default: 0,
@@ -6728,18 +7077,18 @@ var AppSettingSchema = new MongooseSchema19(
6728
7077
  },
6729
7078
  { timestamps: true }
6730
7079
  );
6731
- var AppSettingModel = import_mongoose19.default.models.AppSetting || import_mongoose19.default.model("AppSetting", AppSettingSchema);
7080
+ var AppSettingModel = import_mongoose20.default.models.AppSetting || import_mongoose20.default.model("AppSetting", AppSettingSchema);
6732
7081
 
6733
7082
  // src/mongoose/game/Game.ts
6734
- var import_mongoose23 = __toESM(require("mongoose"));
7083
+ var import_mongoose24 = __toESM(require("mongoose"));
6735
7084
 
6736
7085
  // src/mongoose/game/DailyClue.ts
6737
- var import_mongoose21 = __toESM(require("mongoose"));
7086
+ var import_mongoose22 = __toESM(require("mongoose"));
6738
7087
 
6739
7088
  // src/mongoose/game/utils.ts
6740
- var import_mongoose20 = __toESM(require("mongoose"));
6741
- var MongooseSchema20 = import_mongoose20.default.Schema;
6742
- var schemaGameDate = new MongooseSchema20(
7089
+ var import_mongoose21 = __toESM(require("mongoose"));
7090
+ var MongooseSchema21 = import_mongoose21.default.Schema;
7091
+ var schemaGameDate = new MongooseSchema21(
6743
7092
  {
6744
7093
  endDate: { required: true, type: Date },
6745
7094
  startDate: { required: true, type: Date }
@@ -6748,8 +7097,8 @@ var schemaGameDate = new MongooseSchema20(
6748
7097
  );
6749
7098
 
6750
7099
  // src/mongoose/game/DailyClue.ts
6751
- var MongooseSchema21 = import_mongoose21.default.Schema;
6752
- var schemaLetters = new MongooseSchema21(
7100
+ var MongooseSchema22 = import_mongoose22.default.Schema;
7101
+ var schemaLetters = new MongooseSchema22(
6753
7102
  {
6754
7103
  collected: { required: false, type: [String] },
6755
7104
  solutionShuffled: { required: true, type: [String] }
@@ -6757,14 +7106,14 @@ var schemaLetters = new MongooseSchema21(
6757
7106
  },
6758
7107
  { _id: false }
6759
7108
  );
6760
- var schemaDailyClueBaseGame = new MongooseSchema21(
7109
+ var schemaDailyClueBaseGame = new MongooseSchema22(
6761
7110
  {
6762
7111
  gameDate: { required: true, type: schemaGameDate },
6763
7112
  gameSolution: { required: true, type: String }
6764
7113
  },
6765
7114
  { _id: false }
6766
7115
  );
6767
- var schemaDailyClueGameData = new MongooseSchema21(
7116
+ var schemaDailyClueGameData = new MongooseSchema22(
6768
7117
  {
6769
7118
  gameFields: { required: true, type: schemaDailyClueBaseGame },
6770
7119
  lastFoundDate: { default: null, required: false, type: Date },
@@ -6779,9 +7128,9 @@ var schemaDailyClueGameData = new MongooseSchema21(
6779
7128
  );
6780
7129
 
6781
7130
  // src/mongoose/game/PuzzleGame.ts
6782
- var import_mongoose22 = __toESM(require("mongoose"));
6783
- var MongooseSchema22 = import_mongoose22.default.Schema;
6784
- var schemaPuzzleAnswer = new MongooseSchema22(
7131
+ var import_mongoose23 = __toESM(require("mongoose"));
7132
+ var MongooseSchema23 = import_mongoose23.default.Schema;
7133
+ var schemaPuzzleAnswer = new MongooseSchema23(
6785
7134
  {
6786
7135
  answer: { required: true, type: String },
6787
7136
  answerId: { required: true, type: String },
@@ -6789,7 +7138,7 @@ var schemaPuzzleAnswer = new MongooseSchema22(
6789
7138
  },
6790
7139
  { _id: false }
6791
7140
  );
6792
- var schemaPuzzleQuestion = new MongooseSchema22(
7141
+ var schemaPuzzleQuestion = new MongooseSchema23(
6793
7142
  {
6794
7143
  answers: { required: true, type: [schemaPuzzleAnswer] },
6795
7144
  question: { required: true, type: String },
@@ -6797,20 +7146,20 @@ var schemaPuzzleQuestion = new MongooseSchema22(
6797
7146
  },
6798
7147
  { _id: false }
6799
7148
  );
6800
- var schemaPuzzleBaseGame = new MongooseSchema22(
7149
+ var schemaPuzzleBaseGame = new MongooseSchema23(
6801
7150
  {
6802
7151
  questions: { required: true, type: [schemaPuzzleQuestion] }
6803
7152
  },
6804
7153
  { _id: false }
6805
7154
  );
6806
- var schemaPuzzleAnsweredQuestion = new MongooseSchema22(
7155
+ var schemaPuzzleAnsweredQuestion = new MongooseSchema23(
6807
7156
  {
6808
7157
  questionId: { required: true, type: String },
6809
7158
  selectedAnswerId: { required: true, type: String }
6810
7159
  },
6811
7160
  { _id: false }
6812
7161
  );
6813
- var schemaPuzzleGameData = new MongooseSchema22(
7162
+ var schemaPuzzleGameData = new MongooseSchema23(
6814
7163
  {
6815
7164
  answeredQuestions: {
6816
7165
  default: null,
@@ -6825,19 +7174,19 @@ var schemaPuzzleGameData = new MongooseSchema22(
6825
7174
  );
6826
7175
 
6827
7176
  // src/mongoose/game/Game.ts
6828
- var MongooseSchema23 = import_mongoose23.default.Schema;
7177
+ var MongooseSchema24 = import_mongoose24.default.Schema;
6829
7178
  var gameDataSchemas = {
6830
7179
  [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
6831
7180
  [EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
6832
7181
  [EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
6833
7182
  };
6834
7183
  var gameDataDefinition = Object.fromEntries(
6835
- Object.entries(gameDataSchemas).map(([key, schema19]) => [
7184
+ Object.entries(gameDataSchemas).map(([key, schema20]) => [
6836
7185
  key,
6837
- { default: null, required: false, type: schema19 }
7186
+ { default: null, required: false, type: schema20 }
6838
7187
  ])
6839
7188
  );
6840
- var gameHistorySchema = new MongooseSchema23(
7189
+ var gameHistorySchema = new MongooseSchema24(
6841
7190
  {
6842
7191
  createdAt: { required: true, type: Date },
6843
7192
  gameDate: { required: true, type: schemaGameDate },
@@ -6857,7 +7206,7 @@ var gameHistorySchema = new MongooseSchema23(
6857
7206
  },
6858
7207
  { _id: false }
6859
7208
  );
6860
- var gameTypeSchema = new MongooseSchema23(
7209
+ var gameTypeSchema = new MongooseSchema24(
6861
7210
  {
6862
7211
  active: { default: true, required: true, type: Boolean },
6863
7212
  gameData: gameDataDefinition,
@@ -6872,7 +7221,7 @@ var gameTypeSchema = new MongooseSchema23(
6872
7221
  },
6873
7222
  { timestamps: true }
6874
7223
  );
6875
- var schema15 = new MongooseSchema23(
7224
+ var schema16 = new MongooseSchema24(
6876
7225
  {
6877
7226
  active: { default: false, required: true, type: Boolean },
6878
7227
  deletedAt: { default: null, required: false, type: Date },
@@ -6885,12 +7234,12 @@ var schema15 = new MongooseSchema23(
6885
7234
  },
6886
7235
  { timestamps: true }
6887
7236
  );
6888
- var GameModel = import_mongoose23.default.models.Game || import_mongoose23.default.model("Game", schema15);
7237
+ var GameModel = import_mongoose24.default.models.Game || import_mongoose24.default.model("Game", schema16);
6889
7238
 
6890
7239
  // src/mongoose/School.ts
6891
- var import_mongoose24 = __toESM(require("mongoose"));
6892
- var MongooseSchema24 = import_mongoose24.default.Schema;
6893
- var campaignsSchema = new MongooseSchema24(
7240
+ var import_mongoose25 = __toESM(require("mongoose"));
7241
+ var MongooseSchema25 = import_mongoose25.default.Schema;
7242
+ var campaignsSchema = new MongooseSchema25(
6894
7243
  {
6895
7244
  endDate: { required: true, type: Date },
6896
7245
  name: { required: true, type: String },
@@ -6898,7 +7247,7 @@ var campaignsSchema = new MongooseSchema24(
6898
7247
  },
6899
7248
  { _id: false }
6900
7249
  );
6901
- var schema16 = new MongooseSchema24(
7250
+ var schema17 = new MongooseSchema25(
6902
7251
  {
6903
7252
  // New schools are active by default
6904
7253
  active: { default: false, required: true, type: Boolean },
@@ -6925,19 +7274,19 @@ var schema16 = new MongooseSchema24(
6925
7274
  },
6926
7275
  { timestamps: true }
6927
7276
  );
6928
- schema16.index(
7277
+ schema17.index(
6929
7278
  { schoolCode: 1 },
6930
7279
  {
6931
7280
  partialFilterExpression: { active: true, deletedAt: null },
6932
7281
  unique: true
6933
7282
  }
6934
7283
  );
6935
- var SchoolModel = import_mongoose24.default.models.School || import_mongoose24.default.model("School", schema16);
7284
+ var SchoolModel = import_mongoose25.default.models.School || import_mongoose25.default.model("School", schema17);
6936
7285
 
6937
7286
  // src/mongoose/Affiliate.ts
6938
- var import_mongoose25 = __toESM(require("mongoose"));
6939
- var MongooseSchema25 = import_mongoose25.default.Schema;
6940
- var affiliateRewardSchema = new MongooseSchema25(
7287
+ var import_mongoose26 = __toESM(require("mongoose"));
7288
+ var MongooseSchema26 = import_mongoose26.default.Schema;
7289
+ var affiliateRewardSchema = new MongooseSchema26(
6941
7290
  {
6942
7291
  createdAt: { required: true, type: Date },
6943
7292
  redeemedAt: { default: null, required: false, type: Date },
@@ -6951,13 +7300,13 @@ var affiliateRewardSchema = new MongooseSchema25(
6951
7300
  },
6952
7301
  { _id: false }
6953
7302
  );
6954
- var affiliateResourceSchema = new MongooseSchema25(
7303
+ var affiliateResourceSchema = new MongooseSchema26(
6955
7304
  {
6956
7305
  resourceActive: { default: true, required: true, type: Boolean },
6957
7306
  resourceDeletedAt: { default: null, required: false, type: Date },
6958
7307
  resourceId: {
6959
7308
  required: true,
6960
- type: import_mongoose25.default.Schema.Types.ObjectId
7309
+ type: import_mongoose26.default.Schema.Types.ObjectId
6961
7310
  },
6962
7311
  resourceName: { required: true, type: String },
6963
7312
  resourceOwner: {
@@ -6977,20 +7326,20 @@ var affiliateResourceSchema = new MongooseSchema25(
6977
7326
  },
6978
7327
  { _id: false }
6979
7328
  );
6980
- var affiliateContactDetailsSchema = new MongooseSchema25(
7329
+ var affiliateContactDetailsSchema = new MongooseSchema26(
6981
7330
  {
6982
7331
  mobilePhone: { required: true, type: String }
6983
7332
  },
6984
7333
  { _id: false }
6985
7334
  );
6986
- var affiliateBankAccountDetailsSchema = new MongooseSchema25(
7335
+ var affiliateBankAccountDetailsSchema = new MongooseSchema26(
6987
7336
  {
6988
7337
  accountHolderName: { required: true, type: String },
6989
7338
  accountNumber: { required: true, type: String }
6990
7339
  },
6991
7340
  { _id: false }
6992
7341
  );
6993
- var affiliateDetailsSchema = new MongooseSchema25(
7342
+ var affiliateDetailsSchema = new MongooseSchema26(
6994
7343
  {
6995
7344
  bankAccountDetails: {
6996
7345
  required: true,
@@ -7012,7 +7361,7 @@ var affiliateDetailsSchema = new MongooseSchema25(
7012
7361
  },
7013
7362
  { _id: false }
7014
7363
  );
7015
- var redeemHistorySchema = new MongooseSchema25(
7364
+ var redeemHistorySchema = new MongooseSchema26(
7016
7365
  {
7017
7366
  paidAt: { default: null, required: false, type: Date },
7018
7367
  redeemedAt: { required: true, type: Date },
@@ -7020,7 +7369,7 @@ var redeemHistorySchema = new MongooseSchema25(
7020
7369
  },
7021
7370
  { _id: false }
7022
7371
  );
7023
- var schema17 = new MongooseSchema25(
7372
+ var schema18 = new MongooseSchema26(
7024
7373
  {
7025
7374
  active: { default: false, required: true, type: Boolean },
7026
7375
  affiliateBonusRewards: {
@@ -7050,19 +7399,19 @@ var schema17 = new MongooseSchema25(
7050
7399
  },
7051
7400
  { timestamps: true }
7052
7401
  );
7053
- schema17.index(
7402
+ schema18.index(
7054
7403
  { affiliateCode: 1 },
7055
7404
  {
7056
7405
  partialFilterExpression: { active: true, deletedAt: null },
7057
7406
  unique: true
7058
7407
  }
7059
7408
  );
7060
- var AffiliateModel = import_mongoose25.default.models.Affiliate || import_mongoose25.default.model("Affiliate", schema17);
7409
+ var AffiliateModel = import_mongoose26.default.models.Affiliate || import_mongoose26.default.model("Affiliate", schema18);
7061
7410
 
7062
7411
  // src/mongoose/Coupon.ts
7063
- var import_mongoose26 = __toESM(require("mongoose"));
7064
- var MongooseSchema26 = import_mongoose26.default.Schema;
7065
- var couponOptionSchema = new MongooseSchema26(
7412
+ var import_mongoose27 = __toESM(require("mongoose"));
7413
+ var MongooseSchema27 = import_mongoose27.default.Schema;
7414
+ var couponOptionSchema = new MongooseSchema27(
7066
7415
  {
7067
7416
  buy: { required: false, type: Number },
7068
7417
  get: { required: false, type: Number },
@@ -7077,29 +7426,29 @@ var couponOptionSchema = new MongooseSchema26(
7077
7426
  },
7078
7427
  { _id: false }
7079
7428
  );
7080
- var couponVendorProductSchema = new MongooseSchema26(
7429
+ var couponVendorProductSchema = new MongooseSchema27(
7081
7430
  {
7082
7431
  couponId: {
7083
7432
  required: true,
7084
- type: import_mongoose26.default.Schema.Types.ObjectId
7433
+ type: import_mongoose27.default.Schema.Types.ObjectId
7085
7434
  },
7086
7435
  productId: {
7087
7436
  required: true,
7088
- type: import_mongoose26.default.Schema.Types.ObjectId
7437
+ type: import_mongoose27.default.Schema.Types.ObjectId
7089
7438
  },
7090
7439
  vendorCouponId: {
7091
7440
  required: false,
7092
- type: import_mongoose26.default.Schema.Types.ObjectId
7441
+ type: import_mongoose27.default.Schema.Types.ObjectId
7093
7442
  },
7094
7443
  vendorId: {
7095
7444
  ref: "Vendor",
7096
7445
  required: true,
7097
- type: import_mongoose26.default.Schema.Types.ObjectId
7446
+ type: import_mongoose27.default.Schema.Types.ObjectId
7098
7447
  }
7099
7448
  },
7100
7449
  { _id: false }
7101
7450
  );
7102
- var couponCodeSchema = new MongooseSchema26(
7451
+ var couponCodeSchema = new MongooseSchema27(
7103
7452
  {
7104
7453
  code: { required: true, type: String },
7105
7454
  qrCode: { required: true, type: ResourceImageTypeSchema },
@@ -7107,7 +7456,7 @@ var couponCodeSchema = new MongooseSchema26(
7107
7456
  },
7108
7457
  { _id: false }
7109
7458
  );
7110
- var couponParticipantUserSchema = new MongooseSchema26(
7459
+ var couponParticipantUserSchema = new MongooseSchema27(
7111
7460
  {
7112
7461
  couponCollectedCount: { default: 0, required: true, type: Number },
7113
7462
  couponCycleRedeemed: { default: false, required: true, type: Boolean },
@@ -7116,12 +7465,12 @@ var couponParticipantUserSchema = new MongooseSchema26(
7116
7465
  userId: {
7117
7466
  ref: "User",
7118
7467
  required: true,
7119
- type: import_mongoose26.default.Schema.Types.ObjectId
7468
+ type: import_mongoose27.default.Schema.Types.ObjectId
7120
7469
  }
7121
7470
  },
7122
7471
  { timestamps: true }
7123
7472
  );
7124
- var couponDataSchema = new MongooseSchema26(
7473
+ var couponDataSchema = new MongooseSchema27(
7125
7474
  {
7126
7475
  active: { default: true, required: true, type: Boolean },
7127
7476
  couponCode: { required: false, type: couponCodeSchema },
@@ -7148,7 +7497,7 @@ var couponDataSchema = new MongooseSchema26(
7148
7497
  },
7149
7498
  { timestamps: true }
7150
7499
  );
7151
- var schema18 = new MongooseSchema26(
7500
+ var schema19 = new MongooseSchema27(
7152
7501
  {
7153
7502
  active: { default: true, required: true, type: Boolean },
7154
7503
  couponData: { default: [], required: false, type: [couponDataSchema] },
@@ -7160,7 +7509,7 @@ var schema18 = new MongooseSchema26(
7160
7509
  },
7161
7510
  { timestamps: true }
7162
7511
  );
7163
- var CouponModel = import_mongoose26.default.models.Coupon || import_mongoose26.default.model("Coupon", schema18);
7512
+ var CouponModel = import_mongoose27.default.models.Coupon || import_mongoose27.default.model("Coupon", schema19);
7164
7513
 
7165
7514
  // src/service/promoCode/constants.ts
7166
7515
  var ACTIVE_NOT_DELETED_FILTER = {
@@ -7177,7 +7526,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
7177
7526
  return existing !== null;
7178
7527
  }
7179
7528
 
7180
- // node_modules/@timardex/cluemart-shared/dist/chunk-2UNNIQIK.mjs
7529
+ // node_modules/@timardex/cluemart-shared/dist/chunk-YRO6KEZG.mjs
7181
7530
  var import_dayjs3 = __toESM(require("dayjs"), 1);
7182
7531
  var import_customParseFormat2 = __toESM(require("dayjs/plugin/customParseFormat.js"), 1);
7183
7532
  var import_isSameOrAfter2 = __toESM(require("dayjs/plugin/isSameOrAfter.js"), 1);
@@ -7250,7 +7599,7 @@ var SHARE_RESOURCE_LABEL2 = {
7250
7599
  school: "School"
7251
7600
  };
7252
7601
 
7253
- // node_modules/@timardex/cluemart-shared/dist/chunk-364EX22V.mjs
7602
+ // node_modules/@timardex/cluemart-shared/dist/chunk-STNE7PMX.mjs
7254
7603
  var PROMO_CODE_PREFIX2 = "CM-";
7255
7604
  var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
7256
7605
  var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
@@ -7362,7 +7711,7 @@ var gameScreenIdentifierList2 = [
7362
7711
  }
7363
7712
  ];
7364
7713
 
7365
- // node_modules/@timardex/cluemart-shared/dist/chunk-RCARDOVS.mjs
7714
+ // node_modules/@timardex/cluemart-shared/dist/chunk-3ZPHXVUT.mjs
7366
7715
  var import_dayjs4 = __toESM(require("dayjs"), 1);
7367
7716
  var statusOptions2 = [
7368
7717
  ...Object.values(EnumInviteStatus2).map((status) => ({
@@ -8799,7 +9148,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
8799
9148
  }
8800
9149
 
8801
9150
  // src/service/database.ts
8802
- var import_mongoose30 = __toESM(require("mongoose"));
9151
+ var import_mongoose31 = __toESM(require("mongoose"));
8803
9152
  var connectToDatabase = async ({
8804
9153
  appName,
8805
9154
  dbName,
@@ -8812,7 +9161,7 @@ var connectToDatabase = async ({
8812
9161
  // Fallback to MongoDB Atlas connection string
8813
9162
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
8814
9163
  );
8815
- await import_mongoose30.default.connect(mongoUri);
9164
+ await import_mongoose31.default.connect(mongoUri);
8816
9165
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
8817
9166
  console.log(
8818
9167
  `${connectionType} connected from server/src/service/database.ts`
@@ -8825,7 +9174,7 @@ var connectToDatabase = async ({
8825
9174
 
8826
9175
  // src/types/index.ts
8827
9176
  var import_express = __toESM(require("express"));
8828
- var import_mongoose31 = __toESM(require("mongoose"));
9177
+ var import_mongoose32 = __toESM(require("mongoose"));
8829
9178
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
8830
9179
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
8831
9180
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -8915,15 +9264,15 @@ async function updateAdStatuses() {
8915
9264
  }
8916
9265
 
8917
9266
  // src/service/objectIdToString.ts
8918
- var import_mongoose33 = __toESM(require("mongoose"));
9267
+ var import_mongoose34 = __toESM(require("mongoose"));
8919
9268
  function isValidObjectId(value) {
8920
- return import_mongoose33.default.Types.ObjectId.isValid(value);
9269
+ return import_mongoose34.default.Types.ObjectId.isValid(value);
8921
9270
  }
8922
9271
  function convertObjectIdsToStrings(obj) {
8923
9272
  if (obj === null || obj === void 0) {
8924
9273
  return obj;
8925
9274
  }
8926
- if (obj instanceof import_mongoose33.default.Types.ObjectId) {
9275
+ if (obj instanceof import_mongoose34.default.Types.ObjectId) {
8927
9276
  return obj.toString();
8928
9277
  }
8929
9278
  if (obj instanceof Date) {
@@ -9478,20 +9827,24 @@ var buildLicenceReplacePipeline = ({
9478
9827
  async function replaceUserLicenceWithObject({
9479
9828
  userId,
9480
9829
  licenceObject,
9481
- protectHigherLicence = true
9830
+ protectHigherLicence = true,
9831
+ refreshExistingLicence = false
9482
9832
  }) {
9483
9833
  const user = await UserModel.findById(userId, { licences: 1 }).lean();
9484
9834
  if (!user) throw new import_graphql3.GraphQLError("User not found");
9485
- if (user.licences?.some((l) => l.licenceType === licenceObject.licenceType)) {
9835
+ const existingLicence = user.licences?.find(
9836
+ (licence) => licence.licenceType === licenceObject.licenceType
9837
+ );
9838
+ if (existingLicence && !refreshExistingLicence) {
9486
9839
  return;
9487
9840
  }
9841
+ const category = getLicenceCategory(licenceObject.licenceType);
9488
9842
  const updatedLicenceObject = {
9489
9843
  ...licenceObject,
9490
- prevLicenceType: user.licences?.find(
9491
- (l) => getLicenceCategory(l.licenceType) === getLicenceCategory(licenceObject.licenceType)
9844
+ prevLicenceType: existingLicence && refreshExistingLicence ? existingLicence.prevLicenceType : user.licences?.find(
9845
+ (licence) => licence.licenceType && getLicenceCategory(licence.licenceType) === category
9492
9846
  )?.licenceType
9493
9847
  };
9494
- const category = getLicenceCategory(updatedLicenceObject.licenceType);
9495
9848
  if (protectHigherLicence) {
9496
9849
  const highestLicence = getHighestLicenceForCategory(
9497
9850
  user.licences,
@@ -9605,6 +9958,17 @@ var vendorLicences = [
9605
9958
  EnumUserLicence.PRO_VENDOR,
9606
9959
  EnumUserLicence.PRO_PLUS_VENDOR
9607
9960
  ];
9961
+ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
9962
+ const stripe = user.stripe;
9963
+ if (!stripe?.subscriptionId || stripe.currentPlan !== licenceType || stripe.status !== EnumSubscriptionStatus.ACTIVE && stripe.status !== EnumSubscriptionStatus.TRIALING) {
9964
+ return false;
9965
+ }
9966
+ if (stripe.cancelAtPeriodEnd !== true || !stripe.endDate) {
9967
+ return true;
9968
+ }
9969
+ const paidThrough = (0, import_dayjs8.default)(stripe.endDate);
9970
+ return !paidThrough.isValid() || paidThrough.isAfter(now);
9971
+ }
9608
9972
  async function handleVendorLicenceCompliance(user, now) {
9609
9973
  if (!user.licences || !user.vendor) {
9610
9974
  return;
@@ -9618,12 +9982,20 @@ async function handleVendorLicenceCompliance(user, now) {
9618
9982
  const proLicences = vendorLicencesOfUser.filter(
9619
9983
  (licence) => licence.licenceType !== EnumUserLicence.STANDARD_VENDOR
9620
9984
  );
9621
- const expiredProLicence = proLicences.some(
9985
+ const expiredProLicences = proLicences.filter(
9622
9986
  (licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now)
9623
9987
  );
9624
- const hasValidProLicence = hasValidLicence(proLicences, vendorLicences, now);
9988
+ const stripeProtectedLicenceTypes = new Set(
9989
+ expiredProLicences.filter(
9990
+ (licence) => isProtectedByCurrentStripeSubscription(user, licence.licenceType, now)
9991
+ ).map((licence) => licence.licenceType)
9992
+ );
9993
+ const expiredProLicence = expiredProLicences.some(
9994
+ (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
9995
+ );
9996
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
9625
9997
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
9626
- (licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now)
9998
+ (licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
9627
9999
  );
9628
10000
  if (!hasExpiredVendorLicence) {
9629
10001
  return;
@@ -9637,7 +10009,10 @@ async function handleVendorLicenceCompliance(user, now) {
9637
10009
  "owner.userId": user._id
9638
10010
  }).lean().exec();
9639
10011
  }
9640
- await syncUserLicencesAfterExpiry(user._id, vendorLicences, now, "downgrade");
10012
+ const licencesToSync = vendorLicences.filter(
10013
+ (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
10014
+ );
10015
+ await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
9641
10016
  if (!expiredProLicence || !vendor || hasValidProLicence) {
9642
10017
  return;
9643
10018
  }
@@ -9726,6 +10101,13 @@ async function processUserCompliance(user, now) {
9726
10101
  }
9727
10102
 
9728
10103
  // src/service/license/compliance/ensureUserLicenseCompliance.ts
10104
+ async function ensureUserLicenseComplianceForUser(userId, now = (0, import_dayjs10.default)()) {
10105
+ const user = await UserModel.findById(userId);
10106
+ if (!user) {
10107
+ return;
10108
+ }
10109
+ await processUserCompliance(user, now);
10110
+ }
9729
10111
  async function ensureUserLicenseCompliance() {
9730
10112
  const now = (0, import_dayjs10.default)();
9731
10113
  console.log(`\u{1F50D} Checking license compliance at ${now.format()}`);
@@ -9977,7 +10359,7 @@ async function sendLicenseReminder(user, licence) {
9977
10359
  await sendPushNotifications(payload);
9978
10360
  console.log(`\u2705 Sent 7-day reminder to user ${userId} for ${licenceName}`);
9979
10361
  }
9980
- async function processLicenseReminder(user, licence, now) {
10362
+ async function processLicenseReminder(licence, now) {
9981
10363
  if ((0, import_dayjs11.default)(licence.expiryDate).isBefore(now)) {
9982
10364
  return false;
9983
10365
  }
@@ -10009,7 +10391,7 @@ async function processUserLicenseReminders(user, now) {
10009
10391
  const licenceChecks = await Promise.all(
10010
10392
  validLicences.map(async (licence) => {
10011
10393
  try {
10012
- const shouldSend = await processLicenseReminder(user, licence, now);
10394
+ const shouldSend = await processLicenseReminder(licence, now);
10013
10395
  return { licence, shouldSend };
10014
10396
  } catch (err) {
10015
10397
  console.error(
@@ -10076,6 +10458,8 @@ async function remindUsersAboutLicenseExpiration() {
10076
10458
  AdModel,
10077
10459
  AffiliateModel,
10078
10460
  AppSettingModel,
10461
+ BILLING_CATALOG_COLLECTION_NAME,
10462
+ BillingCatalogModel,
10079
10463
  CategorySchema,
10080
10464
  ChatModel,
10081
10465
  ChatReportModel,
@@ -10111,6 +10495,7 @@ async function remindUsersAboutLicenseExpiration() {
10111
10495
  activeAffiliateCodeExists,
10112
10496
  awardAffiliateVendorSubscriptionRewards,
10113
10497
  baseResourceFields,
10498
+ buildInitialBillingCatalogEntries,
10114
10499
  buildLicenceExpiryPipeline,
10115
10500
  checkOwnerHasLicence,
10116
10501
  connectToDatabase,
@@ -10119,10 +10504,12 @@ async function remindUsersAboutLicenseExpiration() {
10119
10504
  dateTimeSchema,
10120
10505
  didRemoveAnyEventDates,
10121
10506
  ensureUserLicenseCompliance,
10507
+ ensureUserLicenseComplianceForUser,
10122
10508
  eventLicences,
10123
10509
  express,
10124
10510
  findAffiliateByPromoCode,
10125
10511
  findEventOrImportedMarketById,
10512
+ getBillingCatalogDefinition,
10126
10513
  getEventResourceInfo,
10127
10514
  getHighestLicenceForCategory,
10128
10515
  getLicenceCategory,