@timardex/cluemart-server-shared 1.1.37 → 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`
@@ -2559,6 +2651,14 @@ var GET_EVENT = gql`
2559
2651
  }
2560
2652
  ${EVENT}
2561
2653
  `;
2654
+ var GET_OWNED_EVENT = gql`
2655
+ query getOwnedEvent($_id: ID!) {
2656
+ ownedEvent(_id: $_id) {
2657
+ ...EventFields
2658
+ }
2659
+ }
2660
+ ${EVENT}
2661
+ `;
2562
2662
  var GET_EVENT_BY_PLACE_ID = gql`
2563
2663
  query getEventByPlaceId($googlePlaceId: String!) {
2564
2664
  eventByPlaceId(googlePlaceId: $googlePlaceId) {
@@ -4293,11 +4393,8 @@ var GET_RESOURCE_ACTIVITY = gql`
4293
4393
  ${RESOURCE_ACTIVITY_FIELDS_FRAGMENT}
4294
4394
  `;
4295
4395
  var CREATE_CHECKOUT_SESSION_MUTATION = gql`
4296
- mutation createCheckoutSession(
4297
- $planId: LicencesEnumType!
4298
- $billingPeriod: BillingPeriodEnumType
4299
- ) {
4300
- createCheckoutSession(planId: $planId, billingPeriod: $billingPeriod) {
4396
+ mutation createCheckoutSession($input: CreateCheckoutSessionInputType!) {
4397
+ createCheckoutSession(input: $input) {
4301
4398
  data {
4302
4399
  sessionId
4303
4400
  checkoutUrl
@@ -4309,25 +4406,38 @@ var CREATE_CHECKOUT_SESSION_MUTATION = gql`
4309
4406
  var CANCEL_SUBSCRIPTION_MUTATION = gql`
4310
4407
  mutation cancelSubscription {
4311
4408
  cancelSubscription {
4312
- 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
+ }
4313
4422
  message
4314
4423
  }
4315
4424
  }
4316
4425
  `;
4317
4426
  var UPDATE_SUBSCRIPTION_PLAN_MUTATION = gql`
4318
- mutation updateSubscriptionPlan(
4319
- $newPlanId: LicencesEnumType!
4320
- $billingPeriod: BillingPeriodEnumType
4321
- ) {
4322
- updateSubscriptionPlan(
4323
- newPlanId: $newPlanId
4324
- billingPeriod: $billingPeriod
4325
- ) {
4427
+ mutation updateSubscriptionPlan($input: UpdateSubscriptionPlanInputType!) {
4428
+ updateSubscriptionPlan(input: $input) {
4326
4429
  data {
4327
- subscriptionId
4328
- status
4329
- priceId
4430
+ billingPeriod
4431
+ cancelAtPeriodEnd
4330
4432
  currentPlan
4433
+ endDate
4434
+ pendingBillingPeriod
4435
+ pendingChangeEffectiveAt
4436
+ pendingPlan
4437
+ priceId
4438
+ scheduleId
4439
+ status
4440
+ subscriptionId
4331
4441
  }
4332
4442
  message
4333
4443
  }
@@ -4343,36 +4453,20 @@ var CREATE_CUSTOMER_PORTAL = gql`
4343
4453
  }
4344
4454
  }
4345
4455
  `;
4346
- var SELECT_PACKAGE_MUTATION = gql`
4347
- mutation selectPackage(
4348
- $billingPeriod: BillingPeriodEnumType
4349
- $selectedLicence: LicencesEnumType!
4350
- $useStripe: Boolean
4351
- ) {
4352
- selectPackage(
4353
- billingPeriod: $billingPeriod
4354
- selectedLicence: $selectedLicence
4355
- useStripe: $useStripe
4356
- ) {
4357
- data {
4358
- checkoutUrl
4359
- licences {
4360
- ...LicenceFields
4361
- }
4362
- userId
4363
- }
4364
- message
4365
- }
4366
- }
4367
- ${LICENCE_FIELDS_FRAGMENT}
4368
- `;
4369
4456
  var GET_SUBSCRIPTION_STATUS = gql`
4370
4457
  query getSubscriptionStatus {
4371
4458
  getSubscriptionStatus {
4372
- subscriptionId
4373
- status
4374
- priceId
4459
+ billingPeriod
4460
+ cancelAtPeriodEnd
4375
4461
  currentPlan
4462
+ endDate
4463
+ pendingBillingPeriod
4464
+ pendingChangeEffectiveAt
4465
+ pendingPlan
4466
+ priceId
4467
+ scheduleId
4468
+ status
4469
+ subscriptionId
4376
4470
  }
4377
4471
  }
4378
4472
  `;
@@ -4399,7 +4493,6 @@ var GET_SUBSCRIPTION_PLANS = gql`
4399
4493
  }
4400
4494
  }
4401
4495
  isNewUser
4402
- isTester
4403
4496
  appliedDiscountType
4404
4497
  }
4405
4498
  }
@@ -4507,6 +4600,57 @@ var GET_APP_SETTINGS = gql`
4507
4600
  }
4508
4601
  ${APP_SETTINGS_FIELDS_FRAGMENT}
4509
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
+ `;
4510
4654
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
4511
4655
  fragment GameHistoryFields on GameHistoryType {
4512
4656
  createdAt
@@ -5345,46 +5489,220 @@ schema.index({
5345
5489
  start: 1,
5346
5490
  status: 1
5347
5491
  });
5492
+ schema.index({
5493
+ status: 1,
5494
+ targetRegion: 1,
5495
+ // eslint-disable-next-line sort-keys
5496
+ start: -1
5497
+ });
5348
5498
  var AdModel = import_mongoose.default.models.Ad || import_mongoose.default.model("Ad", schema);
5349
5499
 
5350
- // src/mongoose/chat/Chat.ts
5500
+ // src/mongoose/BillingCatalog.ts
5351
5501
  var import_mongoose2 = __toESM(require("mongoose"));
5352
5502
  var MongooseSchema2 = import_mongoose2.default.Schema;
5353
- 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(
5354
5672
  {
5355
5673
  contentPreview: { required: true, type: String },
5356
5674
  senderId: {
5357
5675
  ref: "User",
5358
5676
  required: true,
5359
- type: import_mongoose2.default.Schema.Types.ObjectId
5677
+ type: import_mongoose3.default.Schema.Types.ObjectId
5360
5678
  },
5361
5679
  senderName: { required: true, type: String }
5362
5680
  },
5363
5681
  { _id: false }
5364
5682
  );
5365
- var MessageReactionSchema = new MongooseSchema2(
5683
+ var MessageReactionSchema = new MongooseSchema3(
5366
5684
  {
5367
5685
  createdAt: { required: true, type: Date },
5368
5686
  userId: {
5369
5687
  ref: "User",
5370
5688
  required: true,
5371
- type: import_mongoose2.default.Schema.Types.ObjectId
5689
+ type: import_mongoose3.default.Schema.Types.ObjectId
5372
5690
  }
5373
5691
  },
5374
5692
  { _id: false }
5375
5693
  );
5376
- var MessageSeenSchema = new MongooseSchema2(
5694
+ var MessageSeenSchema = new MongooseSchema3(
5377
5695
  {
5378
5696
  seenAt: { required: true, type: Date },
5379
5697
  userId: {
5380
5698
  ref: "User",
5381
5699
  required: true,
5382
- type: import_mongoose2.default.Schema.Types.ObjectId
5700
+ type: import_mongoose3.default.Schema.Types.ObjectId
5383
5701
  }
5384
5702
  },
5385
5703
  { _id: false }
5386
5704
  );
5387
- var MessageSchema = new MongooseSchema2(
5705
+ var MessageSchema = new MongooseSchema3(
5388
5706
  {
5389
5707
  content: { required: true, type: String },
5390
5708
  likedBy: { default: [], required: false, type: [MessageReactionSchema] },
@@ -5395,18 +5713,18 @@ var MessageSchema = new MongooseSchema2(
5395
5713
  replyToMessageId: {
5396
5714
  ref: "Chat.messages",
5397
5715
  required: false,
5398
- type: import_mongoose2.default.Schema.Types.ObjectId
5716
+ type: import_mongoose3.default.Schema.Types.ObjectId
5399
5717
  },
5400
5718
  seenBy: { default: [], required: false, type: [MessageSeenSchema] },
5401
5719
  senderId: {
5402
5720
  ref: "User",
5403
5721
  required: true,
5404
- type: import_mongoose2.default.Schema.Types.ObjectId
5722
+ type: import_mongoose3.default.Schema.Types.ObjectId
5405
5723
  }
5406
5724
  },
5407
5725
  { timestamps: true }
5408
5726
  );
5409
- var ParticipantSchema = new MongooseSchema2(
5727
+ var ParticipantSchema = new MongooseSchema3(
5410
5728
  {
5411
5729
  active: { default: true, required: true, type: Boolean },
5412
5730
  userAvatar: { required: false, type: String },
@@ -5414,14 +5732,14 @@ var ParticipantSchema = new MongooseSchema2(
5414
5732
  userId: {
5415
5733
  ref: "User",
5416
5734
  required: true,
5417
- type: import_mongoose2.default.Schema.Types.ObjectId
5735
+ type: import_mongoose3.default.Schema.Types.ObjectId
5418
5736
  },
5419
5737
  userName: { required: true, type: String }
5420
5738
  },
5421
5739
  { _id: false }
5422
5740
  // Prevents Mongoose from creating an additional _id field for subdocuments
5423
5741
  );
5424
- var ChatSchema = new MongooseSchema2(
5742
+ var ChatSchema = new MongooseSchema3(
5425
5743
  {
5426
5744
  active: { default: true, required: true, type: Boolean },
5427
5745
  chatDescription: { required: false, type: String },
@@ -5445,12 +5763,12 @@ ChatSchema.index({
5445
5763
  "participants.userId": 1,
5446
5764
  updatedAt: -1
5447
5765
  });
5448
- 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);
5449
5767
 
5450
5768
  // src/mongoose/chat/ChatReport.ts
5451
- var import_mongoose3 = __toESM(require("mongoose"));
5452
- var MongooseSchema3 = import_mongoose3.default.Schema;
5453
- var ReasonSchema = new MongooseSchema3(
5769
+ var import_mongoose4 = __toESM(require("mongoose"));
5770
+ var MongooseSchema4 = import_mongoose4.default.Schema;
5771
+ var ReasonSchema = new MongooseSchema4(
5454
5772
  {
5455
5773
  details: { default: null, required: false, type: String },
5456
5774
  reasonType: {
@@ -5461,23 +5779,23 @@ var ReasonSchema = new MongooseSchema3(
5461
5779
  },
5462
5780
  { _id: false }
5463
5781
  );
5464
- var ChatReportSchema = new MongooseSchema3(
5782
+ var ChatReportSchema = new MongooseSchema4(
5465
5783
  {
5466
5784
  chatId: {
5467
5785
  ref: "Chat",
5468
5786
  required: true,
5469
- type: import_mongoose3.default.Schema.Types.ObjectId
5787
+ type: import_mongoose4.default.Schema.Types.ObjectId
5470
5788
  },
5471
5789
  reason: { required: true, type: ReasonSchema },
5472
5790
  reportedUserId: {
5473
5791
  ref: "User",
5474
5792
  required: true,
5475
- type: import_mongoose3.default.Schema.Types.ObjectId
5793
+ type: import_mongoose4.default.Schema.Types.ObjectId
5476
5794
  },
5477
5795
  reporterUserId: {
5478
5796
  ref: "User",
5479
5797
  required: true,
5480
- type: import_mongoose3.default.Schema.Types.ObjectId
5798
+ type: import_mongoose4.default.Schema.Types.ObjectId
5481
5799
  },
5482
5800
  resolved: { default: false, required: true, type: Boolean }
5483
5801
  },
@@ -5485,18 +5803,18 @@ var ChatReportSchema = new MongooseSchema3(
5485
5803
  );
5486
5804
  ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
5487
5805
  ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
5488
- 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);
5489
5807
 
5490
5808
  // src/mongoose/global.ts
5491
- var import_mongoose6 = __toESM(require("mongoose"));
5809
+ var import_mongoose7 = __toESM(require("mongoose"));
5492
5810
 
5493
5811
  // src/mongoose/Relation.ts
5494
- var import_mongoose5 = __toESM(require("mongoose"));
5812
+ var import_mongoose6 = __toESM(require("mongoose"));
5495
5813
 
5496
5814
  // src/mongoose/event/EventInfo.ts
5497
- var import_mongoose4 = __toESM(require("mongoose"));
5498
- var MongooseSchema4 = import_mongoose4.default.Schema;
5499
- var StallTypeSchema = new MongooseSchema4(
5815
+ var import_mongoose5 = __toESM(require("mongoose"));
5816
+ var MongooseSchema5 = import_mongoose5.default.Schema;
5817
+ var StallTypeSchema = new MongooseSchema5(
5500
5818
  {
5501
5819
  label: { required: false, type: String },
5502
5820
  price: { required: false, type: Number },
@@ -5507,7 +5825,7 @@ var StallTypeSchema = new MongooseSchema4(
5507
5825
  // Prevents Mongoose from creating an additional _id field for subdocuments
5508
5826
  }
5509
5827
  );
5510
- var dateTimeSchema = new MongooseSchema4(
5828
+ var dateTimeSchema = new MongooseSchema5(
5511
5829
  {
5512
5830
  dateStatus: {
5513
5831
  enum: Object.values(EnumEventDateStatus),
@@ -5523,7 +5841,7 @@ var dateTimeSchema = new MongooseSchema4(
5523
5841
  { _id: false }
5524
5842
  // Prevents Mongoose from creating an additional _id field for subdocuments
5525
5843
  );
5526
- var paymentInfoSchema = new MongooseSchema4(
5844
+ var paymentInfoSchema = new MongooseSchema5(
5527
5845
  {
5528
5846
  accountHolderName: { required: false, type: String },
5529
5847
  accountNumber: { required: false, type: String },
@@ -5537,7 +5855,7 @@ var paymentInfoSchema = new MongooseSchema4(
5537
5855
  { _id: false }
5538
5856
  // Prevents Mongoose from creating an additional _id field
5539
5857
  );
5540
- var requirementsSchema = new MongooseSchema4(
5858
+ var requirementsSchema = new MongooseSchema5(
5541
5859
  {
5542
5860
  category: { required: true, type: String },
5543
5861
  label: { required: true, type: String },
@@ -5548,7 +5866,7 @@ var requirementsSchema = new MongooseSchema4(
5548
5866
  // Prevents Mongoose from creating an additional _id field for
5549
5867
  }
5550
5868
  );
5551
- var refundPolicySchema = new MongooseSchema4(
5869
+ var refundPolicySchema = new MongooseSchema5(
5552
5870
  {
5553
5871
  category: { required: true, type: String },
5554
5872
  label: { required: true, type: String },
@@ -5556,7 +5874,7 @@ var refundPolicySchema = new MongooseSchema4(
5556
5874
  },
5557
5875
  { _id: false }
5558
5876
  );
5559
- var schema2 = new MongooseSchema4(
5877
+ var schema3 = new MongooseSchema5(
5560
5878
  {
5561
5879
  active: { default: true, type: Boolean },
5562
5880
  applicationDeadlineHours: { required: true, type: Number },
@@ -5564,7 +5882,7 @@ var schema2 = new MongooseSchema4(
5564
5882
  eventId: {
5565
5883
  ref: "Event",
5566
5884
  required: true,
5567
- type: import_mongoose4.default.Schema.Types.ObjectId
5885
+ type: import_mongoose5.default.Schema.Types.ObjectId
5568
5886
  },
5569
5887
  packInTime: { required: true, type: Number },
5570
5888
  paymentDueHours: { required: true, type: Number },
@@ -5574,11 +5892,11 @@ var schema2 = new MongooseSchema4(
5574
5892
  },
5575
5893
  { timestamps: true }
5576
5894
  );
5577
- 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);
5578
5896
 
5579
5897
  // src/mongoose/Relation.ts
5580
- var MongooseSchema5 = import_mongoose5.default.Schema;
5581
- var relationDateTimeSchema = new MongooseSchema5(
5898
+ var MongooseSchema6 = import_mongoose6.default.Schema;
5899
+ var relationDateTimeSchema = new MongooseSchema6(
5582
5900
  {
5583
5901
  dateStatus: {
5584
5902
  enum: Object.values(EnumEventDateStatus),
@@ -5593,7 +5911,7 @@ var relationDateTimeSchema = new MongooseSchema5(
5593
5911
  },
5594
5912
  { _id: false }
5595
5913
  );
5596
- var relationDatesSchema = new MongooseSchema5(
5914
+ var relationDatesSchema = new MongooseSchema6(
5597
5915
  {
5598
5916
  dateTime: {
5599
5917
  required: true,
@@ -5612,19 +5930,19 @@ var relationDatesSchema = new MongooseSchema5(
5612
5930
  },
5613
5931
  { _id: false }
5614
5932
  );
5615
- var RelationTypeSchema = new MongooseSchema5(
5933
+ var RelationTypeSchema = new MongooseSchema6(
5616
5934
  {
5617
5935
  active: { default: true, required: true, type: Boolean },
5618
5936
  chatId: {
5619
5937
  ref: "Chat",
5620
5938
  required: true,
5621
- type: import_mongoose5.default.Schema.Types.ObjectId
5939
+ type: import_mongoose6.default.Schema.Types.ObjectId
5622
5940
  },
5623
5941
  deletedAt: { default: null, required: false, type: Date },
5624
5942
  eventId: {
5625
5943
  ref: "Event",
5626
5944
  required: true,
5627
- type: import_mongoose5.default.Schema.Types.ObjectId
5945
+ type: import_mongoose6.default.Schema.Types.ObjectId
5628
5946
  },
5629
5947
  lastUpdateBy: {
5630
5948
  enum: Object.values(EnumResourceType),
@@ -5640,7 +5958,7 @@ var RelationTypeSchema = new MongooseSchema5(
5640
5958
  vendorId: {
5641
5959
  ref: "Vendor",
5642
5960
  required: true,
5643
- type: import_mongoose5.default.Schema.Types.ObjectId
5961
+ type: import_mongoose6.default.Schema.Types.ObjectId
5644
5962
  }
5645
5963
  },
5646
5964
  { timestamps: true }
@@ -5652,23 +5970,23 @@ RelationTypeSchema.index({
5652
5970
  "relationDates.status": 1,
5653
5971
  vendorId: 1
5654
5972
  });
5655
- 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);
5656
5974
 
5657
5975
  // src/mongoose/global.ts
5658
- var MongooseSchema6 = import_mongoose6.default.Schema;
5659
- var OwnerTypeSchema = new MongooseSchema6(
5976
+ var MongooseSchema7 = import_mongoose7.default.Schema;
5977
+ var OwnerTypeSchema = new MongooseSchema7(
5660
5978
  {
5661
5979
  email: { required: true, type: String },
5662
5980
  userId: {
5663
5981
  ref: "User",
5664
5982
  required: true,
5665
- type: import_mongoose6.default.Schema.Types.ObjectId
5983
+ type: import_mongoose7.default.Schema.Types.ObjectId
5666
5984
  }
5667
5985
  },
5668
5986
  { _id: false }
5669
5987
  // Prevents Mongoose from creating an additional _id field for subdocuments
5670
5988
  );
5671
- var SocialMediaTypeSchema = new MongooseSchema6(
5989
+ var SocialMediaTypeSchema = new MongooseSchema7(
5672
5990
  {
5673
5991
  link: { required: true, type: String },
5674
5992
  name: { required: true, type: String }
@@ -5676,7 +5994,7 @@ var SocialMediaTypeSchema = new MongooseSchema6(
5676
5994
  { _id: false }
5677
5995
  // Prevents Mongoose from creating an additional _id field
5678
5996
  );
5679
- var ResourceImageTypeSchema = new MongooseSchema6(
5997
+ var ResourceImageTypeSchema = new MongooseSchema7(
5680
5998
  {
5681
5999
  active: { default: true, required: true, type: Boolean },
5682
6000
  source: { required: false, type: String },
@@ -5685,7 +6003,7 @@ var ResourceImageTypeSchema = new MongooseSchema6(
5685
6003
  { _id: false }
5686
6004
  // Prevents Mongoose from creating an additional _id field for subdocuments
5687
6005
  );
5688
- var SubCategorySchema = new MongooseSchema6(
6006
+ var SubCategorySchema = new MongooseSchema7(
5689
6007
  {
5690
6008
  id: { required: false, type: String },
5691
6009
  items: [
@@ -5699,7 +6017,7 @@ var SubCategorySchema = new MongooseSchema6(
5699
6017
  { _id: false }
5700
6018
  // Prevents Mongoose from creating an additional _id field for subdocuments
5701
6019
  );
5702
- var CategorySchema = new MongooseSchema6(
6020
+ var CategorySchema = new MongooseSchema7(
5703
6021
  {
5704
6022
  id: { required: true, type: String },
5705
6023
  name: { required: true, type: String },
@@ -5708,7 +6026,7 @@ var CategorySchema = new MongooseSchema6(
5708
6026
  { _id: false }
5709
6027
  // Prevents Mongoose from creating an additional _id field for subdocuments
5710
6028
  );
5711
- var PosterUsageTypeSchema = new MongooseSchema6(
6029
+ var PosterUsageTypeSchema = new MongooseSchema7(
5712
6030
  {
5713
6031
  count: { default: 0, required: false, type: Number },
5714
6032
  month: { required: false, type: String }
@@ -5716,7 +6034,7 @@ var PosterUsageTypeSchema = new MongooseSchema6(
5716
6034
  { _id: false }
5717
6035
  // Prevents Mongoose from creating an additional _id field for subdocuments
5718
6036
  );
5719
- var userLicenseSchema = new MongooseSchema6(
6037
+ var userLicenseSchema = new MongooseSchema7(
5720
6038
  {
5721
6039
  expiryDate: { required: true, type: Date },
5722
6040
  issuedDate: { required: true, type: Date },
@@ -5733,7 +6051,7 @@ var userLicenseSchema = new MongooseSchema6(
5733
6051
  },
5734
6052
  { _id: false, timestamps: false }
5735
6053
  );
5736
- var ContactDetailsSchema = new MongooseSchema6(
6054
+ var ContactDetailsSchema = new MongooseSchema7(
5737
6055
  {
5738
6056
  email: { required: false, type: String },
5739
6057
  landlinePhone: { required: false, type: String },
@@ -5742,7 +6060,7 @@ var ContactDetailsSchema = new MongooseSchema6(
5742
6060
  { _id: false }
5743
6061
  // Prevents Mongoose from creating an additional _id field for subdocuments
5744
6062
  );
5745
- var termsAgreementSchema = new MongooseSchema6(
6063
+ var termsAgreementSchema = new MongooseSchema7(
5746
6064
  {
5747
6065
  appBuildNumber: { required: true, type: String },
5748
6066
  appId: { required: true, type: String },
@@ -5759,7 +6077,7 @@ var termsAgreementSchema = new MongooseSchema6(
5759
6077
  },
5760
6078
  { _id: false }
5761
6079
  );
5762
- var resourceRelationsSchema = new MongooseSchema6(
6080
+ var resourceRelationsSchema = new MongooseSchema7(
5763
6081
  {
5764
6082
  relationDates: {
5765
6083
  default: [],
@@ -5769,12 +6087,12 @@ var resourceRelationsSchema = new MongooseSchema6(
5769
6087
  relationId: {
5770
6088
  ref: "Relation",
5771
6089
  required: false,
5772
- type: import_mongoose6.default.Schema.Types.ObjectId
6090
+ type: import_mongoose7.default.Schema.Types.ObjectId
5773
6091
  }
5774
6092
  },
5775
6093
  { _id: false }
5776
6094
  );
5777
- var dateTimeSchema2 = new MongooseSchema6(
6095
+ var dateTimeSchema2 = new MongooseSchema7(
5778
6096
  {
5779
6097
  dateStatus: {
5780
6098
  enum: Object.values(EnumEventDateStatus),
@@ -5789,7 +6107,7 @@ var dateTimeSchema2 = new MongooseSchema6(
5789
6107
  { _id: false }
5790
6108
  // Prevents Mongoose from creating an additional _id field for subdocuments
5791
6109
  );
5792
- var locationGeoSchema = new MongooseSchema6(
6110
+ var locationGeoSchema = new MongooseSchema7(
5793
6111
  {
5794
6112
  coordinates: { required: true, type: [Number] },
5795
6113
  // [longitude, latitude]
@@ -5798,7 +6116,7 @@ var locationGeoSchema = new MongooseSchema6(
5798
6116
  { _id: false }
5799
6117
  // Prevents Mongoose from creating an additional _id field for subdocuments
5800
6118
  );
5801
- var locationsSchema = new MongooseSchema6(
6119
+ var locationsSchema = new MongooseSchema7(
5802
6120
  {
5803
6121
  city: { required: true, type: String },
5804
6122
  country: { required: true, type: String },
@@ -5814,13 +6132,13 @@ var locationsSchema = new MongooseSchema6(
5814
6132
  { _id: false }
5815
6133
  // Prevents Mongoose from creating an additional _id field for subdocuments
5816
6134
  );
5817
- var relatedPostSchema = new MongooseSchema6(
6135
+ var relatedPostSchema = new MongooseSchema7(
5818
6136
  {
5819
6137
  postActive: { default: true, required: true, type: Boolean },
5820
6138
  postId: {
5821
6139
  ref: "Post",
5822
6140
  required: true,
5823
- type: import_mongoose6.default.Schema.Types.ObjectId
6141
+ type: import_mongoose7.default.Schema.Types.ObjectId
5824
6142
  },
5825
6143
  postSlug: { required: true, type: String },
5826
6144
  postType: {
@@ -5832,7 +6150,7 @@ var relatedPostSchema = new MongooseSchema6(
5832
6150
  { _id: false }
5833
6151
  // Prevents Mongoose from creating an additional _id field for subdocuments
5834
6152
  );
5835
- var socialShareResourceSchema = new MongooseSchema6(
6153
+ var socialShareResourceSchema = new MongooseSchema7(
5836
6154
  {
5837
6155
  qrCode: { required: true, type: ResourceImageTypeSchema },
5838
6156
  socialImage: { required: true, type: ResourceImageTypeSchema }
@@ -5845,7 +6163,7 @@ var baseResourceFields = {
5845
6163
  adIds: {
5846
6164
  ref: "Ad",
5847
6165
  required: false,
5848
- type: [import_mongoose6.default.Schema.Types.ObjectId]
6166
+ type: [import_mongoose7.default.Schema.Types.ObjectId]
5849
6167
  },
5850
6168
  approvedAt: { default: null, required: false, type: Date },
5851
6169
  contactDetails: { required: false, type: ContactDetailsSchema },
@@ -5875,9 +6193,9 @@ var baseResourceFields = {
5875
6193
  };
5876
6194
 
5877
6195
  // src/mongoose/GoogleImportedMarket.ts
5878
- var import_mongoose7 = __toESM(require("mongoose"));
5879
- var MongooseSchema7 = import_mongoose7.default.Schema;
5880
- var addressComponentSchema = new MongooseSchema7(
6196
+ var import_mongoose8 = __toESM(require("mongoose"));
6197
+ var MongooseSchema8 = import_mongoose8.default.Schema;
6198
+ var addressComponentSchema = new MongooseSchema8(
5881
6199
  {
5882
6200
  longName: { required: false, type: String },
5883
6201
  shortName: { required: false, type: String },
@@ -5885,7 +6203,7 @@ var addressComponentSchema = new MongooseSchema7(
5885
6203
  },
5886
6204
  { _id: false }
5887
6205
  );
5888
- var schema3 = new MongooseSchema7(
6206
+ var schema4 = new MongooseSchema8(
5889
6207
  {
5890
6208
  active: { default: false, required: true, type: Boolean },
5891
6209
  address: { required: true, type: String },
@@ -5897,7 +6215,7 @@ var schema3 = new MongooseSchema7(
5897
6215
  claimedByUserId: {
5898
6216
  ref: "User",
5899
6217
  required: false,
5900
- type: import_mongoose7.default.Schema.Types.ObjectId
6218
+ type: import_mongoose8.default.Schema.Types.ObjectId
5901
6219
  },
5902
6220
  cover: {
5903
6221
  required: false,
@@ -5909,7 +6227,7 @@ var schema3 = new MongooseSchema7(
5909
6227
  eventId: {
5910
6228
  ref: "Event",
5911
6229
  required: false,
5912
- type: import_mongoose7.default.Schema.Types.ObjectId
6230
+ type: import_mongoose8.default.Schema.Types.ObjectId
5913
6231
  },
5914
6232
  eventType: {
5915
6233
  enum: Object.values(EnumEventType),
@@ -5948,18 +6266,18 @@ var schema3 = new MongooseSchema7(
5948
6266
  },
5949
6267
  { timestamps: true }
5950
6268
  );
5951
- schema3.index({ "location.geo": "2dsphere" });
5952
- schema3.index({ name: 1 });
5953
- schema3.index({ region: 1 });
5954
- schema3.index({ deletedAt: 1 });
5955
- schema3.index({ "dateTime.dateStatus": 1 });
5956
- schema3.index({ slug: 1 });
5957
- 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);
5958
6276
 
5959
6277
  // src/mongoose/Notification.ts
5960
- var import_mongoose8 = __toESM(require("mongoose"));
5961
- var MongooseSchema8 = import_mongoose8.default.Schema;
5962
- var schema4 = new MongooseSchema8(
6278
+ var import_mongoose9 = __toESM(require("mongoose"));
6279
+ var MongooseSchema9 = import_mongoose9.default.Schema;
6280
+ var schema5 = new MongooseSchema9(
5963
6281
  {
5964
6282
  data: {
5965
6283
  resourceId: { required: true, type: String },
@@ -5982,16 +6300,16 @@ var schema4 = new MongooseSchema8(
5982
6300
  userId: {
5983
6301
  ref: "User",
5984
6302
  required: true,
5985
- type: import_mongoose8.default.Schema.Types.ObjectId
6303
+ type: import_mongoose9.default.Schema.Types.ObjectId
5986
6304
  }
5987
6305
  },
5988
6306
  { timestamps: true }
5989
6307
  );
5990
- schema4.index({ isRead: 1, userId: 1 });
5991
- schema4.index({ createdAt: -1, userId: 1 });
5992
- 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);
5993
6311
 
5994
- // node_modules/@timardex/cluemart-shared/dist/chunk-7IB7QPVH.mjs
6312
+ // node_modules/@timardex/cluemart-shared/dist/chunk-P4NLBWEJ.mjs
5995
6313
  var EnumInviteStatus2 = /* @__PURE__ */ ((EnumInviteStatus22) => {
5996
6314
  EnumInviteStatus22["ACCEPTED"] = "Accepted";
5997
6315
  EnumInviteStatus22["COMPLETED"] = "Completed";
@@ -6069,9 +6387,9 @@ var EnumSubscriptionStatus2 = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6069
6387
  })(EnumSubscriptionStatus2 || {});
6070
6388
 
6071
6389
  // src/mongoose/PushToken.ts
6072
- var import_mongoose9 = __toESM(require("mongoose"));
6073
- var MongooseSchema9 = import_mongoose9.default.Schema;
6074
- var schema5 = new MongooseSchema9(
6390
+ var import_mongoose10 = __toESM(require("mongoose"));
6391
+ var MongooseSchema10 = import_mongoose10.default.Schema;
6392
+ var schema6 = new MongooseSchema10(
6075
6393
  {
6076
6394
  platform: {
6077
6395
  enum: Object.values(EnumOSPlatform2),
@@ -6082,17 +6400,17 @@ var schema5 = new MongooseSchema9(
6082
6400
  userId: {
6083
6401
  ref: "User",
6084
6402
  required: true,
6085
- type: import_mongoose9.default.Schema.Types.ObjectId
6403
+ type: import_mongoose10.default.Schema.Types.ObjectId
6086
6404
  }
6087
6405
  },
6088
6406
  { timestamps: true }
6089
6407
  );
6090
- 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);
6091
6409
 
6092
6410
  // src/mongoose/ResourceActivity.ts
6093
- var import_mongoose10 = __toESM(require("mongoose"));
6094
- var MongooseSchema10 = import_mongoose10.default.Schema;
6095
- var ActivitySchema = new MongooseSchema10(
6411
+ var import_mongoose11 = __toESM(require("mongoose"));
6412
+ var MongooseSchema11 = import_mongoose11.default.Schema;
6413
+ var ActivitySchema = new MongooseSchema11(
6096
6414
  {
6097
6415
  activityType: {
6098
6416
  enum: Object.values(EnumActivity),
@@ -6120,7 +6438,7 @@ var ActivitySchema = new MongooseSchema10(
6120
6438
  },
6121
6439
  { _id: false }
6122
6440
  );
6123
- var schema6 = new MongooseSchema10(
6441
+ var schema7 = new MongooseSchema11(
6124
6442
  {
6125
6443
  activity: { default: [], type: [ActivitySchema] },
6126
6444
  resourceId: { required: true, type: String },
@@ -6132,46 +6450,55 @@ var schema6 = new MongooseSchema10(
6132
6450
  },
6133
6451
  { timestamps: true }
6134
6452
  );
6135
- schema6.index({ resourceId: 1, resourceType: 1 }, { unique: true });
6136
- schema6.index({ "views.location": "2dsphere" });
6137
- 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);
6138
6456
 
6139
6457
  // src/mongoose/User.ts
6140
- var import_mongoose11 = __toESM(require("mongoose"));
6141
- var MongooseSchema11 = import_mongoose11.default.Schema;
6142
- var userActivityEventSchema = new MongooseSchema11(
6458
+ var import_mongoose12 = __toESM(require("mongoose"));
6459
+ var MongooseSchema12 = import_mongoose12.default.Schema;
6460
+ var userActivityEventSchema = new MongooseSchema12(
6143
6461
  {
6144
6462
  dateTime: dateTimeSchema2,
6145
6463
  resourceId: {
6146
6464
  ref: "Event",
6147
6465
  required: false,
6148
- type: import_mongoose11.default.Schema.Types.ObjectId
6466
+ type: import_mongoose12.default.Schema.Types.ObjectId
6149
6467
  }
6150
6468
  },
6151
6469
  { _id: false }
6152
6470
  );
6153
- var userActivityFavouritesSchema = new MongooseSchema11(
6471
+ var userActivityFavouritesSchema = new MongooseSchema12(
6154
6472
  {
6155
6473
  events: {
6156
6474
  ref: "Event",
6157
6475
  required: false,
6158
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6476
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6159
6477
  },
6160
6478
  partners: {
6161
6479
  ref: "Partner",
6162
6480
  required: false,
6163
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6481
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6164
6482
  },
6165
6483
  vendors: {
6166
6484
  ref: "Vendor",
6167
6485
  required: false,
6168
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6486
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6169
6487
  }
6170
6488
  },
6171
6489
  { _id: false }
6172
6490
  );
6173
- var stripeSchema = new MongooseSchema11(
6491
+ var stripeSchema = new MongooseSchema12(
6174
6492
  {
6493
+ billingPeriod: {
6494
+ enum: Object.values(EnumBillingPeriod),
6495
+ required: false,
6496
+ type: String
6497
+ },
6498
+ cancelAtPeriodEnd: {
6499
+ required: false,
6500
+ type: Boolean
6501
+ },
6175
6502
  currentPlan: {
6176
6503
  enum: Object.values(EnumUserLicence),
6177
6504
  required: false,
@@ -6185,6 +6512,28 @@ var stripeSchema = new MongooseSchema11(
6185
6512
  required: false,
6186
6513
  type: Date
6187
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
+ },
6188
6537
  startDate: {
6189
6538
  required: false,
6190
6539
  type: Date
@@ -6197,11 +6546,19 @@ var stripeSchema = new MongooseSchema11(
6197
6546
  subscriptionId: {
6198
6547
  required: false,
6199
6548
  type: String
6549
+ },
6550
+ subscriptionMutationLockExpiresAt: {
6551
+ required: false,
6552
+ type: Date
6553
+ },
6554
+ subscriptionMutationLockId: {
6555
+ required: false,
6556
+ type: String
6200
6557
  }
6201
6558
  },
6202
6559
  { _id: false }
6203
6560
  );
6204
- var redeemedRewardSchema = new MongooseSchema11(
6561
+ var redeemedRewardSchema = new MongooseSchema12(
6205
6562
  {
6206
6563
  name: {
6207
6564
  enum: Object.values(EnumReward),
@@ -6213,13 +6570,13 @@ var redeemedRewardSchema = new MongooseSchema11(
6213
6570
  },
6214
6571
  { _id: false }
6215
6572
  );
6216
- var schema7 = new MongooseSchema11(
6573
+ var schema8 = new MongooseSchema12(
6217
6574
  {
6218
6575
  active: { default: false, required: true, type: Boolean },
6219
6576
  affiliate: {
6220
6577
  ref: "Affiliate",
6221
6578
  required: false,
6222
- type: import_mongoose11.default.Schema.Types.ObjectId
6579
+ type: import_mongoose12.default.Schema.Types.ObjectId
6223
6580
  },
6224
6581
  avatar: {
6225
6582
  required: false,
@@ -6228,7 +6585,7 @@ var schema7 = new MongooseSchema11(
6228
6585
  coupon: {
6229
6586
  ref: "Coupon",
6230
6587
  required: false,
6231
- type: import_mongoose11.default.Schema.Types.ObjectId
6588
+ type: import_mongoose12.default.Schema.Types.ObjectId
6232
6589
  },
6233
6590
  deletedAt: { default: null, required: false, type: Date },
6234
6591
  email: { required: true, type: String },
@@ -6240,13 +6597,13 @@ var schema7 = new MongooseSchema11(
6240
6597
  events: {
6241
6598
  ref: "Event",
6242
6599
  required: false,
6243
- type: [import_mongoose11.default.Schema.Types.ObjectId]
6600
+ type: [import_mongoose12.default.Schema.Types.ObjectId]
6244
6601
  },
6245
6602
  firstName: { required: true, type: String },
6246
6603
  game: {
6247
6604
  ref: "Game",
6248
6605
  required: false,
6249
- type: import_mongoose11.default.Schema.Types.ObjectId
6606
+ type: import_mongoose12.default.Schema.Types.ObjectId
6250
6607
  },
6251
6608
  interests: {
6252
6609
  enum: Object.values(EnumResourceType),
@@ -6268,7 +6625,7 @@ var schema7 = new MongooseSchema11(
6268
6625
  partner: {
6269
6626
  ref: "Partner",
6270
6627
  required: false,
6271
- type: import_mongoose11.default.Schema.Types.ObjectId
6628
+ type: import_mongoose12.default.Schema.Types.ObjectId
6272
6629
  },
6273
6630
  password: { required: true, type: String },
6274
6631
  platform: {
@@ -6301,7 +6658,7 @@ var schema7 = new MongooseSchema11(
6301
6658
  school: {
6302
6659
  ref: "School",
6303
6660
  required: false,
6304
- type: import_mongoose11.default.Schema.Types.ObjectId
6661
+ type: import_mongoose12.default.Schema.Types.ObjectId
6305
6662
  },
6306
6663
  stripe: {
6307
6664
  required: false,
@@ -6326,19 +6683,19 @@ var schema7 = new MongooseSchema11(
6326
6683
  vendor: {
6327
6684
  ref: "Vendor",
6328
6685
  required: false,
6329
- type: import_mongoose11.default.Schema.Types.ObjectId
6686
+ type: import_mongoose12.default.Schema.Types.ObjectId
6330
6687
  }
6331
6688
  },
6332
6689
  { strict: false, timestamps: true }
6333
6690
  );
6334
- schema7.index({ "licences.expiryDate": 1 });
6335
- schema7.index({ "licences.licenceType": 1 });
6336
- 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);
6337
6694
 
6338
6695
  // src/mongoose/VerificationToken.ts
6339
- var import_mongoose12 = __toESM(require("mongoose"));
6340
- var MongooseSchema12 = import_mongoose12.default.Schema;
6341
- var schema8 = new MongooseSchema12(
6696
+ var import_mongoose13 = __toESM(require("mongoose"));
6697
+ var MongooseSchema13 = import_mongoose13.default.Schema;
6698
+ var schema9 = new MongooseSchema13(
6342
6699
  {
6343
6700
  createdAt: {
6344
6701
  default: Date.now,
@@ -6353,12 +6710,12 @@ var schema8 = new MongooseSchema12(
6353
6710
  },
6354
6711
  { timestamps: true }
6355
6712
  );
6356
- 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);
6357
6714
 
6358
6715
  // src/mongoose/vendor/Vendor.ts
6359
- var import_mongoose13 = __toESM(require("mongoose"));
6360
- var MongooseSchema13 = import_mongoose13.default.Schema;
6361
- var vendorProductTypeSchema = new MongooseSchema13(
6716
+ var import_mongoose14 = __toESM(require("mongoose"));
6717
+ var MongooseSchema14 = import_mongoose14.default.Schema;
6718
+ var vendorProductTypeSchema = new MongooseSchema14(
6362
6719
  {
6363
6720
  description: { required: false, type: String },
6364
6721
  name: { required: true, type: String },
@@ -6369,14 +6726,14 @@ var vendorProductTypeSchema = new MongooseSchema13(
6369
6726
  },
6370
6727
  { timestamps: true }
6371
6728
  );
6372
- var productWrapperSchema = new MongooseSchema13(
6729
+ var productWrapperSchema = new MongooseSchema14(
6373
6730
  {
6374
6731
  active: { default: false, required: false, type: Boolean },
6375
6732
  productsList: { required: false, type: [vendorProductTypeSchema] }
6376
6733
  },
6377
6734
  { _id: false }
6378
6735
  );
6379
- var calendarSchema = new MongooseSchema13(
6736
+ var calendarSchema = new MongooseSchema14(
6380
6737
  {
6381
6738
  dateTime: {
6382
6739
  dateStatus: {
@@ -6397,14 +6754,14 @@ var calendarSchema = new MongooseSchema13(
6397
6754
  },
6398
6755
  { _id: false }
6399
6756
  );
6400
- var calendarWrapperSchema = new MongooseSchema13(
6757
+ var calendarWrapperSchema = new MongooseSchema14(
6401
6758
  {
6402
6759
  active: { default: false, required: true, type: Boolean },
6403
6760
  calendarData: { required: false, type: [calendarSchema] }
6404
6761
  },
6405
6762
  { _id: false }
6406
6763
  );
6407
- var schema9 = new MongooseSchema13(
6764
+ var schema10 = new MongooseSchema14(
6408
6765
  {
6409
6766
  ...baseResourceFields,
6410
6767
  // Importing base resource fields from global.ts
@@ -6430,12 +6787,12 @@ var schema9 = new MongooseSchema13(
6430
6787
  unregisteredVendorId: {
6431
6788
  ref: "UnregisteredVendor",
6432
6789
  required: false,
6433
- type: import_mongoose13.default.Schema.Types.ObjectId
6790
+ type: import_mongoose14.default.Schema.Types.ObjectId
6434
6791
  },
6435
6792
  vendorInfoId: {
6436
6793
  ref: "VendorInfo",
6437
6794
  required: false,
6438
- type: import_mongoose13.default.Schema.Types.ObjectId
6795
+ type: import_mongoose14.default.Schema.Types.ObjectId
6439
6796
  },
6440
6797
  vendorType: {
6441
6798
  enum: Object.values(EnumVendorType),
@@ -6445,24 +6802,24 @@ var schema9 = new MongooseSchema13(
6445
6802
  },
6446
6803
  { timestamps: true }
6447
6804
  );
6448
- schema9.index({ name: 1 });
6449
- schema9.index({ description: 1 });
6450
- schema9.index({ region: 1 });
6451
- schema9.index({ "categories.name": 1 });
6452
- schema9.index({ slug: 1 });
6453
- 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);
6454
6811
 
6455
6812
  // src/mongoose/vendor/VendorInfo.ts
6456
- var import_mongoose14 = __toESM(require("mongoose"));
6457
- var MongooseSchema14 = import_mongoose14.default.Schema;
6458
- var AttributesSchema = new MongooseSchema14(
6813
+ var import_mongoose15 = __toESM(require("mongoose"));
6814
+ var MongooseSchema15 = import_mongoose15.default.Schema;
6815
+ var AttributesSchema = new MongooseSchema15(
6459
6816
  {
6460
6817
  details: { required: false, type: String },
6461
6818
  isRequired: { default: false, required: true, type: Boolean }
6462
6819
  },
6463
6820
  { _id: false }
6464
6821
  );
6465
- var schema10 = new MongooseSchema14(
6822
+ var schema11 = new MongooseSchema15(
6466
6823
  {
6467
6824
  active: { default: true, type: Boolean },
6468
6825
  compliance: {
@@ -6497,28 +6854,28 @@ var schema10 = new MongooseSchema14(
6497
6854
  vendorId: {
6498
6855
  ref: "Vendor",
6499
6856
  required: true,
6500
- type: import_mongoose14.default.Schema.Types.ObjectId
6857
+ type: import_mongoose15.default.Schema.Types.ObjectId
6501
6858
  }
6502
6859
  },
6503
6860
  { timestamps: true }
6504
6861
  );
6505
- 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);
6506
6863
 
6507
6864
  // src/mongoose/vendor/UnregisteredVendor.ts
6508
- var import_mongoose15 = __toESM(require("mongoose"));
6509
- var MongooseSchema15 = import_mongoose15.default.Schema;
6510
- var invitationSchema = new MongooseSchema15(
6865
+ var import_mongoose16 = __toESM(require("mongoose"));
6866
+ var MongooseSchema16 = import_mongoose16.default.Schema;
6867
+ var invitationSchema = new MongooseSchema16(
6511
6868
  {
6512
6869
  dateTime: { required: true, type: [dateTimeSchema2] },
6513
6870
  inviterId: {
6514
6871
  ref: "Event",
6515
6872
  required: true,
6516
- type: import_mongoose15.default.Schema.Types.ObjectId
6873
+ type: import_mongoose16.default.Schema.Types.ObjectId
6517
6874
  }
6518
6875
  },
6519
6876
  { _id: false }
6520
6877
  );
6521
- var schema11 = new MongooseSchema15(
6878
+ var schema12 = new MongooseSchema16(
6522
6879
  {
6523
6880
  active: { default: true, required: true, type: Boolean },
6524
6881
  categoryIds: { required: true, type: [String] },
@@ -6527,7 +6884,7 @@ var schema11 = new MongooseSchema15(
6527
6884
  claimedByUserId: {
6528
6885
  ref: "User",
6529
6886
  required: false,
6530
- type: import_mongoose15.default.Schema.Types.ObjectId
6887
+ type: import_mongoose16.default.Schema.Types.ObjectId
6531
6888
  },
6532
6889
  claimInitiatedAt: { default: null, required: false, type: Date },
6533
6890
  claimToken: { default: null, required: false, type: String },
@@ -6540,14 +6897,14 @@ var schema11 = new MongooseSchema15(
6540
6897
  },
6541
6898
  { timestamps: true }
6542
6899
  );
6543
- schema11.index({ name: 1 });
6544
- schema11.index({ email: 1 });
6545
- 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);
6546
6903
 
6547
6904
  // src/mongoose/event/Event.ts
6548
- var import_mongoose16 = __toESM(require("mongoose"));
6549
- var MongooseSchema16 = import_mongoose16.default.Schema;
6550
- var schema12 = new MongooseSchema16(
6905
+ var import_mongoose17 = __toESM(require("mongoose"));
6906
+ var MongooseSchema17 = import_mongoose17.default.Schema;
6907
+ var schema13 = new MongooseSchema17(
6551
6908
  {
6552
6909
  ...baseResourceFields,
6553
6910
  // Importing base resource fields from global.ts
@@ -6556,7 +6913,7 @@ var schema12 = new MongooseSchema16(
6556
6913
  eventInfoId: {
6557
6914
  ref: "EventInfo",
6558
6915
  required: false,
6559
- type: import_mongoose16.default.Schema.Types.ObjectId
6916
+ type: import_mongoose17.default.Schema.Types.ObjectId
6560
6917
  },
6561
6918
  eventType: {
6562
6919
  enum: Object.values(EnumEventType),
@@ -6585,20 +6942,20 @@ var schema12 = new MongooseSchema16(
6585
6942
  },
6586
6943
  { timestamps: true }
6587
6944
  );
6588
- schema12.index({ name: 1 });
6589
- schema12.index({ description: 1 });
6590
- schema12.index({ region: 1 });
6591
- schema12.index({ "location.geo": "2dsphere" });
6592
- schema12.index({ tags: 1 });
6593
- schema12.index({ deletedAt: 1 });
6594
- schema12.index({ "dateTime.dateStatus": 1 });
6595
- schema12.index({ slug: 1 });
6596
- 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);
6597
6954
 
6598
6955
  // src/mongoose/Partner.ts
6599
- var import_mongoose17 = __toESM(require("mongoose"));
6600
- var MongooseSchema17 = import_mongoose17.default.Schema;
6601
- var schema13 = new MongooseSchema17(
6956
+ var import_mongoose18 = __toESM(require("mongoose"));
6957
+ var MongooseSchema18 = import_mongoose18.default.Schema;
6958
+ var schema14 = new MongooseSchema18(
6602
6959
  {
6603
6960
  ...baseResourceFields,
6604
6961
  location: {
@@ -6614,19 +6971,19 @@ var schema13 = new MongooseSchema17(
6614
6971
  },
6615
6972
  { timestamps: true }
6616
6973
  );
6617
- schema13.index({ name: 1 });
6618
- schema13.index({ description: 1 });
6619
- schema13.index({ region: 1 });
6620
- schema13.index({ "location.geo": "2dsphere" });
6621
- schema13.index({ slug: 1 });
6622
- 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);
6623
6980
 
6624
6981
  // src/mongoose/Post.ts
6625
- var import_mongoose18 = __toESM(require("mongoose"));
6626
- var MongooseSchema18 = import_mongoose18.default.Schema;
6627
- var contentSchema = new MongooseSchema18(
6982
+ var import_mongoose19 = __toESM(require("mongoose"));
6983
+ var MongooseSchema19 = import_mongoose19.default.Schema;
6984
+ var contentSchema = new MongooseSchema19(
6628
6985
  {
6629
- contentData: import_mongoose18.Schema.Types.Mixed,
6986
+ contentData: import_mongoose19.Schema.Types.Mixed,
6630
6987
  contentOrder: { required: true, type: Number },
6631
6988
  contentType: {
6632
6989
  enum: Object.values(EnumPostContentType),
@@ -6636,7 +6993,7 @@ var contentSchema = new MongooseSchema18(
6636
6993
  },
6637
6994
  { _id: false }
6638
6995
  );
6639
- var resourceSchema = new MongooseSchema18(
6996
+ var resourceSchema = new MongooseSchema19(
6640
6997
  {
6641
6998
  resourceId: { required: true, type: String },
6642
6999
  resourceRegion: { required: true, type: String },
@@ -6649,7 +7006,7 @@ var resourceSchema = new MongooseSchema18(
6649
7006
  },
6650
7007
  { _id: false }
6651
7008
  );
6652
- var schema14 = new MongooseSchema18(
7009
+ var schema15 = new MongooseSchema19(
6653
7010
  {
6654
7011
  active: { default: false, required: true, type: Boolean },
6655
7012
  approvedAt: { default: null, required: false, type: Date },
@@ -6680,16 +7037,16 @@ var schema14 = new MongooseSchema18(
6680
7037
  },
6681
7038
  { timestamps: true }
6682
7039
  );
6683
- schema14.index({ title: 1 });
6684
- schema14.index({ tags: 1 });
6685
- schema14.index({ postType: 1, slug: 1 }, { unique: true });
6686
- 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);
6687
7044
 
6688
7045
  // src/mongoose/AppSetting.ts
6689
- var import_mongoose19 = __toESM(require("mongoose"));
6690
- var MongooseSchema19 = import_mongoose19.default.Schema;
7046
+ var import_mongoose20 = __toESM(require("mongoose"));
7047
+ var MongooseSchema20 = import_mongoose20.default.Schema;
6691
7048
  var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
6692
- var AppSettingSchema = new MongooseSchema19(
7049
+ var AppSettingSchema = new MongooseSchema20(
6693
7050
  {
6694
7051
  activeSchoolsStudentCountTotal: {
6695
7052
  default: 0,
@@ -6720,18 +7077,18 @@ var AppSettingSchema = new MongooseSchema19(
6720
7077
  },
6721
7078
  { timestamps: true }
6722
7079
  );
6723
- 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);
6724
7081
 
6725
7082
  // src/mongoose/game/Game.ts
6726
- var import_mongoose23 = __toESM(require("mongoose"));
7083
+ var import_mongoose24 = __toESM(require("mongoose"));
6727
7084
 
6728
7085
  // src/mongoose/game/DailyClue.ts
6729
- var import_mongoose21 = __toESM(require("mongoose"));
7086
+ var import_mongoose22 = __toESM(require("mongoose"));
6730
7087
 
6731
7088
  // src/mongoose/game/utils.ts
6732
- var import_mongoose20 = __toESM(require("mongoose"));
6733
- var MongooseSchema20 = import_mongoose20.default.Schema;
6734
- var schemaGameDate = new MongooseSchema20(
7089
+ var import_mongoose21 = __toESM(require("mongoose"));
7090
+ var MongooseSchema21 = import_mongoose21.default.Schema;
7091
+ var schemaGameDate = new MongooseSchema21(
6735
7092
  {
6736
7093
  endDate: { required: true, type: Date },
6737
7094
  startDate: { required: true, type: Date }
@@ -6740,8 +7097,8 @@ var schemaGameDate = new MongooseSchema20(
6740
7097
  );
6741
7098
 
6742
7099
  // src/mongoose/game/DailyClue.ts
6743
- var MongooseSchema21 = import_mongoose21.default.Schema;
6744
- var schemaLetters = new MongooseSchema21(
7100
+ var MongooseSchema22 = import_mongoose22.default.Schema;
7101
+ var schemaLetters = new MongooseSchema22(
6745
7102
  {
6746
7103
  collected: { required: false, type: [String] },
6747
7104
  solutionShuffled: { required: true, type: [String] }
@@ -6749,14 +7106,14 @@ var schemaLetters = new MongooseSchema21(
6749
7106
  },
6750
7107
  { _id: false }
6751
7108
  );
6752
- var schemaDailyClueBaseGame = new MongooseSchema21(
7109
+ var schemaDailyClueBaseGame = new MongooseSchema22(
6753
7110
  {
6754
7111
  gameDate: { required: true, type: schemaGameDate },
6755
7112
  gameSolution: { required: true, type: String }
6756
7113
  },
6757
7114
  { _id: false }
6758
7115
  );
6759
- var schemaDailyClueGameData = new MongooseSchema21(
7116
+ var schemaDailyClueGameData = new MongooseSchema22(
6760
7117
  {
6761
7118
  gameFields: { required: true, type: schemaDailyClueBaseGame },
6762
7119
  lastFoundDate: { default: null, required: false, type: Date },
@@ -6771,9 +7128,9 @@ var schemaDailyClueGameData = new MongooseSchema21(
6771
7128
  );
6772
7129
 
6773
7130
  // src/mongoose/game/PuzzleGame.ts
6774
- var import_mongoose22 = __toESM(require("mongoose"));
6775
- var MongooseSchema22 = import_mongoose22.default.Schema;
6776
- var schemaPuzzleAnswer = new MongooseSchema22(
7131
+ var import_mongoose23 = __toESM(require("mongoose"));
7132
+ var MongooseSchema23 = import_mongoose23.default.Schema;
7133
+ var schemaPuzzleAnswer = new MongooseSchema23(
6777
7134
  {
6778
7135
  answer: { required: true, type: String },
6779
7136
  answerId: { required: true, type: String },
@@ -6781,7 +7138,7 @@ var schemaPuzzleAnswer = new MongooseSchema22(
6781
7138
  },
6782
7139
  { _id: false }
6783
7140
  );
6784
- var schemaPuzzleQuestion = new MongooseSchema22(
7141
+ var schemaPuzzleQuestion = new MongooseSchema23(
6785
7142
  {
6786
7143
  answers: { required: true, type: [schemaPuzzleAnswer] },
6787
7144
  question: { required: true, type: String },
@@ -6789,20 +7146,20 @@ var schemaPuzzleQuestion = new MongooseSchema22(
6789
7146
  },
6790
7147
  { _id: false }
6791
7148
  );
6792
- var schemaPuzzleBaseGame = new MongooseSchema22(
7149
+ var schemaPuzzleBaseGame = new MongooseSchema23(
6793
7150
  {
6794
7151
  questions: { required: true, type: [schemaPuzzleQuestion] }
6795
7152
  },
6796
7153
  { _id: false }
6797
7154
  );
6798
- var schemaPuzzleAnsweredQuestion = new MongooseSchema22(
7155
+ var schemaPuzzleAnsweredQuestion = new MongooseSchema23(
6799
7156
  {
6800
7157
  questionId: { required: true, type: String },
6801
7158
  selectedAnswerId: { required: true, type: String }
6802
7159
  },
6803
7160
  { _id: false }
6804
7161
  );
6805
- var schemaPuzzleGameData = new MongooseSchema22(
7162
+ var schemaPuzzleGameData = new MongooseSchema23(
6806
7163
  {
6807
7164
  answeredQuestions: {
6808
7165
  default: null,
@@ -6817,19 +7174,19 @@ var schemaPuzzleGameData = new MongooseSchema22(
6817
7174
  );
6818
7175
 
6819
7176
  // src/mongoose/game/Game.ts
6820
- var MongooseSchema23 = import_mongoose23.default.Schema;
7177
+ var MongooseSchema24 = import_mongoose24.default.Schema;
6821
7178
  var gameDataSchemas = {
6822
7179
  [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
6823
7180
  [EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
6824
7181
  [EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
6825
7182
  };
6826
7183
  var gameDataDefinition = Object.fromEntries(
6827
- Object.entries(gameDataSchemas).map(([key, schema19]) => [
7184
+ Object.entries(gameDataSchemas).map(([key, schema20]) => [
6828
7185
  key,
6829
- { default: null, required: false, type: schema19 }
7186
+ { default: null, required: false, type: schema20 }
6830
7187
  ])
6831
7188
  );
6832
- var gameHistorySchema = new MongooseSchema23(
7189
+ var gameHistorySchema = new MongooseSchema24(
6833
7190
  {
6834
7191
  createdAt: { required: true, type: Date },
6835
7192
  gameDate: { required: true, type: schemaGameDate },
@@ -6849,7 +7206,7 @@ var gameHistorySchema = new MongooseSchema23(
6849
7206
  },
6850
7207
  { _id: false }
6851
7208
  );
6852
- var gameTypeSchema = new MongooseSchema23(
7209
+ var gameTypeSchema = new MongooseSchema24(
6853
7210
  {
6854
7211
  active: { default: true, required: true, type: Boolean },
6855
7212
  gameData: gameDataDefinition,
@@ -6864,7 +7221,7 @@ var gameTypeSchema = new MongooseSchema23(
6864
7221
  },
6865
7222
  { timestamps: true }
6866
7223
  );
6867
- var schema15 = new MongooseSchema23(
7224
+ var schema16 = new MongooseSchema24(
6868
7225
  {
6869
7226
  active: { default: false, required: true, type: Boolean },
6870
7227
  deletedAt: { default: null, required: false, type: Date },
@@ -6877,12 +7234,12 @@ var schema15 = new MongooseSchema23(
6877
7234
  },
6878
7235
  { timestamps: true }
6879
7236
  );
6880
- 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);
6881
7238
 
6882
7239
  // src/mongoose/School.ts
6883
- var import_mongoose24 = __toESM(require("mongoose"));
6884
- var MongooseSchema24 = import_mongoose24.default.Schema;
6885
- var campaignsSchema = new MongooseSchema24(
7240
+ var import_mongoose25 = __toESM(require("mongoose"));
7241
+ var MongooseSchema25 = import_mongoose25.default.Schema;
7242
+ var campaignsSchema = new MongooseSchema25(
6886
7243
  {
6887
7244
  endDate: { required: true, type: Date },
6888
7245
  name: { required: true, type: String },
@@ -6890,7 +7247,7 @@ var campaignsSchema = new MongooseSchema24(
6890
7247
  },
6891
7248
  { _id: false }
6892
7249
  );
6893
- var schema16 = new MongooseSchema24(
7250
+ var schema17 = new MongooseSchema25(
6894
7251
  {
6895
7252
  // New schools are active by default
6896
7253
  active: { default: false, required: true, type: Boolean },
@@ -6917,19 +7274,19 @@ var schema16 = new MongooseSchema24(
6917
7274
  },
6918
7275
  { timestamps: true }
6919
7276
  );
6920
- schema16.index(
7277
+ schema17.index(
6921
7278
  { schoolCode: 1 },
6922
7279
  {
6923
7280
  partialFilterExpression: { active: true, deletedAt: null },
6924
7281
  unique: true
6925
7282
  }
6926
7283
  );
6927
- 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);
6928
7285
 
6929
7286
  // src/mongoose/Affiliate.ts
6930
- var import_mongoose25 = __toESM(require("mongoose"));
6931
- var MongooseSchema25 = import_mongoose25.default.Schema;
6932
- var affiliateRewardSchema = new MongooseSchema25(
7287
+ var import_mongoose26 = __toESM(require("mongoose"));
7288
+ var MongooseSchema26 = import_mongoose26.default.Schema;
7289
+ var affiliateRewardSchema = new MongooseSchema26(
6933
7290
  {
6934
7291
  createdAt: { required: true, type: Date },
6935
7292
  redeemedAt: { default: null, required: false, type: Date },
@@ -6943,13 +7300,13 @@ var affiliateRewardSchema = new MongooseSchema25(
6943
7300
  },
6944
7301
  { _id: false }
6945
7302
  );
6946
- var affiliateResourceSchema = new MongooseSchema25(
7303
+ var affiliateResourceSchema = new MongooseSchema26(
6947
7304
  {
6948
7305
  resourceActive: { default: true, required: true, type: Boolean },
6949
7306
  resourceDeletedAt: { default: null, required: false, type: Date },
6950
7307
  resourceId: {
6951
7308
  required: true,
6952
- type: import_mongoose25.default.Schema.Types.ObjectId
7309
+ type: import_mongoose26.default.Schema.Types.ObjectId
6953
7310
  },
6954
7311
  resourceName: { required: true, type: String },
6955
7312
  resourceOwner: {
@@ -6969,20 +7326,20 @@ var affiliateResourceSchema = new MongooseSchema25(
6969
7326
  },
6970
7327
  { _id: false }
6971
7328
  );
6972
- var affiliateContactDetailsSchema = new MongooseSchema25(
7329
+ var affiliateContactDetailsSchema = new MongooseSchema26(
6973
7330
  {
6974
7331
  mobilePhone: { required: true, type: String }
6975
7332
  },
6976
7333
  { _id: false }
6977
7334
  );
6978
- var affiliateBankAccountDetailsSchema = new MongooseSchema25(
7335
+ var affiliateBankAccountDetailsSchema = new MongooseSchema26(
6979
7336
  {
6980
7337
  accountHolderName: { required: true, type: String },
6981
7338
  accountNumber: { required: true, type: String }
6982
7339
  },
6983
7340
  { _id: false }
6984
7341
  );
6985
- var affiliateDetailsSchema = new MongooseSchema25(
7342
+ var affiliateDetailsSchema = new MongooseSchema26(
6986
7343
  {
6987
7344
  bankAccountDetails: {
6988
7345
  required: true,
@@ -7004,7 +7361,7 @@ var affiliateDetailsSchema = new MongooseSchema25(
7004
7361
  },
7005
7362
  { _id: false }
7006
7363
  );
7007
- var redeemHistorySchema = new MongooseSchema25(
7364
+ var redeemHistorySchema = new MongooseSchema26(
7008
7365
  {
7009
7366
  paidAt: { default: null, required: false, type: Date },
7010
7367
  redeemedAt: { required: true, type: Date },
@@ -7012,7 +7369,7 @@ var redeemHistorySchema = new MongooseSchema25(
7012
7369
  },
7013
7370
  { _id: false }
7014
7371
  );
7015
- var schema17 = new MongooseSchema25(
7372
+ var schema18 = new MongooseSchema26(
7016
7373
  {
7017
7374
  active: { default: false, required: true, type: Boolean },
7018
7375
  affiliateBonusRewards: {
@@ -7042,19 +7399,19 @@ var schema17 = new MongooseSchema25(
7042
7399
  },
7043
7400
  { timestamps: true }
7044
7401
  );
7045
- schema17.index(
7402
+ schema18.index(
7046
7403
  { affiliateCode: 1 },
7047
7404
  {
7048
7405
  partialFilterExpression: { active: true, deletedAt: null },
7049
7406
  unique: true
7050
7407
  }
7051
7408
  );
7052
- 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);
7053
7410
 
7054
7411
  // src/mongoose/Coupon.ts
7055
- var import_mongoose26 = __toESM(require("mongoose"));
7056
- var MongooseSchema26 = import_mongoose26.default.Schema;
7057
- var couponOptionSchema = new MongooseSchema26(
7412
+ var import_mongoose27 = __toESM(require("mongoose"));
7413
+ var MongooseSchema27 = import_mongoose27.default.Schema;
7414
+ var couponOptionSchema = new MongooseSchema27(
7058
7415
  {
7059
7416
  buy: { required: false, type: Number },
7060
7417
  get: { required: false, type: Number },
@@ -7069,29 +7426,29 @@ var couponOptionSchema = new MongooseSchema26(
7069
7426
  },
7070
7427
  { _id: false }
7071
7428
  );
7072
- var couponVendorProductSchema = new MongooseSchema26(
7429
+ var couponVendorProductSchema = new MongooseSchema27(
7073
7430
  {
7074
7431
  couponId: {
7075
7432
  required: true,
7076
- type: import_mongoose26.default.Schema.Types.ObjectId
7433
+ type: import_mongoose27.default.Schema.Types.ObjectId
7077
7434
  },
7078
7435
  productId: {
7079
7436
  required: true,
7080
- type: import_mongoose26.default.Schema.Types.ObjectId
7437
+ type: import_mongoose27.default.Schema.Types.ObjectId
7081
7438
  },
7082
7439
  vendorCouponId: {
7083
7440
  required: false,
7084
- type: import_mongoose26.default.Schema.Types.ObjectId
7441
+ type: import_mongoose27.default.Schema.Types.ObjectId
7085
7442
  },
7086
7443
  vendorId: {
7087
7444
  ref: "Vendor",
7088
7445
  required: true,
7089
- type: import_mongoose26.default.Schema.Types.ObjectId
7446
+ type: import_mongoose27.default.Schema.Types.ObjectId
7090
7447
  }
7091
7448
  },
7092
7449
  { _id: false }
7093
7450
  );
7094
- var couponCodeSchema = new MongooseSchema26(
7451
+ var couponCodeSchema = new MongooseSchema27(
7095
7452
  {
7096
7453
  code: { required: true, type: String },
7097
7454
  qrCode: { required: true, type: ResourceImageTypeSchema },
@@ -7099,7 +7456,7 @@ var couponCodeSchema = new MongooseSchema26(
7099
7456
  },
7100
7457
  { _id: false }
7101
7458
  );
7102
- var couponParticipantUserSchema = new MongooseSchema26(
7459
+ var couponParticipantUserSchema = new MongooseSchema27(
7103
7460
  {
7104
7461
  couponCollectedCount: { default: 0, required: true, type: Number },
7105
7462
  couponCycleRedeemed: { default: false, required: true, type: Boolean },
@@ -7108,12 +7465,12 @@ var couponParticipantUserSchema = new MongooseSchema26(
7108
7465
  userId: {
7109
7466
  ref: "User",
7110
7467
  required: true,
7111
- type: import_mongoose26.default.Schema.Types.ObjectId
7468
+ type: import_mongoose27.default.Schema.Types.ObjectId
7112
7469
  }
7113
7470
  },
7114
7471
  { timestamps: true }
7115
7472
  );
7116
- var couponDataSchema = new MongooseSchema26(
7473
+ var couponDataSchema = new MongooseSchema27(
7117
7474
  {
7118
7475
  active: { default: true, required: true, type: Boolean },
7119
7476
  couponCode: { required: false, type: couponCodeSchema },
@@ -7140,7 +7497,7 @@ var couponDataSchema = new MongooseSchema26(
7140
7497
  },
7141
7498
  { timestamps: true }
7142
7499
  );
7143
- var schema18 = new MongooseSchema26(
7500
+ var schema19 = new MongooseSchema27(
7144
7501
  {
7145
7502
  active: { default: true, required: true, type: Boolean },
7146
7503
  couponData: { default: [], required: false, type: [couponDataSchema] },
@@ -7152,7 +7509,7 @@ var schema18 = new MongooseSchema26(
7152
7509
  },
7153
7510
  { timestamps: true }
7154
7511
  );
7155
- 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);
7156
7513
 
7157
7514
  // src/service/promoCode/constants.ts
7158
7515
  var ACTIVE_NOT_DELETED_FILTER = {
@@ -7169,7 +7526,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
7169
7526
  return existing !== null;
7170
7527
  }
7171
7528
 
7172
- // node_modules/@timardex/cluemart-shared/dist/chunk-2UNNIQIK.mjs
7529
+ // node_modules/@timardex/cluemart-shared/dist/chunk-YRO6KEZG.mjs
7173
7530
  var import_dayjs3 = __toESM(require("dayjs"), 1);
7174
7531
  var import_customParseFormat2 = __toESM(require("dayjs/plugin/customParseFormat.js"), 1);
7175
7532
  var import_isSameOrAfter2 = __toESM(require("dayjs/plugin/isSameOrAfter.js"), 1);
@@ -7242,7 +7599,7 @@ var SHARE_RESOURCE_LABEL2 = {
7242
7599
  school: "School"
7243
7600
  };
7244
7601
 
7245
- // node_modules/@timardex/cluemart-shared/dist/chunk-364EX22V.mjs
7602
+ // node_modules/@timardex/cluemart-shared/dist/chunk-STNE7PMX.mjs
7246
7603
  var PROMO_CODE_PREFIX2 = "CM-";
7247
7604
  var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
7248
7605
  var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
@@ -7354,7 +7711,7 @@ var gameScreenIdentifierList2 = [
7354
7711
  }
7355
7712
  ];
7356
7713
 
7357
- // node_modules/@timardex/cluemart-shared/dist/chunk-5RXL62LO.mjs
7714
+ // node_modules/@timardex/cluemart-shared/dist/chunk-3ZPHXVUT.mjs
7358
7715
  var import_dayjs4 = __toESM(require("dayjs"), 1);
7359
7716
  var statusOptions2 = [
7360
7717
  ...Object.values(EnumInviteStatus2).map((status) => ({
@@ -8791,7 +9148,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
8791
9148
  }
8792
9149
 
8793
9150
  // src/service/database.ts
8794
- var import_mongoose30 = __toESM(require("mongoose"));
9151
+ var import_mongoose31 = __toESM(require("mongoose"));
8795
9152
  var connectToDatabase = async ({
8796
9153
  appName,
8797
9154
  dbName,
@@ -8804,7 +9161,7 @@ var connectToDatabase = async ({
8804
9161
  // Fallback to MongoDB Atlas connection string
8805
9162
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
8806
9163
  );
8807
- await import_mongoose30.default.connect(mongoUri);
9164
+ await import_mongoose31.default.connect(mongoUri);
8808
9165
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
8809
9166
  console.log(
8810
9167
  `${connectionType} connected from server/src/service/database.ts`
@@ -8817,7 +9174,7 @@ var connectToDatabase = async ({
8817
9174
 
8818
9175
  // src/types/index.ts
8819
9176
  var import_express = __toESM(require("express"));
8820
- var import_mongoose31 = __toESM(require("mongoose"));
9177
+ var import_mongoose32 = __toESM(require("mongoose"));
8821
9178
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
8822
9179
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
8823
9180
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -8907,15 +9264,15 @@ async function updateAdStatuses() {
8907
9264
  }
8908
9265
 
8909
9266
  // src/service/objectIdToString.ts
8910
- var import_mongoose33 = __toESM(require("mongoose"));
9267
+ var import_mongoose34 = __toESM(require("mongoose"));
8911
9268
  function isValidObjectId(value) {
8912
- return import_mongoose33.default.Types.ObjectId.isValid(value);
9269
+ return import_mongoose34.default.Types.ObjectId.isValid(value);
8913
9270
  }
8914
9271
  function convertObjectIdsToStrings(obj) {
8915
9272
  if (obj === null || obj === void 0) {
8916
9273
  return obj;
8917
9274
  }
8918
- if (obj instanceof import_mongoose33.default.Types.ObjectId) {
9275
+ if (obj instanceof import_mongoose34.default.Types.ObjectId) {
8919
9276
  return obj.toString();
8920
9277
  }
8921
9278
  if (obj instanceof Date) {
@@ -9068,8 +9425,8 @@ async function findEventOrImportedMarketById(resourceId) {
9068
9425
  }
9069
9426
  const normalizedId = convertObjectIdsToStrings(resourceId);
9070
9427
  const [eventDoc, googleImportedDoc] = await Promise.all([
9071
- EventModel.findById(normalizedId).select("_id name").lean().exec(),
9072
- GoogleImportedMarketModel.findById(normalizedId).select("_id name").lean().exec()
9428
+ EventModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
9429
+ GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
9073
9430
  ]);
9074
9431
  return eventDoc ?? googleImportedDoc;
9075
9432
  }
@@ -9470,20 +9827,24 @@ var buildLicenceReplacePipeline = ({
9470
9827
  async function replaceUserLicenceWithObject({
9471
9828
  userId,
9472
9829
  licenceObject,
9473
- protectHigherLicence = true
9830
+ protectHigherLicence = true,
9831
+ refreshExistingLicence = false
9474
9832
  }) {
9475
9833
  const user = await UserModel.findById(userId, { licences: 1 }).lean();
9476
9834
  if (!user) throw new import_graphql3.GraphQLError("User not found");
9477
- 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) {
9478
9839
  return;
9479
9840
  }
9841
+ const category = getLicenceCategory(licenceObject.licenceType);
9480
9842
  const updatedLicenceObject = {
9481
9843
  ...licenceObject,
9482
- prevLicenceType: user.licences?.find(
9483
- (l) => getLicenceCategory(l.licenceType) === getLicenceCategory(licenceObject.licenceType)
9844
+ prevLicenceType: existingLicence && refreshExistingLicence ? existingLicence.prevLicenceType : user.licences?.find(
9845
+ (licence) => licence.licenceType && getLicenceCategory(licence.licenceType) === category
9484
9846
  )?.licenceType
9485
9847
  };
9486
- const category = getLicenceCategory(updatedLicenceObject.licenceType);
9487
9848
  if (protectHigherLicence) {
9488
9849
  const highestLicence = getHighestLicenceForCategory(
9489
9850
  user.licences,
@@ -9597,6 +9958,17 @@ var vendorLicences = [
9597
9958
  EnumUserLicence.PRO_VENDOR,
9598
9959
  EnumUserLicence.PRO_PLUS_VENDOR
9599
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
+ }
9600
9972
  async function handleVendorLicenceCompliance(user, now) {
9601
9973
  if (!user.licences || !user.vendor) {
9602
9974
  return;
@@ -9610,12 +9982,20 @@ async function handleVendorLicenceCompliance(user, now) {
9610
9982
  const proLicences = vendorLicencesOfUser.filter(
9611
9983
  (licence) => licence.licenceType !== EnumUserLicence.STANDARD_VENDOR
9612
9984
  );
9613
- const expiredProLicence = proLicences.some(
9985
+ const expiredProLicences = proLicences.filter(
9614
9986
  (licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now)
9615
9987
  );
9616
- 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);
9617
9997
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
9618
- (licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now)
9998
+ (licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
9619
9999
  );
9620
10000
  if (!hasExpiredVendorLicence) {
9621
10001
  return;
@@ -9629,7 +10009,10 @@ async function handleVendorLicenceCompliance(user, now) {
9629
10009
  "owner.userId": user._id
9630
10010
  }).lean().exec();
9631
10011
  }
9632
- 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");
9633
10016
  if (!expiredProLicence || !vendor || hasValidProLicence) {
9634
10017
  return;
9635
10018
  }
@@ -9718,6 +10101,13 @@ async function processUserCompliance(user, now) {
9718
10101
  }
9719
10102
 
9720
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
+ }
9721
10111
  async function ensureUserLicenseCompliance() {
9722
10112
  const now = (0, import_dayjs10.default)();
9723
10113
  console.log(`\u{1F50D} Checking license compliance at ${now.format()}`);
@@ -9969,7 +10359,7 @@ async function sendLicenseReminder(user, licence) {
9969
10359
  await sendPushNotifications(payload);
9970
10360
  console.log(`\u2705 Sent 7-day reminder to user ${userId} for ${licenceName}`);
9971
10361
  }
9972
- async function processLicenseReminder(user, licence, now) {
10362
+ async function processLicenseReminder(licence, now) {
9973
10363
  if ((0, import_dayjs11.default)(licence.expiryDate).isBefore(now)) {
9974
10364
  return false;
9975
10365
  }
@@ -10001,7 +10391,7 @@ async function processUserLicenseReminders(user, now) {
10001
10391
  const licenceChecks = await Promise.all(
10002
10392
  validLicences.map(async (licence) => {
10003
10393
  try {
10004
- const shouldSend = await processLicenseReminder(user, licence, now);
10394
+ const shouldSend = await processLicenseReminder(licence, now);
10005
10395
  return { licence, shouldSend };
10006
10396
  } catch (err) {
10007
10397
  console.error(
@@ -10068,6 +10458,8 @@ async function remindUsersAboutLicenseExpiration() {
10068
10458
  AdModel,
10069
10459
  AffiliateModel,
10070
10460
  AppSettingModel,
10461
+ BILLING_CATALOG_COLLECTION_NAME,
10462
+ BillingCatalogModel,
10071
10463
  CategorySchema,
10072
10464
  ChatModel,
10073
10465
  ChatReportModel,
@@ -10103,6 +10495,7 @@ async function remindUsersAboutLicenseExpiration() {
10103
10495
  activeAffiliateCodeExists,
10104
10496
  awardAffiliateVendorSubscriptionRewards,
10105
10497
  baseResourceFields,
10498
+ buildInitialBillingCatalogEntries,
10106
10499
  buildLicenceExpiryPipeline,
10107
10500
  checkOwnerHasLicence,
10108
10501
  connectToDatabase,
@@ -10111,10 +10504,12 @@ async function remindUsersAboutLicenseExpiration() {
10111
10504
  dateTimeSchema,
10112
10505
  didRemoveAnyEventDates,
10113
10506
  ensureUserLicenseCompliance,
10507
+ ensureUserLicenseComplianceForUser,
10114
10508
  eventLicences,
10115
10509
  express,
10116
10510
  findAffiliateByPromoCode,
10117
10511
  findEventOrImportedMarketById,
10512
+ getBillingCatalogDefinition,
10118
10513
  getEventResourceInfo,
10119
10514
  getHighestLicenceForCategory,
10120
10515
  getLicenceCategory,