@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.mjs CHANGED
@@ -292,8 +292,8 @@ var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource22) => {
292
292
  return EnumRelationResource22;
293
293
  })(EnumRelationResource || {});
294
294
  var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceType22) => {
295
- EnumNotificationResourceType22["APPROVED_AFFILIATE"] = "approved_affiliate";
296
295
  EnumNotificationResourceType22["AFFILIATE_REWARD_RECEIVED"] = "affiliate_reward_received";
296
+ EnumNotificationResourceType22["APPROVED_AFFILIATE"] = "approved_affiliate";
297
297
  EnumNotificationResourceType22["APPROVED_EVENT"] = "approved_event";
298
298
  EnumNotificationResourceType22["APPROVED_PARTNER"] = "approved_partner";
299
299
  EnumNotificationResourceType22["APPROVED_SCHOOL"] = "approved_school";
@@ -321,6 +321,7 @@ var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceTyp
321
321
  EnumNotificationResourceType22["NEW_POST_CREATED"] = "new_post_created";
322
322
  EnumNotificationResourceType22["REGISTERED_USER_BY_SCHOOL_CODE"] = "registered_user_by_school_code";
323
323
  EnumNotificationResourceType22["SYSTEM_ALERT"] = "system_alert";
324
+ EnumNotificationResourceType22["USER_COUPON_REDEEMED"] = "user_coupon_redeemed";
324
325
  EnumNotificationResourceType22["VENDOR_APPLICATION_TO_EVENT"] = "vendor_application_to_event";
325
326
  EnumNotificationResourceType22["VENDOR_UPDATE_RELATION_TO_EVENT"] = "vendor_update_relation_to_event";
326
327
  return EnumNotificationResourceType22;
@@ -395,6 +396,11 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
395
396
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
396
397
  return EnumSubscriptionStatus22;
397
398
  })(EnumSubscriptionStatus || {});
399
+ var EnumBillingPeriod = /* @__PURE__ */ ((EnumBillingPeriod22) => {
400
+ EnumBillingPeriod22["MONTHLY_CANCEL_ANYTIME"] = "monthly_cancel_anytime";
401
+ EnumBillingPeriod22["YEARLY_ANNUAL_BILLED"] = "yearly_annual_billed";
402
+ return EnumBillingPeriod22;
403
+ })(EnumBillingPeriod || {});
398
404
  var EnumReward = /* @__PURE__ */ ((EnumReward22) => {
399
405
  EnumReward22["MYSTERY_JOY_BOX"] = "mystery_joy_box";
400
406
  EnumReward22["MYSTERY_SQUEEZE_BOX"] = "mystery_squeeze_box";
@@ -1677,6 +1683,80 @@ var availableCategories = assignColorToCategories([
1677
1683
  ...petProductsAndAnimalGoods,
1678
1684
  ...serviceAndExperience
1679
1685
  ]);
1686
+ var BILLING_CATALOG_KEYS = [
1687
+ "pro_vendor_monthly",
1688
+ "pro_vendor_yearly",
1689
+ "pro_plus_vendor_monthly",
1690
+ "pro_plus_vendor_yearly"
1691
+ ];
1692
+ var BILLING_CATALOG_CURRENCY = "nzd";
1693
+ var BILLING_CATALOG_DEFINITIONS = {
1694
+ pro_plus_vendor_monthly: {
1695
+ billingPeriod: "monthly_cancel_anytime",
1696
+ licenceType: "pro_plus_vendor"
1697
+ /* PRO_PLUS_VENDOR */
1698
+ },
1699
+ pro_plus_vendor_yearly: {
1700
+ billingPeriod: "yearly_annual_billed",
1701
+ licenceType: "pro_plus_vendor"
1702
+ /* PRO_PLUS_VENDOR */
1703
+ },
1704
+ pro_vendor_monthly: {
1705
+ billingPeriod: "monthly_cancel_anytime",
1706
+ licenceType: "pro_vendor"
1707
+ /* PRO_VENDOR */
1708
+ },
1709
+ pro_vendor_yearly: {
1710
+ billingPeriod: "yearly_annual_billed",
1711
+ licenceType: "pro_vendor"
1712
+ /* PRO_VENDOR */
1713
+ }
1714
+ };
1715
+ var INITIAL_BILLING_CATALOG = [
1716
+ {
1717
+ active: true,
1718
+ billingPeriod: "monthly_cancel_anytime",
1719
+ currency: BILLING_CATALOG_CURRENCY,
1720
+ key: "pro_vendor_monthly",
1721
+ licenceType: "pro_vendor",
1722
+ taxInclusive: true,
1723
+ unitAmount: 3999
1724
+ },
1725
+ {
1726
+ active: true,
1727
+ billingPeriod: "yearly_annual_billed",
1728
+ currency: BILLING_CATALOG_CURRENCY,
1729
+ key: "pro_vendor_yearly",
1730
+ licenceType: "pro_vendor",
1731
+ taxInclusive: true,
1732
+ unitAmount: 40788
1733
+ },
1734
+ {
1735
+ active: true,
1736
+ billingPeriod: "monthly_cancel_anytime",
1737
+ currency: BILLING_CATALOG_CURRENCY,
1738
+ key: "pro_plus_vendor_monthly",
1739
+ licenceType: "pro_plus_vendor",
1740
+ taxInclusive: true,
1741
+ unitAmount: 6499
1742
+ },
1743
+ {
1744
+ active: true,
1745
+ billingPeriod: "yearly_annual_billed",
1746
+ currency: BILLING_CATALOG_CURRENCY,
1747
+ key: "pro_plus_vendor_yearly",
1748
+ licenceType: "pro_plus_vendor",
1749
+ taxInclusive: true,
1750
+ unitAmount: 62388
1751
+ }
1752
+ ];
1753
+ function billingCatalogDefinitionMatches(entry) {
1754
+ const definition = BILLING_CATALOG_DEFINITIONS[entry.key];
1755
+ if (!definition) {
1756
+ return false;
1757
+ }
1758
+ return definition.billingPeriod === entry.billingPeriod && definition.licenceType === entry.licenceType;
1759
+ }
1680
1760
  var packagingTypes = [
1681
1761
  "Biodegradable",
1682
1762
  "Compostable",
@@ -2121,12 +2201,19 @@ var REDEEMED_REWARD_FIELDS_FRAGMENT = gql`
2121
2201
  `;
2122
2202
  var STRIPE_FIELDS_FRAGMENT = gql`
2123
2203
  fragment StripeSubscriptionFields on StripeSubscriptionType {
2204
+ billingPeriod
2205
+ cancelAtPeriodEnd
2124
2206
  customerId
2125
2207
  subscriptionId
2126
2208
  status
2127
2209
  currentPlan
2128
2210
  startDate
2129
2211
  endDate
2212
+ pendingPlan
2213
+ pendingBillingPeriod
2214
+ pendingChangeEffectiveAt
2215
+ priceId
2216
+ scheduleId
2130
2217
  }
2131
2218
  `;
2132
2219
  var USER_FIELDS_FRAGMENT = gql`
@@ -2418,6 +2505,14 @@ var GET_EVENT = gql`
2418
2505
  }
2419
2506
  ${EVENT}
2420
2507
  `;
2508
+ var GET_OWNED_EVENT = gql`
2509
+ query getOwnedEvent($_id: ID!) {
2510
+ ownedEvent(_id: $_id) {
2511
+ ...EventFields
2512
+ }
2513
+ }
2514
+ ${EVENT}
2515
+ `;
2421
2516
  var GET_EVENT_BY_PLACE_ID = gql`
2422
2517
  query getEventByPlaceId($googlePlaceId: String!) {
2423
2518
  eventByPlaceId(googlePlaceId: $googlePlaceId) {
@@ -4152,11 +4247,8 @@ var GET_RESOURCE_ACTIVITY = gql`
4152
4247
  ${RESOURCE_ACTIVITY_FIELDS_FRAGMENT}
4153
4248
  `;
4154
4249
  var CREATE_CHECKOUT_SESSION_MUTATION = gql`
4155
- mutation createCheckoutSession(
4156
- $planId: LicencesEnumType!
4157
- $billingPeriod: BillingPeriodEnumType
4158
- ) {
4159
- createCheckoutSession(planId: $planId, billingPeriod: $billingPeriod) {
4250
+ mutation createCheckoutSession($input: CreateCheckoutSessionInputType!) {
4251
+ createCheckoutSession(input: $input) {
4160
4252
  data {
4161
4253
  sessionId
4162
4254
  checkoutUrl
@@ -4168,25 +4260,38 @@ var CREATE_CHECKOUT_SESSION_MUTATION = gql`
4168
4260
  var CANCEL_SUBSCRIPTION_MUTATION = gql`
4169
4261
  mutation cancelSubscription {
4170
4262
  cancelSubscription {
4171
- data
4263
+ data {
4264
+ billingPeriod
4265
+ cancelAtPeriodEnd
4266
+ currentPlan
4267
+ endDate
4268
+ pendingBillingPeriod
4269
+ pendingChangeEffectiveAt
4270
+ pendingPlan
4271
+ priceId
4272
+ scheduleId
4273
+ status
4274
+ subscriptionId
4275
+ }
4172
4276
  message
4173
4277
  }
4174
4278
  }
4175
4279
  `;
4176
4280
  var UPDATE_SUBSCRIPTION_PLAN_MUTATION = gql`
4177
- mutation updateSubscriptionPlan(
4178
- $newPlanId: LicencesEnumType!
4179
- $billingPeriod: BillingPeriodEnumType
4180
- ) {
4181
- updateSubscriptionPlan(
4182
- newPlanId: $newPlanId
4183
- billingPeriod: $billingPeriod
4184
- ) {
4281
+ mutation updateSubscriptionPlan($input: UpdateSubscriptionPlanInputType!) {
4282
+ updateSubscriptionPlan(input: $input) {
4185
4283
  data {
4186
- subscriptionId
4187
- status
4188
- priceId
4284
+ billingPeriod
4285
+ cancelAtPeriodEnd
4189
4286
  currentPlan
4287
+ endDate
4288
+ pendingBillingPeriod
4289
+ pendingChangeEffectiveAt
4290
+ pendingPlan
4291
+ priceId
4292
+ scheduleId
4293
+ status
4294
+ subscriptionId
4190
4295
  }
4191
4296
  message
4192
4297
  }
@@ -4202,36 +4307,20 @@ var CREATE_CUSTOMER_PORTAL = gql`
4202
4307
  }
4203
4308
  }
4204
4309
  `;
4205
- var SELECT_PACKAGE_MUTATION = gql`
4206
- mutation selectPackage(
4207
- $billingPeriod: BillingPeriodEnumType
4208
- $selectedLicence: LicencesEnumType!
4209
- $useStripe: Boolean
4210
- ) {
4211
- selectPackage(
4212
- billingPeriod: $billingPeriod
4213
- selectedLicence: $selectedLicence
4214
- useStripe: $useStripe
4215
- ) {
4216
- data {
4217
- checkoutUrl
4218
- licences {
4219
- ...LicenceFields
4220
- }
4221
- userId
4222
- }
4223
- message
4224
- }
4225
- }
4226
- ${LICENCE_FIELDS_FRAGMENT}
4227
- `;
4228
4310
  var GET_SUBSCRIPTION_STATUS = gql`
4229
4311
  query getSubscriptionStatus {
4230
4312
  getSubscriptionStatus {
4231
- subscriptionId
4232
- status
4233
- priceId
4313
+ billingPeriod
4314
+ cancelAtPeriodEnd
4234
4315
  currentPlan
4316
+ endDate
4317
+ pendingBillingPeriod
4318
+ pendingChangeEffectiveAt
4319
+ pendingPlan
4320
+ priceId
4321
+ scheduleId
4322
+ status
4323
+ subscriptionId
4235
4324
  }
4236
4325
  }
4237
4326
  `;
@@ -4258,7 +4347,6 @@ var GET_SUBSCRIPTION_PLANS = gql`
4258
4347
  }
4259
4348
  }
4260
4349
  isNewUser
4261
- isTester
4262
4350
  appliedDiscountType
4263
4351
  }
4264
4352
  }
@@ -4366,6 +4454,57 @@ var GET_APP_SETTINGS = gql`
4366
4454
  }
4367
4455
  ${APP_SETTINGS_FIELDS_FRAGMENT}
4368
4456
  `;
4457
+ var BILLING_CATALOG_FIELDS_FRAGMENT = gql`
4458
+ fragment BillingCatalogFields on BillingCatalogEntryType {
4459
+ _id
4460
+ active
4461
+ billingPeriod
4462
+ createdAt
4463
+ currency
4464
+ effectiveFrom
4465
+ key
4466
+ licenceType
4467
+ revision
4468
+ stripePriceId
4469
+ stripeProductId
4470
+ taxInclusive
4471
+ unitAmount
4472
+ updatedAt
4473
+ updatedBy
4474
+ }
4475
+ `;
4476
+ var GET_BILLING_CATALOG = gql`
4477
+ query getBillingCatalog {
4478
+ billingCatalog {
4479
+ ...BillingCatalogFields
4480
+ }
4481
+ }
4482
+ ${BILLING_CATALOG_FIELDS_FRAGMENT}
4483
+ `;
4484
+ var UPDATE_BILLING_CATALOG_PRICE_MUTATION = gql`
4485
+ mutation updateBillingCatalogPrice(
4486
+ $input: UpdateBillingCatalogPriceInputType!
4487
+ ) {
4488
+ updateBillingCatalogPrice(input: $input) {
4489
+ data {
4490
+ ...BillingCatalogFields
4491
+ }
4492
+ message
4493
+ }
4494
+ }
4495
+ ${BILLING_CATALOG_FIELDS_FRAGMENT}
4496
+ `;
4497
+ var SYNC_BILLING_CATALOG_PRICE_MUTATION = gql`
4498
+ mutation syncBillingCatalogPrice($input: SyncBillingCatalogPriceInputType!) {
4499
+ syncBillingCatalogPrice(input: $input) {
4500
+ data {
4501
+ ...BillingCatalogFields
4502
+ }
4503
+ message
4504
+ }
4505
+ }
4506
+ ${BILLING_CATALOG_FIELDS_FRAGMENT}
4507
+ `;
4369
4508
  var GAME_HISTORY_FIELDS_FRAGMENT = gql`
4370
4509
  fragment GameHistoryFields on GameHistoryType {
4371
4510
  createdAt
@@ -5204,46 +5343,220 @@ schema.index({
5204
5343
  start: 1,
5205
5344
  status: 1
5206
5345
  });
5346
+ schema.index({
5347
+ status: 1,
5348
+ targetRegion: 1,
5349
+ // eslint-disable-next-line sort-keys
5350
+ start: -1
5351
+ });
5207
5352
  var AdModel = mongoose.models.Ad || mongoose.model("Ad", schema);
5208
5353
 
5209
- // src/mongoose/chat/Chat.ts
5354
+ // src/mongoose/BillingCatalog.ts
5210
5355
  import mongoose2 from "mongoose";
5211
5356
  var MongooseSchema2 = mongoose2.Schema;
5212
- var MessageReplyPreviewSchema = new MongooseSchema2(
5357
+ var BILLING_CATALOG_COLLECTION_NAME = "billingCatalog";
5358
+ var paidVendorLicences = [
5359
+ EnumUserLicence.PRO_VENDOR,
5360
+ EnumUserLicence.PRO_PLUS_VENDOR
5361
+ ];
5362
+ var supportedBillingPeriods = [
5363
+ EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,
5364
+ EnumBillingPeriod.YEARLY_ANNUAL_BILLED
5365
+ ];
5366
+ var unitAmountField = {
5367
+ min: 1,
5368
+ required: true,
5369
+ type: Number,
5370
+ validate: {
5371
+ message: "Billing catalogue price must be a positive integer.",
5372
+ validator: Number.isInteger
5373
+ }
5374
+ };
5375
+ var currencyField = {
5376
+ default: BILLING_CATALOG_CURRENCY,
5377
+ enum: [BILLING_CATALOG_CURRENCY],
5378
+ immutable: true,
5379
+ lowercase: true,
5380
+ required: true,
5381
+ trim: true,
5382
+ type: String
5383
+ };
5384
+ var stripePriceIdField = {
5385
+ default: null,
5386
+ required: false,
5387
+ trim: true,
5388
+ type: String
5389
+ };
5390
+ var stripeProductIdField = {
5391
+ default: null,
5392
+ required: false,
5393
+ trim: true,
5394
+ type: String
5395
+ };
5396
+ var priceHistorySchema = new MongooseSchema2(
5397
+ {
5398
+ changedAt: { required: true, type: Date },
5399
+ changedBy: {
5400
+ default: null,
5401
+ ref: "User",
5402
+ required: false,
5403
+ type: mongoose2.Schema.Types.ObjectId
5404
+ },
5405
+ currency: currencyField,
5406
+ effectiveFrom: { required: true, type: Date },
5407
+ effectiveTo: { required: true, type: Date },
5408
+ stripePriceId: stripePriceIdField,
5409
+ stripeProductId: stripeProductIdField,
5410
+ unitAmount: unitAmountField
5411
+ },
5412
+ { _id: false }
5413
+ );
5414
+ var schema2 = new MongooseSchema2(
5415
+ {
5416
+ active: { default: true, required: true, type: Boolean },
5417
+ billingPeriod: {
5418
+ enum: supportedBillingPeriods,
5419
+ immutable: true,
5420
+ required: true,
5421
+ type: String
5422
+ },
5423
+ currency: currencyField,
5424
+ effectiveFrom: { default: Date.now, required: true, type: Date },
5425
+ key: {
5426
+ enum: BILLING_CATALOG_KEYS,
5427
+ immutable: true,
5428
+ required: true,
5429
+ type: String,
5430
+ unique: true
5431
+ },
5432
+ licenceType: {
5433
+ enum: paidVendorLicences,
5434
+ immutable: true,
5435
+ required: true,
5436
+ type: String
5437
+ },
5438
+ priceHistory: {
5439
+ default: [],
5440
+ required: true,
5441
+ type: [priceHistorySchema]
5442
+ },
5443
+ revision: {
5444
+ default: 1,
5445
+ min: 1,
5446
+ required: true,
5447
+ type: Number,
5448
+ validate: {
5449
+ message: "Billing catalogue revision must be a positive integer.",
5450
+ validator: Number.isInteger
5451
+ }
5452
+ },
5453
+ stripePriceId: stripePriceIdField,
5454
+ stripeProductId: stripeProductIdField,
5455
+ taxInclusive: {
5456
+ default: true,
5457
+ immutable: true,
5458
+ required: true,
5459
+ type: Boolean,
5460
+ validate: {
5461
+ message: "Billing catalogue prices must include GST.",
5462
+ validator: (value) => value === true
5463
+ }
5464
+ },
5465
+ unitAmount: unitAmountField,
5466
+ updatedBy: {
5467
+ default: null,
5468
+ ref: "User",
5469
+ required: false,
5470
+ type: mongoose2.Schema.Types.ObjectId
5471
+ }
5472
+ },
5473
+ {
5474
+ collection: BILLING_CATALOG_COLLECTION_NAME,
5475
+ strict: true,
5476
+ timestamps: true
5477
+ }
5478
+ );
5479
+ schema2.pre("validate", function validateDefinition() {
5480
+ if (!billingCatalogDefinitionMatches(this)) {
5481
+ this.invalidate(
5482
+ "key",
5483
+ "Billing catalogue key does not match its licence and billing period."
5484
+ );
5485
+ }
5486
+ });
5487
+ schema2.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });
5488
+ schema2.index({ active: 1, licenceType: 1 });
5489
+ schema2.index(
5490
+ { stripePriceId: 1 },
5491
+ {
5492
+ partialFilterExpression: { stripePriceId: { $type: "string" } },
5493
+ unique: true
5494
+ }
5495
+ );
5496
+ var BillingCatalogModel = mongoose2.models.BillingCatalogEntry || mongoose2.model(
5497
+ "BillingCatalogEntry",
5498
+ schema2,
5499
+ BILLING_CATALOG_COLLECTION_NAME
5500
+ );
5501
+ function buildInitialBillingCatalogEntries(now = /* @__PURE__ */ new Date()) {
5502
+ return INITIAL_BILLING_CATALOG.map((entry) => ({
5503
+ active: entry.active,
5504
+ billingPeriod: entry.billingPeriod,
5505
+ currency: entry.currency,
5506
+ effectiveFrom: new Date(now.getTime()),
5507
+ key: entry.key,
5508
+ licenceType: entry.licenceType,
5509
+ priceHistory: [],
5510
+ revision: 1,
5511
+ stripePriceId: null,
5512
+ stripeProductId: null,
5513
+ taxInclusive: entry.taxInclusive,
5514
+ unitAmount: entry.unitAmount,
5515
+ updatedBy: null
5516
+ }));
5517
+ }
5518
+ function getBillingCatalogDefinition(key) {
5519
+ return BILLING_CATALOG_DEFINITIONS[key];
5520
+ }
5521
+
5522
+ // src/mongoose/chat/Chat.ts
5523
+ import mongoose3 from "mongoose";
5524
+ var MongooseSchema3 = mongoose3.Schema;
5525
+ var MessageReplyPreviewSchema = new MongooseSchema3(
5213
5526
  {
5214
5527
  contentPreview: { required: true, type: String },
5215
5528
  senderId: {
5216
5529
  ref: "User",
5217
5530
  required: true,
5218
- type: mongoose2.Schema.Types.ObjectId
5531
+ type: mongoose3.Schema.Types.ObjectId
5219
5532
  },
5220
5533
  senderName: { required: true, type: String }
5221
5534
  },
5222
5535
  { _id: false }
5223
5536
  );
5224
- var MessageReactionSchema = new MongooseSchema2(
5537
+ var MessageReactionSchema = new MongooseSchema3(
5225
5538
  {
5226
5539
  createdAt: { required: true, type: Date },
5227
5540
  userId: {
5228
5541
  ref: "User",
5229
5542
  required: true,
5230
- type: mongoose2.Schema.Types.ObjectId
5543
+ type: mongoose3.Schema.Types.ObjectId
5231
5544
  }
5232
5545
  },
5233
5546
  { _id: false }
5234
5547
  );
5235
- var MessageSeenSchema = new MongooseSchema2(
5548
+ var MessageSeenSchema = new MongooseSchema3(
5236
5549
  {
5237
5550
  seenAt: { required: true, type: Date },
5238
5551
  userId: {
5239
5552
  ref: "User",
5240
5553
  required: true,
5241
- type: mongoose2.Schema.Types.ObjectId
5554
+ type: mongoose3.Schema.Types.ObjectId
5242
5555
  }
5243
5556
  },
5244
5557
  { _id: false }
5245
5558
  );
5246
- var MessageSchema = new MongooseSchema2(
5559
+ var MessageSchema = new MongooseSchema3(
5247
5560
  {
5248
5561
  content: { required: true, type: String },
5249
5562
  likedBy: { default: [], required: false, type: [MessageReactionSchema] },
@@ -5254,18 +5567,18 @@ var MessageSchema = new MongooseSchema2(
5254
5567
  replyToMessageId: {
5255
5568
  ref: "Chat.messages",
5256
5569
  required: false,
5257
- type: mongoose2.Schema.Types.ObjectId
5570
+ type: mongoose3.Schema.Types.ObjectId
5258
5571
  },
5259
5572
  seenBy: { default: [], required: false, type: [MessageSeenSchema] },
5260
5573
  senderId: {
5261
5574
  ref: "User",
5262
5575
  required: true,
5263
- type: mongoose2.Schema.Types.ObjectId
5576
+ type: mongoose3.Schema.Types.ObjectId
5264
5577
  }
5265
5578
  },
5266
5579
  { timestamps: true }
5267
5580
  );
5268
- var ParticipantSchema = new MongooseSchema2(
5581
+ var ParticipantSchema = new MongooseSchema3(
5269
5582
  {
5270
5583
  active: { default: true, required: true, type: Boolean },
5271
5584
  userAvatar: { required: false, type: String },
@@ -5273,14 +5586,14 @@ var ParticipantSchema = new MongooseSchema2(
5273
5586
  userId: {
5274
5587
  ref: "User",
5275
5588
  required: true,
5276
- type: mongoose2.Schema.Types.ObjectId
5589
+ type: mongoose3.Schema.Types.ObjectId
5277
5590
  },
5278
5591
  userName: { required: true, type: String }
5279
5592
  },
5280
5593
  { _id: false }
5281
5594
  // Prevents Mongoose from creating an additional _id field for subdocuments
5282
5595
  );
5283
- var ChatSchema = new MongooseSchema2(
5596
+ var ChatSchema = new MongooseSchema3(
5284
5597
  {
5285
5598
  active: { default: true, required: true, type: Boolean },
5286
5599
  chatDescription: { required: false, type: String },
@@ -5304,12 +5617,12 @@ ChatSchema.index({
5304
5617
  "participants.userId": 1,
5305
5618
  updatedAt: -1
5306
5619
  });
5307
- var ChatModel = mongoose2.models.Chat || mongoose2.model("Chat", ChatSchema);
5620
+ var ChatModel = mongoose3.models.Chat || mongoose3.model("Chat", ChatSchema);
5308
5621
 
5309
5622
  // src/mongoose/chat/ChatReport.ts
5310
- import mongoose3 from "mongoose";
5311
- var MongooseSchema3 = mongoose3.Schema;
5312
- var ReasonSchema = new MongooseSchema3(
5623
+ import mongoose4 from "mongoose";
5624
+ var MongooseSchema4 = mongoose4.Schema;
5625
+ var ReasonSchema = new MongooseSchema4(
5313
5626
  {
5314
5627
  details: { default: null, required: false, type: String },
5315
5628
  reasonType: {
@@ -5320,23 +5633,23 @@ var ReasonSchema = new MongooseSchema3(
5320
5633
  },
5321
5634
  { _id: false }
5322
5635
  );
5323
- var ChatReportSchema = new MongooseSchema3(
5636
+ var ChatReportSchema = new MongooseSchema4(
5324
5637
  {
5325
5638
  chatId: {
5326
5639
  ref: "Chat",
5327
5640
  required: true,
5328
- type: mongoose3.Schema.Types.ObjectId
5641
+ type: mongoose4.Schema.Types.ObjectId
5329
5642
  },
5330
5643
  reason: { required: true, type: ReasonSchema },
5331
5644
  reportedUserId: {
5332
5645
  ref: "User",
5333
5646
  required: true,
5334
- type: mongoose3.Schema.Types.ObjectId
5647
+ type: mongoose4.Schema.Types.ObjectId
5335
5648
  },
5336
5649
  reporterUserId: {
5337
5650
  ref: "User",
5338
5651
  required: true,
5339
- type: mongoose3.Schema.Types.ObjectId
5652
+ type: mongoose4.Schema.Types.ObjectId
5340
5653
  },
5341
5654
  resolved: { default: false, required: true, type: Boolean }
5342
5655
  },
@@ -5344,18 +5657,18 @@ var ChatReportSchema = new MongooseSchema3(
5344
5657
  );
5345
5658
  ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
5346
5659
  ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
5347
- var ChatReportModel = mongoose3.models.ChatReport || mongoose3.model("ChatReport", ChatReportSchema);
5660
+ var ChatReportModel = mongoose4.models.ChatReport || mongoose4.model("ChatReport", ChatReportSchema);
5348
5661
 
5349
5662
  // src/mongoose/global.ts
5350
- import mongoose6 from "mongoose";
5663
+ import mongoose7 from "mongoose";
5351
5664
 
5352
5665
  // src/mongoose/Relation.ts
5353
- import mongoose5 from "mongoose";
5666
+ import mongoose6 from "mongoose";
5354
5667
 
5355
5668
  // src/mongoose/event/EventInfo.ts
5356
- import mongoose4 from "mongoose";
5357
- var MongooseSchema4 = mongoose4.Schema;
5358
- var StallTypeSchema = new MongooseSchema4(
5669
+ import mongoose5 from "mongoose";
5670
+ var MongooseSchema5 = mongoose5.Schema;
5671
+ var StallTypeSchema = new MongooseSchema5(
5359
5672
  {
5360
5673
  label: { required: false, type: String },
5361
5674
  price: { required: false, type: Number },
@@ -5366,7 +5679,7 @@ var StallTypeSchema = new MongooseSchema4(
5366
5679
  // Prevents Mongoose from creating an additional _id field for subdocuments
5367
5680
  }
5368
5681
  );
5369
- var dateTimeSchema = new MongooseSchema4(
5682
+ var dateTimeSchema = new MongooseSchema5(
5370
5683
  {
5371
5684
  dateStatus: {
5372
5685
  enum: Object.values(EnumEventDateStatus),
@@ -5382,7 +5695,7 @@ var dateTimeSchema = new MongooseSchema4(
5382
5695
  { _id: false }
5383
5696
  // Prevents Mongoose from creating an additional _id field for subdocuments
5384
5697
  );
5385
- var paymentInfoSchema = new MongooseSchema4(
5698
+ var paymentInfoSchema = new MongooseSchema5(
5386
5699
  {
5387
5700
  accountHolderName: { required: false, type: String },
5388
5701
  accountNumber: { required: false, type: String },
@@ -5396,7 +5709,7 @@ var paymentInfoSchema = new MongooseSchema4(
5396
5709
  { _id: false }
5397
5710
  // Prevents Mongoose from creating an additional _id field
5398
5711
  );
5399
- var requirementsSchema = new MongooseSchema4(
5712
+ var requirementsSchema = new MongooseSchema5(
5400
5713
  {
5401
5714
  category: { required: true, type: String },
5402
5715
  label: { required: true, type: String },
@@ -5407,7 +5720,7 @@ var requirementsSchema = new MongooseSchema4(
5407
5720
  // Prevents Mongoose from creating an additional _id field for
5408
5721
  }
5409
5722
  );
5410
- var refundPolicySchema = new MongooseSchema4(
5723
+ var refundPolicySchema = new MongooseSchema5(
5411
5724
  {
5412
5725
  category: { required: true, type: String },
5413
5726
  label: { required: true, type: String },
@@ -5415,7 +5728,7 @@ var refundPolicySchema = new MongooseSchema4(
5415
5728
  },
5416
5729
  { _id: false }
5417
5730
  );
5418
- var schema2 = new MongooseSchema4(
5731
+ var schema3 = new MongooseSchema5(
5419
5732
  {
5420
5733
  active: { default: true, type: Boolean },
5421
5734
  applicationDeadlineHours: { required: true, type: Number },
@@ -5423,7 +5736,7 @@ var schema2 = new MongooseSchema4(
5423
5736
  eventId: {
5424
5737
  ref: "Event",
5425
5738
  required: true,
5426
- type: mongoose4.Schema.Types.ObjectId
5739
+ type: mongoose5.Schema.Types.ObjectId
5427
5740
  },
5428
5741
  packInTime: { required: true, type: Number },
5429
5742
  paymentDueHours: { required: true, type: Number },
@@ -5433,11 +5746,11 @@ var schema2 = new MongooseSchema4(
5433
5746
  },
5434
5747
  { timestamps: true }
5435
5748
  );
5436
- var EventInfoModel = mongoose4.models.EventInfo || mongoose4.model("EventInfo", schema2);
5749
+ var EventInfoModel = mongoose5.models.EventInfo || mongoose5.model("EventInfo", schema3);
5437
5750
 
5438
5751
  // src/mongoose/Relation.ts
5439
- var MongooseSchema5 = mongoose5.Schema;
5440
- var relationDateTimeSchema = new MongooseSchema5(
5752
+ var MongooseSchema6 = mongoose6.Schema;
5753
+ var relationDateTimeSchema = new MongooseSchema6(
5441
5754
  {
5442
5755
  dateStatus: {
5443
5756
  enum: Object.values(EnumEventDateStatus),
@@ -5452,7 +5765,7 @@ var relationDateTimeSchema = new MongooseSchema5(
5452
5765
  },
5453
5766
  { _id: false }
5454
5767
  );
5455
- var relationDatesSchema = new MongooseSchema5(
5768
+ var relationDatesSchema = new MongooseSchema6(
5456
5769
  {
5457
5770
  dateTime: {
5458
5771
  required: true,
@@ -5471,19 +5784,19 @@ var relationDatesSchema = new MongooseSchema5(
5471
5784
  },
5472
5785
  { _id: false }
5473
5786
  );
5474
- var RelationTypeSchema = new MongooseSchema5(
5787
+ var RelationTypeSchema = new MongooseSchema6(
5475
5788
  {
5476
5789
  active: { default: true, required: true, type: Boolean },
5477
5790
  chatId: {
5478
5791
  ref: "Chat",
5479
5792
  required: true,
5480
- type: mongoose5.Schema.Types.ObjectId
5793
+ type: mongoose6.Schema.Types.ObjectId
5481
5794
  },
5482
5795
  deletedAt: { default: null, required: false, type: Date },
5483
5796
  eventId: {
5484
5797
  ref: "Event",
5485
5798
  required: true,
5486
- type: mongoose5.Schema.Types.ObjectId
5799
+ type: mongoose6.Schema.Types.ObjectId
5487
5800
  },
5488
5801
  lastUpdateBy: {
5489
5802
  enum: Object.values(EnumResourceType),
@@ -5499,7 +5812,7 @@ var RelationTypeSchema = new MongooseSchema5(
5499
5812
  vendorId: {
5500
5813
  ref: "Vendor",
5501
5814
  required: true,
5502
- type: mongoose5.Schema.Types.ObjectId
5815
+ type: mongoose6.Schema.Types.ObjectId
5503
5816
  }
5504
5817
  },
5505
5818
  { timestamps: true }
@@ -5511,23 +5824,23 @@ RelationTypeSchema.index({
5511
5824
  "relationDates.status": 1,
5512
5825
  vendorId: 1
5513
5826
  });
5514
- var RelationModel = mongoose5.models.Relation || mongoose5.model("Relation", RelationTypeSchema);
5827
+ var RelationModel = mongoose6.models.Relation || mongoose6.model("Relation", RelationTypeSchema);
5515
5828
 
5516
5829
  // src/mongoose/global.ts
5517
- var MongooseSchema6 = mongoose6.Schema;
5518
- var OwnerTypeSchema = new MongooseSchema6(
5830
+ var MongooseSchema7 = mongoose7.Schema;
5831
+ var OwnerTypeSchema = new MongooseSchema7(
5519
5832
  {
5520
5833
  email: { required: true, type: String },
5521
5834
  userId: {
5522
5835
  ref: "User",
5523
5836
  required: true,
5524
- type: mongoose6.Schema.Types.ObjectId
5837
+ type: mongoose7.Schema.Types.ObjectId
5525
5838
  }
5526
5839
  },
5527
5840
  { _id: false }
5528
5841
  // Prevents Mongoose from creating an additional _id field for subdocuments
5529
5842
  );
5530
- var SocialMediaTypeSchema = new MongooseSchema6(
5843
+ var SocialMediaTypeSchema = new MongooseSchema7(
5531
5844
  {
5532
5845
  link: { required: true, type: String },
5533
5846
  name: { required: true, type: String }
@@ -5535,7 +5848,7 @@ var SocialMediaTypeSchema = new MongooseSchema6(
5535
5848
  { _id: false }
5536
5849
  // Prevents Mongoose from creating an additional _id field
5537
5850
  );
5538
- var ResourceImageTypeSchema = new MongooseSchema6(
5851
+ var ResourceImageTypeSchema = new MongooseSchema7(
5539
5852
  {
5540
5853
  active: { default: true, required: true, type: Boolean },
5541
5854
  source: { required: false, type: String },
@@ -5544,7 +5857,7 @@ var ResourceImageTypeSchema = new MongooseSchema6(
5544
5857
  { _id: false }
5545
5858
  // Prevents Mongoose from creating an additional _id field for subdocuments
5546
5859
  );
5547
- var SubCategorySchema = new MongooseSchema6(
5860
+ var SubCategorySchema = new MongooseSchema7(
5548
5861
  {
5549
5862
  id: { required: false, type: String },
5550
5863
  items: [
@@ -5558,7 +5871,7 @@ var SubCategorySchema = new MongooseSchema6(
5558
5871
  { _id: false }
5559
5872
  // Prevents Mongoose from creating an additional _id field for subdocuments
5560
5873
  );
5561
- var CategorySchema = new MongooseSchema6(
5874
+ var CategorySchema = new MongooseSchema7(
5562
5875
  {
5563
5876
  id: { required: true, type: String },
5564
5877
  name: { required: true, type: String },
@@ -5567,7 +5880,7 @@ var CategorySchema = new MongooseSchema6(
5567
5880
  { _id: false }
5568
5881
  // Prevents Mongoose from creating an additional _id field for subdocuments
5569
5882
  );
5570
- var PosterUsageTypeSchema = new MongooseSchema6(
5883
+ var PosterUsageTypeSchema = new MongooseSchema7(
5571
5884
  {
5572
5885
  count: { default: 0, required: false, type: Number },
5573
5886
  month: { required: false, type: String }
@@ -5575,7 +5888,7 @@ var PosterUsageTypeSchema = new MongooseSchema6(
5575
5888
  { _id: false }
5576
5889
  // Prevents Mongoose from creating an additional _id field for subdocuments
5577
5890
  );
5578
- var userLicenseSchema = new MongooseSchema6(
5891
+ var userLicenseSchema = new MongooseSchema7(
5579
5892
  {
5580
5893
  expiryDate: { required: true, type: Date },
5581
5894
  issuedDate: { required: true, type: Date },
@@ -5592,7 +5905,7 @@ var userLicenseSchema = new MongooseSchema6(
5592
5905
  },
5593
5906
  { _id: false, timestamps: false }
5594
5907
  );
5595
- var ContactDetailsSchema = new MongooseSchema6(
5908
+ var ContactDetailsSchema = new MongooseSchema7(
5596
5909
  {
5597
5910
  email: { required: false, type: String },
5598
5911
  landlinePhone: { required: false, type: String },
@@ -5601,7 +5914,7 @@ var ContactDetailsSchema = new MongooseSchema6(
5601
5914
  { _id: false }
5602
5915
  // Prevents Mongoose from creating an additional _id field for subdocuments
5603
5916
  );
5604
- var termsAgreementSchema = new MongooseSchema6(
5917
+ var termsAgreementSchema = new MongooseSchema7(
5605
5918
  {
5606
5919
  appBuildNumber: { required: true, type: String },
5607
5920
  appId: { required: true, type: String },
@@ -5618,7 +5931,7 @@ var termsAgreementSchema = new MongooseSchema6(
5618
5931
  },
5619
5932
  { _id: false }
5620
5933
  );
5621
- var resourceRelationsSchema = new MongooseSchema6(
5934
+ var resourceRelationsSchema = new MongooseSchema7(
5622
5935
  {
5623
5936
  relationDates: {
5624
5937
  default: [],
@@ -5628,12 +5941,12 @@ var resourceRelationsSchema = new MongooseSchema6(
5628
5941
  relationId: {
5629
5942
  ref: "Relation",
5630
5943
  required: false,
5631
- type: mongoose6.Schema.Types.ObjectId
5944
+ type: mongoose7.Schema.Types.ObjectId
5632
5945
  }
5633
5946
  },
5634
5947
  { _id: false }
5635
5948
  );
5636
- var dateTimeSchema2 = new MongooseSchema6(
5949
+ var dateTimeSchema2 = new MongooseSchema7(
5637
5950
  {
5638
5951
  dateStatus: {
5639
5952
  enum: Object.values(EnumEventDateStatus),
@@ -5648,7 +5961,7 @@ var dateTimeSchema2 = new MongooseSchema6(
5648
5961
  { _id: false }
5649
5962
  // Prevents Mongoose from creating an additional _id field for subdocuments
5650
5963
  );
5651
- var locationGeoSchema = new MongooseSchema6(
5964
+ var locationGeoSchema = new MongooseSchema7(
5652
5965
  {
5653
5966
  coordinates: { required: true, type: [Number] },
5654
5967
  // [longitude, latitude]
@@ -5657,7 +5970,7 @@ var locationGeoSchema = new MongooseSchema6(
5657
5970
  { _id: false }
5658
5971
  // Prevents Mongoose from creating an additional _id field for subdocuments
5659
5972
  );
5660
- var locationsSchema = new MongooseSchema6(
5973
+ var locationsSchema = new MongooseSchema7(
5661
5974
  {
5662
5975
  city: { required: true, type: String },
5663
5976
  country: { required: true, type: String },
@@ -5673,13 +5986,13 @@ var locationsSchema = new MongooseSchema6(
5673
5986
  { _id: false }
5674
5987
  // Prevents Mongoose from creating an additional _id field for subdocuments
5675
5988
  );
5676
- var relatedPostSchema = new MongooseSchema6(
5989
+ var relatedPostSchema = new MongooseSchema7(
5677
5990
  {
5678
5991
  postActive: { default: true, required: true, type: Boolean },
5679
5992
  postId: {
5680
5993
  ref: "Post",
5681
5994
  required: true,
5682
- type: mongoose6.Schema.Types.ObjectId
5995
+ type: mongoose7.Schema.Types.ObjectId
5683
5996
  },
5684
5997
  postSlug: { required: true, type: String },
5685
5998
  postType: {
@@ -5691,7 +6004,7 @@ var relatedPostSchema = new MongooseSchema6(
5691
6004
  { _id: false }
5692
6005
  // Prevents Mongoose from creating an additional _id field for subdocuments
5693
6006
  );
5694
- var socialShareResourceSchema = new MongooseSchema6(
6007
+ var socialShareResourceSchema = new MongooseSchema7(
5695
6008
  {
5696
6009
  qrCode: { required: true, type: ResourceImageTypeSchema },
5697
6010
  socialImage: { required: true, type: ResourceImageTypeSchema }
@@ -5704,7 +6017,7 @@ var baseResourceFields = {
5704
6017
  adIds: {
5705
6018
  ref: "Ad",
5706
6019
  required: false,
5707
- type: [mongoose6.Schema.Types.ObjectId]
6020
+ type: [mongoose7.Schema.Types.ObjectId]
5708
6021
  },
5709
6022
  approvedAt: { default: null, required: false, type: Date },
5710
6023
  contactDetails: { required: false, type: ContactDetailsSchema },
@@ -5734,9 +6047,9 @@ var baseResourceFields = {
5734
6047
  };
5735
6048
 
5736
6049
  // src/mongoose/GoogleImportedMarket.ts
5737
- import mongoose7 from "mongoose";
5738
- var MongooseSchema7 = mongoose7.Schema;
5739
- var addressComponentSchema = new MongooseSchema7(
6050
+ import mongoose8 from "mongoose";
6051
+ var MongooseSchema8 = mongoose8.Schema;
6052
+ var addressComponentSchema = new MongooseSchema8(
5740
6053
  {
5741
6054
  longName: { required: false, type: String },
5742
6055
  shortName: { required: false, type: String },
@@ -5744,7 +6057,7 @@ var addressComponentSchema = new MongooseSchema7(
5744
6057
  },
5745
6058
  { _id: false }
5746
6059
  );
5747
- var schema3 = new MongooseSchema7(
6060
+ var schema4 = new MongooseSchema8(
5748
6061
  {
5749
6062
  active: { default: false, required: true, type: Boolean },
5750
6063
  address: { required: true, type: String },
@@ -5756,7 +6069,7 @@ var schema3 = new MongooseSchema7(
5756
6069
  claimedByUserId: {
5757
6070
  ref: "User",
5758
6071
  required: false,
5759
- type: mongoose7.Schema.Types.ObjectId
6072
+ type: mongoose8.Schema.Types.ObjectId
5760
6073
  },
5761
6074
  cover: {
5762
6075
  required: false,
@@ -5768,7 +6081,7 @@ var schema3 = new MongooseSchema7(
5768
6081
  eventId: {
5769
6082
  ref: "Event",
5770
6083
  required: false,
5771
- type: mongoose7.Schema.Types.ObjectId
6084
+ type: mongoose8.Schema.Types.ObjectId
5772
6085
  },
5773
6086
  eventType: {
5774
6087
  enum: Object.values(EnumEventType),
@@ -5807,18 +6120,18 @@ var schema3 = new MongooseSchema7(
5807
6120
  },
5808
6121
  { timestamps: true }
5809
6122
  );
5810
- schema3.index({ "location.geo": "2dsphere" });
5811
- schema3.index({ name: 1 });
5812
- schema3.index({ region: 1 });
5813
- schema3.index({ deletedAt: 1 });
5814
- schema3.index({ "dateTime.dateStatus": 1 });
5815
- schema3.index({ slug: 1 });
5816
- var GoogleImportedMarketModel = mongoose7.models.GoogleImportedMarket || mongoose7.model("GoogleImportedMarket", schema3);
6123
+ schema4.index({ "location.geo": "2dsphere" });
6124
+ schema4.index({ name: 1 });
6125
+ schema4.index({ region: 1 });
6126
+ schema4.index({ deletedAt: 1 });
6127
+ schema4.index({ "dateTime.dateStatus": 1 });
6128
+ schema4.index({ slug: 1 });
6129
+ var GoogleImportedMarketModel = mongoose8.models.GoogleImportedMarket || mongoose8.model("GoogleImportedMarket", schema4);
5817
6130
 
5818
6131
  // src/mongoose/Notification.ts
5819
- import mongoose8 from "mongoose";
5820
- var MongooseSchema8 = mongoose8.Schema;
5821
- var schema4 = new MongooseSchema8(
6132
+ import mongoose9 from "mongoose";
6133
+ var MongooseSchema9 = mongoose9.Schema;
6134
+ var schema5 = new MongooseSchema9(
5822
6135
  {
5823
6136
  data: {
5824
6137
  resourceId: { required: true, type: String },
@@ -5841,16 +6154,16 @@ var schema4 = new MongooseSchema8(
5841
6154
  userId: {
5842
6155
  ref: "User",
5843
6156
  required: true,
5844
- type: mongoose8.Schema.Types.ObjectId
6157
+ type: mongoose9.Schema.Types.ObjectId
5845
6158
  }
5846
6159
  },
5847
6160
  { timestamps: true }
5848
6161
  );
5849
- schema4.index({ isRead: 1, userId: 1 });
5850
- schema4.index({ createdAt: -1, userId: 1 });
5851
- var NotificationModel = mongoose8.models.Notification || mongoose8.model("Notification", schema4);
6162
+ schema5.index({ isRead: 1, userId: 1 });
6163
+ schema5.index({ createdAt: -1, userId: 1 });
6164
+ var NotificationModel = mongoose9.models.Notification || mongoose9.model("Notification", schema5);
5852
6165
 
5853
- // node_modules/@timardex/cluemart-shared/dist/chunk-7IB7QPVH.mjs
6166
+ // node_modules/@timardex/cluemart-shared/dist/chunk-P4NLBWEJ.mjs
5854
6167
  var EnumInviteStatus2 = /* @__PURE__ */ ((EnumInviteStatus22) => {
5855
6168
  EnumInviteStatus22["ACCEPTED"] = "Accepted";
5856
6169
  EnumInviteStatus22["COMPLETED"] = "Completed";
@@ -5928,9 +6241,9 @@ var EnumSubscriptionStatus2 = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
5928
6241
  })(EnumSubscriptionStatus2 || {});
5929
6242
 
5930
6243
  // src/mongoose/PushToken.ts
5931
- import mongoose9 from "mongoose";
5932
- var MongooseSchema9 = mongoose9.Schema;
5933
- var schema5 = new MongooseSchema9(
6244
+ import mongoose10 from "mongoose";
6245
+ var MongooseSchema10 = mongoose10.Schema;
6246
+ var schema6 = new MongooseSchema10(
5934
6247
  {
5935
6248
  platform: {
5936
6249
  enum: Object.values(EnumOSPlatform2),
@@ -5941,17 +6254,17 @@ var schema5 = new MongooseSchema9(
5941
6254
  userId: {
5942
6255
  ref: "User",
5943
6256
  required: true,
5944
- type: mongoose9.Schema.Types.ObjectId
6257
+ type: mongoose10.Schema.Types.ObjectId
5945
6258
  }
5946
6259
  },
5947
6260
  { timestamps: true }
5948
6261
  );
5949
- var PushTokenModel = mongoose9.models.PushToken || mongoose9.model("PushToken", schema5);
6262
+ var PushTokenModel = mongoose10.models.PushToken || mongoose10.model("PushToken", schema6);
5950
6263
 
5951
6264
  // src/mongoose/ResourceActivity.ts
5952
- import mongoose10 from "mongoose";
5953
- var MongooseSchema10 = mongoose10.Schema;
5954
- var ActivitySchema = new MongooseSchema10(
6265
+ import mongoose11 from "mongoose";
6266
+ var MongooseSchema11 = mongoose11.Schema;
6267
+ var ActivitySchema = new MongooseSchema11(
5955
6268
  {
5956
6269
  activityType: {
5957
6270
  enum: Object.values(EnumActivity),
@@ -5979,7 +6292,7 @@ var ActivitySchema = new MongooseSchema10(
5979
6292
  },
5980
6293
  { _id: false }
5981
6294
  );
5982
- var schema6 = new MongooseSchema10(
6295
+ var schema7 = new MongooseSchema11(
5983
6296
  {
5984
6297
  activity: { default: [], type: [ActivitySchema] },
5985
6298
  resourceId: { required: true, type: String },
@@ -5991,46 +6304,55 @@ var schema6 = new MongooseSchema10(
5991
6304
  },
5992
6305
  { timestamps: true }
5993
6306
  );
5994
- schema6.index({ resourceId: 1, resourceType: 1 }, { unique: true });
5995
- schema6.index({ "views.location": "2dsphere" });
5996
- var ResourceActivityModel = mongoose10.models.ResourceActivity || mongoose10.model("ResourceActivity", schema6);
6307
+ schema7.index({ resourceId: 1, resourceType: 1 }, { unique: true });
6308
+ schema7.index({ "views.location": "2dsphere" });
6309
+ var ResourceActivityModel = mongoose11.models.ResourceActivity || mongoose11.model("ResourceActivity", schema7);
5997
6310
 
5998
6311
  // src/mongoose/User.ts
5999
- import mongoose11 from "mongoose";
6000
- var MongooseSchema11 = mongoose11.Schema;
6001
- var userActivityEventSchema = new MongooseSchema11(
6312
+ import mongoose12 from "mongoose";
6313
+ var MongooseSchema12 = mongoose12.Schema;
6314
+ var userActivityEventSchema = new MongooseSchema12(
6002
6315
  {
6003
6316
  dateTime: dateTimeSchema2,
6004
6317
  resourceId: {
6005
6318
  ref: "Event",
6006
6319
  required: false,
6007
- type: mongoose11.Schema.Types.ObjectId
6320
+ type: mongoose12.Schema.Types.ObjectId
6008
6321
  }
6009
6322
  },
6010
6323
  { _id: false }
6011
6324
  );
6012
- var userActivityFavouritesSchema = new MongooseSchema11(
6325
+ var userActivityFavouritesSchema = new MongooseSchema12(
6013
6326
  {
6014
6327
  events: {
6015
6328
  ref: "Event",
6016
6329
  required: false,
6017
- type: [mongoose11.Schema.Types.ObjectId]
6330
+ type: [mongoose12.Schema.Types.ObjectId]
6018
6331
  },
6019
6332
  partners: {
6020
6333
  ref: "Partner",
6021
6334
  required: false,
6022
- type: [mongoose11.Schema.Types.ObjectId]
6335
+ type: [mongoose12.Schema.Types.ObjectId]
6023
6336
  },
6024
6337
  vendors: {
6025
6338
  ref: "Vendor",
6026
6339
  required: false,
6027
- type: [mongoose11.Schema.Types.ObjectId]
6340
+ type: [mongoose12.Schema.Types.ObjectId]
6028
6341
  }
6029
6342
  },
6030
6343
  { _id: false }
6031
6344
  );
6032
- var stripeSchema = new MongooseSchema11(
6345
+ var stripeSchema = new MongooseSchema12(
6033
6346
  {
6347
+ billingPeriod: {
6348
+ enum: Object.values(EnumBillingPeriod),
6349
+ required: false,
6350
+ type: String
6351
+ },
6352
+ cancelAtPeriodEnd: {
6353
+ required: false,
6354
+ type: Boolean
6355
+ },
6034
6356
  currentPlan: {
6035
6357
  enum: Object.values(EnumUserLicence),
6036
6358
  required: false,
@@ -6044,6 +6366,28 @@ var stripeSchema = new MongooseSchema11(
6044
6366
  required: false,
6045
6367
  type: Date
6046
6368
  },
6369
+ pendingBillingPeriod: {
6370
+ enum: Object.values(EnumBillingPeriod),
6371
+ required: false,
6372
+ type: String
6373
+ },
6374
+ pendingChangeEffectiveAt: {
6375
+ required: false,
6376
+ type: Date
6377
+ },
6378
+ pendingPlan: {
6379
+ enum: Object.values(EnumUserLicence),
6380
+ required: false,
6381
+ type: String
6382
+ },
6383
+ priceId: {
6384
+ required: false,
6385
+ type: String
6386
+ },
6387
+ scheduleId: {
6388
+ required: false,
6389
+ type: String
6390
+ },
6047
6391
  startDate: {
6048
6392
  required: false,
6049
6393
  type: Date
@@ -6056,11 +6400,19 @@ var stripeSchema = new MongooseSchema11(
6056
6400
  subscriptionId: {
6057
6401
  required: false,
6058
6402
  type: String
6403
+ },
6404
+ subscriptionMutationLockExpiresAt: {
6405
+ required: false,
6406
+ type: Date
6407
+ },
6408
+ subscriptionMutationLockId: {
6409
+ required: false,
6410
+ type: String
6059
6411
  }
6060
6412
  },
6061
6413
  { _id: false }
6062
6414
  );
6063
- var redeemedRewardSchema = new MongooseSchema11(
6415
+ var redeemedRewardSchema = new MongooseSchema12(
6064
6416
  {
6065
6417
  name: {
6066
6418
  enum: Object.values(EnumReward),
@@ -6072,13 +6424,13 @@ var redeemedRewardSchema = new MongooseSchema11(
6072
6424
  },
6073
6425
  { _id: false }
6074
6426
  );
6075
- var schema7 = new MongooseSchema11(
6427
+ var schema8 = new MongooseSchema12(
6076
6428
  {
6077
6429
  active: { default: false, required: true, type: Boolean },
6078
6430
  affiliate: {
6079
6431
  ref: "Affiliate",
6080
6432
  required: false,
6081
- type: mongoose11.Schema.Types.ObjectId
6433
+ type: mongoose12.Schema.Types.ObjectId
6082
6434
  },
6083
6435
  avatar: {
6084
6436
  required: false,
@@ -6087,7 +6439,7 @@ var schema7 = new MongooseSchema11(
6087
6439
  coupon: {
6088
6440
  ref: "Coupon",
6089
6441
  required: false,
6090
- type: mongoose11.Schema.Types.ObjectId
6442
+ type: mongoose12.Schema.Types.ObjectId
6091
6443
  },
6092
6444
  deletedAt: { default: null, required: false, type: Date },
6093
6445
  email: { required: true, type: String },
@@ -6099,13 +6451,13 @@ var schema7 = new MongooseSchema11(
6099
6451
  events: {
6100
6452
  ref: "Event",
6101
6453
  required: false,
6102
- type: [mongoose11.Schema.Types.ObjectId]
6454
+ type: [mongoose12.Schema.Types.ObjectId]
6103
6455
  },
6104
6456
  firstName: { required: true, type: String },
6105
6457
  game: {
6106
6458
  ref: "Game",
6107
6459
  required: false,
6108
- type: mongoose11.Schema.Types.ObjectId
6460
+ type: mongoose12.Schema.Types.ObjectId
6109
6461
  },
6110
6462
  interests: {
6111
6463
  enum: Object.values(EnumResourceType),
@@ -6127,7 +6479,7 @@ var schema7 = new MongooseSchema11(
6127
6479
  partner: {
6128
6480
  ref: "Partner",
6129
6481
  required: false,
6130
- type: mongoose11.Schema.Types.ObjectId
6482
+ type: mongoose12.Schema.Types.ObjectId
6131
6483
  },
6132
6484
  password: { required: true, type: String },
6133
6485
  platform: {
@@ -6160,7 +6512,7 @@ var schema7 = new MongooseSchema11(
6160
6512
  school: {
6161
6513
  ref: "School",
6162
6514
  required: false,
6163
- type: mongoose11.Schema.Types.ObjectId
6515
+ type: mongoose12.Schema.Types.ObjectId
6164
6516
  },
6165
6517
  stripe: {
6166
6518
  required: false,
@@ -6185,19 +6537,19 @@ var schema7 = new MongooseSchema11(
6185
6537
  vendor: {
6186
6538
  ref: "Vendor",
6187
6539
  required: false,
6188
- type: mongoose11.Schema.Types.ObjectId
6540
+ type: mongoose12.Schema.Types.ObjectId
6189
6541
  }
6190
6542
  },
6191
6543
  { strict: false, timestamps: true }
6192
6544
  );
6193
- schema7.index({ "licences.expiryDate": 1 });
6194
- schema7.index({ "licences.licenceType": 1 });
6195
- var UserModel = mongoose11.models.User || mongoose11.model("User", schema7);
6545
+ schema8.index({ "licences.expiryDate": 1 });
6546
+ schema8.index({ "licences.licenceType": 1 });
6547
+ var UserModel = mongoose12.models.User || mongoose12.model("User", schema8);
6196
6548
 
6197
6549
  // src/mongoose/VerificationToken.ts
6198
- import mongoose12 from "mongoose";
6199
- var MongooseSchema12 = mongoose12.Schema;
6200
- var schema8 = new MongooseSchema12(
6550
+ import mongoose13 from "mongoose";
6551
+ var MongooseSchema13 = mongoose13.Schema;
6552
+ var schema9 = new MongooseSchema13(
6201
6553
  {
6202
6554
  createdAt: {
6203
6555
  default: Date.now,
@@ -6212,12 +6564,12 @@ var schema8 = new MongooseSchema12(
6212
6564
  },
6213
6565
  { timestamps: true }
6214
6566
  );
6215
- var VerificationTokenModel = mongoose12.models.VerificationToken || mongoose12.model("VerificationToken", schema8);
6567
+ var VerificationTokenModel = mongoose13.models.VerificationToken || mongoose13.model("VerificationToken", schema9);
6216
6568
 
6217
6569
  // src/mongoose/vendor/Vendor.ts
6218
- import mongoose13 from "mongoose";
6219
- var MongooseSchema13 = mongoose13.Schema;
6220
- var vendorProductTypeSchema = new MongooseSchema13(
6570
+ import mongoose14 from "mongoose";
6571
+ var MongooseSchema14 = mongoose14.Schema;
6572
+ var vendorProductTypeSchema = new MongooseSchema14(
6221
6573
  {
6222
6574
  description: { required: false, type: String },
6223
6575
  name: { required: true, type: String },
@@ -6228,14 +6580,14 @@ var vendorProductTypeSchema = new MongooseSchema13(
6228
6580
  },
6229
6581
  { timestamps: true }
6230
6582
  );
6231
- var productWrapperSchema = new MongooseSchema13(
6583
+ var productWrapperSchema = new MongooseSchema14(
6232
6584
  {
6233
6585
  active: { default: false, required: false, type: Boolean },
6234
6586
  productsList: { required: false, type: [vendorProductTypeSchema] }
6235
6587
  },
6236
6588
  { _id: false }
6237
6589
  );
6238
- var calendarSchema = new MongooseSchema13(
6590
+ var calendarSchema = new MongooseSchema14(
6239
6591
  {
6240
6592
  dateTime: {
6241
6593
  dateStatus: {
@@ -6256,14 +6608,14 @@ var calendarSchema = new MongooseSchema13(
6256
6608
  },
6257
6609
  { _id: false }
6258
6610
  );
6259
- var calendarWrapperSchema = new MongooseSchema13(
6611
+ var calendarWrapperSchema = new MongooseSchema14(
6260
6612
  {
6261
6613
  active: { default: false, required: true, type: Boolean },
6262
6614
  calendarData: { required: false, type: [calendarSchema] }
6263
6615
  },
6264
6616
  { _id: false }
6265
6617
  );
6266
- var schema9 = new MongooseSchema13(
6618
+ var schema10 = new MongooseSchema14(
6267
6619
  {
6268
6620
  ...baseResourceFields,
6269
6621
  // Importing base resource fields from global.ts
@@ -6289,12 +6641,12 @@ var schema9 = new MongooseSchema13(
6289
6641
  unregisteredVendorId: {
6290
6642
  ref: "UnregisteredVendor",
6291
6643
  required: false,
6292
- type: mongoose13.Schema.Types.ObjectId
6644
+ type: mongoose14.Schema.Types.ObjectId
6293
6645
  },
6294
6646
  vendorInfoId: {
6295
6647
  ref: "VendorInfo",
6296
6648
  required: false,
6297
- type: mongoose13.Schema.Types.ObjectId
6649
+ type: mongoose14.Schema.Types.ObjectId
6298
6650
  },
6299
6651
  vendorType: {
6300
6652
  enum: Object.values(EnumVendorType),
@@ -6304,24 +6656,24 @@ var schema9 = new MongooseSchema13(
6304
6656
  },
6305
6657
  { timestamps: true }
6306
6658
  );
6307
- schema9.index({ name: 1 });
6308
- schema9.index({ description: 1 });
6309
- schema9.index({ region: 1 });
6310
- schema9.index({ "categories.name": 1 });
6311
- schema9.index({ slug: 1 });
6312
- var VendorModel = mongoose13.models.Vendor || mongoose13.model("Vendor", schema9);
6659
+ schema10.index({ name: 1 });
6660
+ schema10.index({ description: 1 });
6661
+ schema10.index({ region: 1 });
6662
+ schema10.index({ "categories.name": 1 });
6663
+ schema10.index({ slug: 1 });
6664
+ var VendorModel = mongoose14.models.Vendor || mongoose14.model("Vendor", schema10);
6313
6665
 
6314
6666
  // src/mongoose/vendor/VendorInfo.ts
6315
- import mongoose14 from "mongoose";
6316
- var MongooseSchema14 = mongoose14.Schema;
6317
- var AttributesSchema = new MongooseSchema14(
6667
+ import mongoose15 from "mongoose";
6668
+ var MongooseSchema15 = mongoose15.Schema;
6669
+ var AttributesSchema = new MongooseSchema15(
6318
6670
  {
6319
6671
  details: { required: false, type: String },
6320
6672
  isRequired: { default: false, required: true, type: Boolean }
6321
6673
  },
6322
6674
  { _id: false }
6323
6675
  );
6324
- var schema10 = new MongooseSchema14(
6676
+ var schema11 = new MongooseSchema15(
6325
6677
  {
6326
6678
  active: { default: true, type: Boolean },
6327
6679
  compliance: {
@@ -6356,28 +6708,28 @@ var schema10 = new MongooseSchema14(
6356
6708
  vendorId: {
6357
6709
  ref: "Vendor",
6358
6710
  required: true,
6359
- type: mongoose14.Schema.Types.ObjectId
6711
+ type: mongoose15.Schema.Types.ObjectId
6360
6712
  }
6361
6713
  },
6362
6714
  { timestamps: true }
6363
6715
  );
6364
- var VendorInfoModel = mongoose14.models.VendorInfo || mongoose14.model("VendorInfo", schema10);
6716
+ var VendorInfoModel = mongoose15.models.VendorInfo || mongoose15.model("VendorInfo", schema11);
6365
6717
 
6366
6718
  // src/mongoose/vendor/UnregisteredVendor.ts
6367
- import mongoose15 from "mongoose";
6368
- var MongooseSchema15 = mongoose15.Schema;
6369
- var invitationSchema = new MongooseSchema15(
6719
+ import mongoose16 from "mongoose";
6720
+ var MongooseSchema16 = mongoose16.Schema;
6721
+ var invitationSchema = new MongooseSchema16(
6370
6722
  {
6371
6723
  dateTime: { required: true, type: [dateTimeSchema2] },
6372
6724
  inviterId: {
6373
6725
  ref: "Event",
6374
6726
  required: true,
6375
- type: mongoose15.Schema.Types.ObjectId
6727
+ type: mongoose16.Schema.Types.ObjectId
6376
6728
  }
6377
6729
  },
6378
6730
  { _id: false }
6379
6731
  );
6380
- var schema11 = new MongooseSchema15(
6732
+ var schema12 = new MongooseSchema16(
6381
6733
  {
6382
6734
  active: { default: true, required: true, type: Boolean },
6383
6735
  categoryIds: { required: true, type: [String] },
@@ -6386,7 +6738,7 @@ var schema11 = new MongooseSchema15(
6386
6738
  claimedByUserId: {
6387
6739
  ref: "User",
6388
6740
  required: false,
6389
- type: mongoose15.Schema.Types.ObjectId
6741
+ type: mongoose16.Schema.Types.ObjectId
6390
6742
  },
6391
6743
  claimInitiatedAt: { default: null, required: false, type: Date },
6392
6744
  claimToken: { default: null, required: false, type: String },
@@ -6399,14 +6751,14 @@ var schema11 = new MongooseSchema15(
6399
6751
  },
6400
6752
  { timestamps: true }
6401
6753
  );
6402
- schema11.index({ name: 1 });
6403
- schema11.index({ email: 1 });
6404
- var UnregisteredVendorModel = mongoose15.models.UnregisteredVendor || mongoose15.model("UnregisteredVendor", schema11);
6754
+ schema12.index({ name: 1 });
6755
+ schema12.index({ email: 1 });
6756
+ var UnregisteredVendorModel = mongoose16.models.UnregisteredVendor || mongoose16.model("UnregisteredVendor", schema12);
6405
6757
 
6406
6758
  // src/mongoose/event/Event.ts
6407
- import mongoose16 from "mongoose";
6408
- var MongooseSchema16 = mongoose16.Schema;
6409
- var schema12 = new MongooseSchema16(
6759
+ import mongoose17 from "mongoose";
6760
+ var MongooseSchema17 = mongoose17.Schema;
6761
+ var schema13 = new MongooseSchema17(
6410
6762
  {
6411
6763
  ...baseResourceFields,
6412
6764
  // Importing base resource fields from global.ts
@@ -6415,7 +6767,7 @@ var schema12 = new MongooseSchema16(
6415
6767
  eventInfoId: {
6416
6768
  ref: "EventInfo",
6417
6769
  required: false,
6418
- type: mongoose16.Schema.Types.ObjectId
6770
+ type: mongoose17.Schema.Types.ObjectId
6419
6771
  },
6420
6772
  eventType: {
6421
6773
  enum: Object.values(EnumEventType),
@@ -6444,20 +6796,20 @@ var schema12 = new MongooseSchema16(
6444
6796
  },
6445
6797
  { timestamps: true }
6446
6798
  );
6447
- schema12.index({ name: 1 });
6448
- schema12.index({ description: 1 });
6449
- schema12.index({ region: 1 });
6450
- schema12.index({ "location.geo": "2dsphere" });
6451
- schema12.index({ tags: 1 });
6452
- schema12.index({ deletedAt: 1 });
6453
- schema12.index({ "dateTime.dateStatus": 1 });
6454
- schema12.index({ slug: 1 });
6455
- var EventModel = mongoose16.models.Event || mongoose16.model("Event", schema12);
6799
+ schema13.index({ name: 1 });
6800
+ schema13.index({ description: 1 });
6801
+ schema13.index({ region: 1 });
6802
+ schema13.index({ "location.geo": "2dsphere" });
6803
+ schema13.index({ tags: 1 });
6804
+ schema13.index({ deletedAt: 1 });
6805
+ schema13.index({ "dateTime.dateStatus": 1 });
6806
+ schema13.index({ slug: 1 });
6807
+ var EventModel = mongoose17.models.Event || mongoose17.model("Event", schema13);
6456
6808
 
6457
6809
  // src/mongoose/Partner.ts
6458
- import mongoose17 from "mongoose";
6459
- var MongooseSchema17 = mongoose17.Schema;
6460
- var schema13 = new MongooseSchema17(
6810
+ import mongoose18 from "mongoose";
6811
+ var MongooseSchema18 = mongoose18.Schema;
6812
+ var schema14 = new MongooseSchema18(
6461
6813
  {
6462
6814
  ...baseResourceFields,
6463
6815
  location: {
@@ -6473,17 +6825,17 @@ var schema13 = new MongooseSchema17(
6473
6825
  },
6474
6826
  { timestamps: true }
6475
6827
  );
6476
- schema13.index({ name: 1 });
6477
- schema13.index({ description: 1 });
6478
- schema13.index({ region: 1 });
6479
- schema13.index({ "location.geo": "2dsphere" });
6480
- schema13.index({ slug: 1 });
6481
- var PartnerModel = mongoose17.models.Partner || mongoose17.model("Partner", schema13);
6828
+ schema14.index({ name: 1 });
6829
+ schema14.index({ description: 1 });
6830
+ schema14.index({ region: 1 });
6831
+ schema14.index({ "location.geo": "2dsphere" });
6832
+ schema14.index({ slug: 1 });
6833
+ var PartnerModel = mongoose18.models.Partner || mongoose18.model("Partner", schema14);
6482
6834
 
6483
6835
  // src/mongoose/Post.ts
6484
- import mongoose18, { Schema } from "mongoose";
6485
- var MongooseSchema18 = mongoose18.Schema;
6486
- var contentSchema = new MongooseSchema18(
6836
+ import mongoose19, { Schema } from "mongoose";
6837
+ var MongooseSchema19 = mongoose19.Schema;
6838
+ var contentSchema = new MongooseSchema19(
6487
6839
  {
6488
6840
  contentData: Schema.Types.Mixed,
6489
6841
  contentOrder: { required: true, type: Number },
@@ -6495,7 +6847,7 @@ var contentSchema = new MongooseSchema18(
6495
6847
  },
6496
6848
  { _id: false }
6497
6849
  );
6498
- var resourceSchema = new MongooseSchema18(
6850
+ var resourceSchema = new MongooseSchema19(
6499
6851
  {
6500
6852
  resourceId: { required: true, type: String },
6501
6853
  resourceRegion: { required: true, type: String },
@@ -6508,7 +6860,7 @@ var resourceSchema = new MongooseSchema18(
6508
6860
  },
6509
6861
  { _id: false }
6510
6862
  );
6511
- var schema14 = new MongooseSchema18(
6863
+ var schema15 = new MongooseSchema19(
6512
6864
  {
6513
6865
  active: { default: false, required: true, type: Boolean },
6514
6866
  approvedAt: { default: null, required: false, type: Date },
@@ -6539,16 +6891,16 @@ var schema14 = new MongooseSchema18(
6539
6891
  },
6540
6892
  { timestamps: true }
6541
6893
  );
6542
- schema14.index({ title: 1 });
6543
- schema14.index({ tags: 1 });
6544
- schema14.index({ postType: 1, slug: 1 }, { unique: true });
6545
- var PostModel = mongoose18.models.Post || mongoose18.model("Post", schema14);
6894
+ schema15.index({ title: 1 });
6895
+ schema15.index({ tags: 1 });
6896
+ schema15.index({ postType: 1, slug: 1 }, { unique: true });
6897
+ var PostModel = mongoose19.models.Post || mongoose19.model("Post", schema15);
6546
6898
 
6547
6899
  // src/mongoose/AppSetting.ts
6548
- import mongoose19 from "mongoose";
6549
- var MongooseSchema19 = mongoose19.Schema;
6900
+ import mongoose20 from "mongoose";
6901
+ var MongooseSchema20 = mongoose20.Schema;
6550
6902
  var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
6551
- var AppSettingSchema = new MongooseSchema19(
6903
+ var AppSettingSchema = new MongooseSchema20(
6552
6904
  {
6553
6905
  activeSchoolsStudentCountTotal: {
6554
6906
  default: 0,
@@ -6579,18 +6931,18 @@ var AppSettingSchema = new MongooseSchema19(
6579
6931
  },
6580
6932
  { timestamps: true }
6581
6933
  );
6582
- var AppSettingModel = mongoose19.models.AppSetting || mongoose19.model("AppSetting", AppSettingSchema);
6934
+ var AppSettingModel = mongoose20.models.AppSetting || mongoose20.model("AppSetting", AppSettingSchema);
6583
6935
 
6584
6936
  // src/mongoose/game/Game.ts
6585
- import mongoose23 from "mongoose";
6937
+ import mongoose24 from "mongoose";
6586
6938
 
6587
6939
  // src/mongoose/game/DailyClue.ts
6588
- import mongoose21 from "mongoose";
6940
+ import mongoose22 from "mongoose";
6589
6941
 
6590
6942
  // src/mongoose/game/utils.ts
6591
- import mongoose20 from "mongoose";
6592
- var MongooseSchema20 = mongoose20.Schema;
6593
- var schemaGameDate = new MongooseSchema20(
6943
+ import mongoose21 from "mongoose";
6944
+ var MongooseSchema21 = mongoose21.Schema;
6945
+ var schemaGameDate = new MongooseSchema21(
6594
6946
  {
6595
6947
  endDate: { required: true, type: Date },
6596
6948
  startDate: { required: true, type: Date }
@@ -6599,8 +6951,8 @@ var schemaGameDate = new MongooseSchema20(
6599
6951
  );
6600
6952
 
6601
6953
  // src/mongoose/game/DailyClue.ts
6602
- var MongooseSchema21 = mongoose21.Schema;
6603
- var schemaLetters = new MongooseSchema21(
6954
+ var MongooseSchema22 = mongoose22.Schema;
6955
+ var schemaLetters = new MongooseSchema22(
6604
6956
  {
6605
6957
  collected: { required: false, type: [String] },
6606
6958
  solutionShuffled: { required: true, type: [String] }
@@ -6608,14 +6960,14 @@ var schemaLetters = new MongooseSchema21(
6608
6960
  },
6609
6961
  { _id: false }
6610
6962
  );
6611
- var schemaDailyClueBaseGame = new MongooseSchema21(
6963
+ var schemaDailyClueBaseGame = new MongooseSchema22(
6612
6964
  {
6613
6965
  gameDate: { required: true, type: schemaGameDate },
6614
6966
  gameSolution: { required: true, type: String }
6615
6967
  },
6616
6968
  { _id: false }
6617
6969
  );
6618
- var schemaDailyClueGameData = new MongooseSchema21(
6970
+ var schemaDailyClueGameData = new MongooseSchema22(
6619
6971
  {
6620
6972
  gameFields: { required: true, type: schemaDailyClueBaseGame },
6621
6973
  lastFoundDate: { default: null, required: false, type: Date },
@@ -6630,9 +6982,9 @@ var schemaDailyClueGameData = new MongooseSchema21(
6630
6982
  );
6631
6983
 
6632
6984
  // src/mongoose/game/PuzzleGame.ts
6633
- import mongoose22 from "mongoose";
6634
- var MongooseSchema22 = mongoose22.Schema;
6635
- var schemaPuzzleAnswer = new MongooseSchema22(
6985
+ import mongoose23 from "mongoose";
6986
+ var MongooseSchema23 = mongoose23.Schema;
6987
+ var schemaPuzzleAnswer = new MongooseSchema23(
6636
6988
  {
6637
6989
  answer: { required: true, type: String },
6638
6990
  answerId: { required: true, type: String },
@@ -6640,7 +6992,7 @@ var schemaPuzzleAnswer = new MongooseSchema22(
6640
6992
  },
6641
6993
  { _id: false }
6642
6994
  );
6643
- var schemaPuzzleQuestion = new MongooseSchema22(
6995
+ var schemaPuzzleQuestion = new MongooseSchema23(
6644
6996
  {
6645
6997
  answers: { required: true, type: [schemaPuzzleAnswer] },
6646
6998
  question: { required: true, type: String },
@@ -6648,20 +7000,20 @@ var schemaPuzzleQuestion = new MongooseSchema22(
6648
7000
  },
6649
7001
  { _id: false }
6650
7002
  );
6651
- var schemaPuzzleBaseGame = new MongooseSchema22(
7003
+ var schemaPuzzleBaseGame = new MongooseSchema23(
6652
7004
  {
6653
7005
  questions: { required: true, type: [schemaPuzzleQuestion] }
6654
7006
  },
6655
7007
  { _id: false }
6656
7008
  );
6657
- var schemaPuzzleAnsweredQuestion = new MongooseSchema22(
7009
+ var schemaPuzzleAnsweredQuestion = new MongooseSchema23(
6658
7010
  {
6659
7011
  questionId: { required: true, type: String },
6660
7012
  selectedAnswerId: { required: true, type: String }
6661
7013
  },
6662
7014
  { _id: false }
6663
7015
  );
6664
- var schemaPuzzleGameData = new MongooseSchema22(
7016
+ var schemaPuzzleGameData = new MongooseSchema23(
6665
7017
  {
6666
7018
  answeredQuestions: {
6667
7019
  default: null,
@@ -6676,19 +7028,19 @@ var schemaPuzzleGameData = new MongooseSchema22(
6676
7028
  );
6677
7029
 
6678
7030
  // src/mongoose/game/Game.ts
6679
- var MongooseSchema23 = mongoose23.Schema;
7031
+ var MongooseSchema24 = mongoose24.Schema;
6680
7032
  var gameDataSchemas = {
6681
7033
  [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
6682
7034
  [EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
6683
7035
  [EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
6684
7036
  };
6685
7037
  var gameDataDefinition = Object.fromEntries(
6686
- Object.entries(gameDataSchemas).map(([key, schema19]) => [
7038
+ Object.entries(gameDataSchemas).map(([key, schema20]) => [
6687
7039
  key,
6688
- { default: null, required: false, type: schema19 }
7040
+ { default: null, required: false, type: schema20 }
6689
7041
  ])
6690
7042
  );
6691
- var gameHistorySchema = new MongooseSchema23(
7043
+ var gameHistorySchema = new MongooseSchema24(
6692
7044
  {
6693
7045
  createdAt: { required: true, type: Date },
6694
7046
  gameDate: { required: true, type: schemaGameDate },
@@ -6708,7 +7060,7 @@ var gameHistorySchema = new MongooseSchema23(
6708
7060
  },
6709
7061
  { _id: false }
6710
7062
  );
6711
- var gameTypeSchema = new MongooseSchema23(
7063
+ var gameTypeSchema = new MongooseSchema24(
6712
7064
  {
6713
7065
  active: { default: true, required: true, type: Boolean },
6714
7066
  gameData: gameDataDefinition,
@@ -6723,7 +7075,7 @@ var gameTypeSchema = new MongooseSchema23(
6723
7075
  },
6724
7076
  { timestamps: true }
6725
7077
  );
6726
- var schema15 = new MongooseSchema23(
7078
+ var schema16 = new MongooseSchema24(
6727
7079
  {
6728
7080
  active: { default: false, required: true, type: Boolean },
6729
7081
  deletedAt: { default: null, required: false, type: Date },
@@ -6736,12 +7088,12 @@ var schema15 = new MongooseSchema23(
6736
7088
  },
6737
7089
  { timestamps: true }
6738
7090
  );
6739
- var GameModel = mongoose23.models.Game || mongoose23.model("Game", schema15);
7091
+ var GameModel = mongoose24.models.Game || mongoose24.model("Game", schema16);
6740
7092
 
6741
7093
  // src/mongoose/School.ts
6742
- import mongoose24 from "mongoose";
6743
- var MongooseSchema24 = mongoose24.Schema;
6744
- var campaignsSchema = new MongooseSchema24(
7094
+ import mongoose25 from "mongoose";
7095
+ var MongooseSchema25 = mongoose25.Schema;
7096
+ var campaignsSchema = new MongooseSchema25(
6745
7097
  {
6746
7098
  endDate: { required: true, type: Date },
6747
7099
  name: { required: true, type: String },
@@ -6749,7 +7101,7 @@ var campaignsSchema = new MongooseSchema24(
6749
7101
  },
6750
7102
  { _id: false }
6751
7103
  );
6752
- var schema16 = new MongooseSchema24(
7104
+ var schema17 = new MongooseSchema25(
6753
7105
  {
6754
7106
  // New schools are active by default
6755
7107
  active: { default: false, required: true, type: Boolean },
@@ -6776,19 +7128,19 @@ var schema16 = new MongooseSchema24(
6776
7128
  },
6777
7129
  { timestamps: true }
6778
7130
  );
6779
- schema16.index(
7131
+ schema17.index(
6780
7132
  { schoolCode: 1 },
6781
7133
  {
6782
7134
  partialFilterExpression: { active: true, deletedAt: null },
6783
7135
  unique: true
6784
7136
  }
6785
7137
  );
6786
- var SchoolModel = mongoose24.models.School || mongoose24.model("School", schema16);
7138
+ var SchoolModel = mongoose25.models.School || mongoose25.model("School", schema17);
6787
7139
 
6788
7140
  // src/mongoose/Affiliate.ts
6789
- import mongoose25 from "mongoose";
6790
- var MongooseSchema25 = mongoose25.Schema;
6791
- var affiliateRewardSchema = new MongooseSchema25(
7141
+ import mongoose26 from "mongoose";
7142
+ var MongooseSchema26 = mongoose26.Schema;
7143
+ var affiliateRewardSchema = new MongooseSchema26(
6792
7144
  {
6793
7145
  createdAt: { required: true, type: Date },
6794
7146
  redeemedAt: { default: null, required: false, type: Date },
@@ -6802,13 +7154,13 @@ var affiliateRewardSchema = new MongooseSchema25(
6802
7154
  },
6803
7155
  { _id: false }
6804
7156
  );
6805
- var affiliateResourceSchema = new MongooseSchema25(
7157
+ var affiliateResourceSchema = new MongooseSchema26(
6806
7158
  {
6807
7159
  resourceActive: { default: true, required: true, type: Boolean },
6808
7160
  resourceDeletedAt: { default: null, required: false, type: Date },
6809
7161
  resourceId: {
6810
7162
  required: true,
6811
- type: mongoose25.Schema.Types.ObjectId
7163
+ type: mongoose26.Schema.Types.ObjectId
6812
7164
  },
6813
7165
  resourceName: { required: true, type: String },
6814
7166
  resourceOwner: {
@@ -6828,20 +7180,20 @@ var affiliateResourceSchema = new MongooseSchema25(
6828
7180
  },
6829
7181
  { _id: false }
6830
7182
  );
6831
- var affiliateContactDetailsSchema = new MongooseSchema25(
7183
+ var affiliateContactDetailsSchema = new MongooseSchema26(
6832
7184
  {
6833
7185
  mobilePhone: { required: true, type: String }
6834
7186
  },
6835
7187
  { _id: false }
6836
7188
  );
6837
- var affiliateBankAccountDetailsSchema = new MongooseSchema25(
7189
+ var affiliateBankAccountDetailsSchema = new MongooseSchema26(
6838
7190
  {
6839
7191
  accountHolderName: { required: true, type: String },
6840
7192
  accountNumber: { required: true, type: String }
6841
7193
  },
6842
7194
  { _id: false }
6843
7195
  );
6844
- var affiliateDetailsSchema = new MongooseSchema25(
7196
+ var affiliateDetailsSchema = new MongooseSchema26(
6845
7197
  {
6846
7198
  bankAccountDetails: {
6847
7199
  required: true,
@@ -6863,7 +7215,7 @@ var affiliateDetailsSchema = new MongooseSchema25(
6863
7215
  },
6864
7216
  { _id: false }
6865
7217
  );
6866
- var redeemHistorySchema = new MongooseSchema25(
7218
+ var redeemHistorySchema = new MongooseSchema26(
6867
7219
  {
6868
7220
  paidAt: { default: null, required: false, type: Date },
6869
7221
  redeemedAt: { required: true, type: Date },
@@ -6871,7 +7223,7 @@ var redeemHistorySchema = new MongooseSchema25(
6871
7223
  },
6872
7224
  { _id: false }
6873
7225
  );
6874
- var schema17 = new MongooseSchema25(
7226
+ var schema18 = new MongooseSchema26(
6875
7227
  {
6876
7228
  active: { default: false, required: true, type: Boolean },
6877
7229
  affiliateBonusRewards: {
@@ -6901,19 +7253,19 @@ var schema17 = new MongooseSchema25(
6901
7253
  },
6902
7254
  { timestamps: true }
6903
7255
  );
6904
- schema17.index(
7256
+ schema18.index(
6905
7257
  { affiliateCode: 1 },
6906
7258
  {
6907
7259
  partialFilterExpression: { active: true, deletedAt: null },
6908
7260
  unique: true
6909
7261
  }
6910
7262
  );
6911
- var AffiliateModel = mongoose25.models.Affiliate || mongoose25.model("Affiliate", schema17);
7263
+ var AffiliateModel = mongoose26.models.Affiliate || mongoose26.model("Affiliate", schema18);
6912
7264
 
6913
7265
  // src/mongoose/Coupon.ts
6914
- import mongoose26 from "mongoose";
6915
- var MongooseSchema26 = mongoose26.Schema;
6916
- var couponOptionSchema = new MongooseSchema26(
7266
+ import mongoose27 from "mongoose";
7267
+ var MongooseSchema27 = mongoose27.Schema;
7268
+ var couponOptionSchema = new MongooseSchema27(
6917
7269
  {
6918
7270
  buy: { required: false, type: Number },
6919
7271
  get: { required: false, type: Number },
@@ -6928,29 +7280,29 @@ var couponOptionSchema = new MongooseSchema26(
6928
7280
  },
6929
7281
  { _id: false }
6930
7282
  );
6931
- var couponVendorProductSchema = new MongooseSchema26(
7283
+ var couponVendorProductSchema = new MongooseSchema27(
6932
7284
  {
6933
7285
  couponId: {
6934
7286
  required: true,
6935
- type: mongoose26.Schema.Types.ObjectId
7287
+ type: mongoose27.Schema.Types.ObjectId
6936
7288
  },
6937
7289
  productId: {
6938
7290
  required: true,
6939
- type: mongoose26.Schema.Types.ObjectId
7291
+ type: mongoose27.Schema.Types.ObjectId
6940
7292
  },
6941
7293
  vendorCouponId: {
6942
7294
  required: false,
6943
- type: mongoose26.Schema.Types.ObjectId
7295
+ type: mongoose27.Schema.Types.ObjectId
6944
7296
  },
6945
7297
  vendorId: {
6946
7298
  ref: "Vendor",
6947
7299
  required: true,
6948
- type: mongoose26.Schema.Types.ObjectId
7300
+ type: mongoose27.Schema.Types.ObjectId
6949
7301
  }
6950
7302
  },
6951
7303
  { _id: false }
6952
7304
  );
6953
- var couponCodeSchema = new MongooseSchema26(
7305
+ var couponCodeSchema = new MongooseSchema27(
6954
7306
  {
6955
7307
  code: { required: true, type: String },
6956
7308
  qrCode: { required: true, type: ResourceImageTypeSchema },
@@ -6958,7 +7310,7 @@ var couponCodeSchema = new MongooseSchema26(
6958
7310
  },
6959
7311
  { _id: false }
6960
7312
  );
6961
- var couponParticipantUserSchema = new MongooseSchema26(
7313
+ var couponParticipantUserSchema = new MongooseSchema27(
6962
7314
  {
6963
7315
  couponCollectedCount: { default: 0, required: true, type: Number },
6964
7316
  couponCycleRedeemed: { default: false, required: true, type: Boolean },
@@ -6967,12 +7319,12 @@ var couponParticipantUserSchema = new MongooseSchema26(
6967
7319
  userId: {
6968
7320
  ref: "User",
6969
7321
  required: true,
6970
- type: mongoose26.Schema.Types.ObjectId
7322
+ type: mongoose27.Schema.Types.ObjectId
6971
7323
  }
6972
7324
  },
6973
7325
  { timestamps: true }
6974
7326
  );
6975
- var couponDataSchema = new MongooseSchema26(
7327
+ var couponDataSchema = new MongooseSchema27(
6976
7328
  {
6977
7329
  active: { default: true, required: true, type: Boolean },
6978
7330
  couponCode: { required: false, type: couponCodeSchema },
@@ -6999,7 +7351,7 @@ var couponDataSchema = new MongooseSchema26(
6999
7351
  },
7000
7352
  { timestamps: true }
7001
7353
  );
7002
- var schema18 = new MongooseSchema26(
7354
+ var schema19 = new MongooseSchema27(
7003
7355
  {
7004
7356
  active: { default: true, required: true, type: Boolean },
7005
7357
  couponData: { default: [], required: false, type: [couponDataSchema] },
@@ -7011,7 +7363,7 @@ var schema18 = new MongooseSchema26(
7011
7363
  },
7012
7364
  { timestamps: true }
7013
7365
  );
7014
- var CouponModel = mongoose26.models.Coupon || mongoose26.model("Coupon", schema18);
7366
+ var CouponModel = mongoose27.models.Coupon || mongoose27.model("Coupon", schema19);
7015
7367
 
7016
7368
  // src/service/promoCode/constants.ts
7017
7369
  var ACTIVE_NOT_DELETED_FILTER = {
@@ -7028,7 +7380,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
7028
7380
  return existing !== null;
7029
7381
  }
7030
7382
 
7031
- // node_modules/@timardex/cluemart-shared/dist/chunk-2UNNIQIK.mjs
7383
+ // node_modules/@timardex/cluemart-shared/dist/chunk-YRO6KEZG.mjs
7032
7384
  import dayjs3 from "dayjs";
7033
7385
  import customParseFormat2 from "dayjs/plugin/customParseFormat.js";
7034
7386
  import isSameOrAfter2 from "dayjs/plugin/isSameOrAfter.js";
@@ -7101,7 +7453,7 @@ var SHARE_RESOURCE_LABEL2 = {
7101
7453
  school: "School"
7102
7454
  };
7103
7455
 
7104
- // node_modules/@timardex/cluemart-shared/dist/chunk-364EX22V.mjs
7456
+ // node_modules/@timardex/cluemart-shared/dist/chunk-STNE7PMX.mjs
7105
7457
  var PROMO_CODE_PREFIX2 = "CM-";
7106
7458
  var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
7107
7459
  var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
@@ -7213,7 +7565,7 @@ var gameScreenIdentifierList2 = [
7213
7565
  }
7214
7566
  ];
7215
7567
 
7216
- // node_modules/@timardex/cluemart-shared/dist/chunk-5RXL62LO.mjs
7568
+ // node_modules/@timardex/cluemart-shared/dist/chunk-3ZPHXVUT.mjs
7217
7569
  import dayjs4 from "dayjs";
7218
7570
  var statusOptions2 = [
7219
7571
  ...Object.values(EnumInviteStatus2).map((status) => ({
@@ -8650,7 +9002,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
8650
9002
  }
8651
9003
 
8652
9004
  // src/service/database.ts
8653
- import mongoose27 from "mongoose";
9005
+ import mongoose28 from "mongoose";
8654
9006
  var connectToDatabase = async ({
8655
9007
  appName,
8656
9008
  dbName,
@@ -8663,7 +9015,7 @@ var connectToDatabase = async ({
8663
9015
  // Fallback to MongoDB Atlas connection string
8664
9016
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
8665
9017
  );
8666
- await mongoose27.connect(mongoUri);
9018
+ await mongoose28.connect(mongoUri);
8667
9019
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
8668
9020
  console.log(
8669
9021
  `${connectionType} connected from server/src/service/database.ts`
@@ -8676,7 +9028,7 @@ var connectToDatabase = async ({
8676
9028
 
8677
9029
  // src/types/index.ts
8678
9030
  import express from "express";
8679
- import mongoose28 from "mongoose";
9031
+ import mongoose29 from "mongoose";
8680
9032
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
8681
9033
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
8682
9034
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -8766,15 +9118,15 @@ async function updateAdStatuses() {
8766
9118
  }
8767
9119
 
8768
9120
  // src/service/objectIdToString.ts
8769
- import mongoose29 from "mongoose";
9121
+ import mongoose30 from "mongoose";
8770
9122
  function isValidObjectId(value) {
8771
- return mongoose29.Types.ObjectId.isValid(value);
9123
+ return mongoose30.Types.ObjectId.isValid(value);
8772
9124
  }
8773
9125
  function convertObjectIdsToStrings(obj) {
8774
9126
  if (obj === null || obj === void 0) {
8775
9127
  return obj;
8776
9128
  }
8777
- if (obj instanceof mongoose29.Types.ObjectId) {
9129
+ if (obj instanceof mongoose30.Types.ObjectId) {
8778
9130
  return obj.toString();
8779
9131
  }
8780
9132
  if (obj instanceof Date) {
@@ -8927,8 +9279,8 @@ async function findEventOrImportedMarketById(resourceId) {
8927
9279
  }
8928
9280
  const normalizedId = convertObjectIdsToStrings(resourceId);
8929
9281
  const [eventDoc, googleImportedDoc] = await Promise.all([
8930
- EventModel.findById(normalizedId).select("_id name").lean().exec(),
8931
- GoogleImportedMarketModel.findById(normalizedId).select("_id name").lean().exec()
9282
+ EventModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
9283
+ GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
8932
9284
  ]);
8933
9285
  return eventDoc ?? googleImportedDoc;
8934
9286
  }
@@ -9329,20 +9681,24 @@ var buildLicenceReplacePipeline = ({
9329
9681
  async function replaceUserLicenceWithObject({
9330
9682
  userId,
9331
9683
  licenceObject,
9332
- protectHigherLicence = true
9684
+ protectHigherLicence = true,
9685
+ refreshExistingLicence = false
9333
9686
  }) {
9334
9687
  const user = await UserModel.findById(userId, { licences: 1 }).lean();
9335
9688
  if (!user) throw new GraphQLError("User not found");
9336
- if (user.licences?.some((l) => l.licenceType === licenceObject.licenceType)) {
9689
+ const existingLicence = user.licences?.find(
9690
+ (licence) => licence.licenceType === licenceObject.licenceType
9691
+ );
9692
+ if (existingLicence && !refreshExistingLicence) {
9337
9693
  return;
9338
9694
  }
9695
+ const category = getLicenceCategory(licenceObject.licenceType);
9339
9696
  const updatedLicenceObject = {
9340
9697
  ...licenceObject,
9341
- prevLicenceType: user.licences?.find(
9342
- (l) => getLicenceCategory(l.licenceType) === getLicenceCategory(licenceObject.licenceType)
9698
+ prevLicenceType: existingLicence && refreshExistingLicence ? existingLicence.prevLicenceType : user.licences?.find(
9699
+ (licence) => licence.licenceType && getLicenceCategory(licence.licenceType) === category
9343
9700
  )?.licenceType
9344
9701
  };
9345
- const category = getLicenceCategory(updatedLicenceObject.licenceType);
9346
9702
  if (protectHigherLicence) {
9347
9703
  const highestLicence = getHighestLicenceForCategory(
9348
9704
  user.licences,
@@ -9456,6 +9812,17 @@ var vendorLicences = [
9456
9812
  EnumUserLicence.PRO_VENDOR,
9457
9813
  EnumUserLicence.PRO_PLUS_VENDOR
9458
9814
  ];
9815
+ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
9816
+ const stripe = user.stripe;
9817
+ if (!stripe?.subscriptionId || stripe.currentPlan !== licenceType || stripe.status !== EnumSubscriptionStatus.ACTIVE && stripe.status !== EnumSubscriptionStatus.TRIALING) {
9818
+ return false;
9819
+ }
9820
+ if (stripe.cancelAtPeriodEnd !== true || !stripe.endDate) {
9821
+ return true;
9822
+ }
9823
+ const paidThrough = dayjs8(stripe.endDate);
9824
+ return !paidThrough.isValid() || paidThrough.isAfter(now);
9825
+ }
9459
9826
  async function handleVendorLicenceCompliance(user, now) {
9460
9827
  if (!user.licences || !user.vendor) {
9461
9828
  return;
@@ -9469,12 +9836,20 @@ async function handleVendorLicenceCompliance(user, now) {
9469
9836
  const proLicences = vendorLicencesOfUser.filter(
9470
9837
  (licence) => licence.licenceType !== EnumUserLicence.STANDARD_VENDOR
9471
9838
  );
9472
- const expiredProLicence = proLicences.some(
9839
+ const expiredProLicences = proLicences.filter(
9473
9840
  (licence) => !dayjs8(licence.expiryDate).isAfter(now)
9474
9841
  );
9475
- const hasValidProLicence = hasValidLicence(proLicences, vendorLicences, now);
9842
+ const stripeProtectedLicenceTypes = new Set(
9843
+ expiredProLicences.filter(
9844
+ (licence) => isProtectedByCurrentStripeSubscription(user, licence.licenceType, now)
9845
+ ).map((licence) => licence.licenceType)
9846
+ );
9847
+ const expiredProLicence = expiredProLicences.some(
9848
+ (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
9849
+ );
9850
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
9476
9851
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
9477
- (licence) => !dayjs8(licence.expiryDate).isAfter(now)
9852
+ (licence) => !dayjs8(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
9478
9853
  );
9479
9854
  if (!hasExpiredVendorLicence) {
9480
9855
  return;
@@ -9488,7 +9863,10 @@ async function handleVendorLicenceCompliance(user, now) {
9488
9863
  "owner.userId": user._id
9489
9864
  }).lean().exec();
9490
9865
  }
9491
- await syncUserLicencesAfterExpiry(user._id, vendorLicences, now, "downgrade");
9866
+ const licencesToSync = vendorLicences.filter(
9867
+ (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
9868
+ );
9869
+ await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
9492
9870
  if (!expiredProLicence || !vendor || hasValidProLicence) {
9493
9871
  return;
9494
9872
  }
@@ -9577,6 +9955,13 @@ async function processUserCompliance(user, now) {
9577
9955
  }
9578
9956
 
9579
9957
  // src/service/license/compliance/ensureUserLicenseCompliance.ts
9958
+ async function ensureUserLicenseComplianceForUser(userId, now = dayjs10()) {
9959
+ const user = await UserModel.findById(userId);
9960
+ if (!user) {
9961
+ return;
9962
+ }
9963
+ await processUserCompliance(user, now);
9964
+ }
9580
9965
  async function ensureUserLicenseCompliance() {
9581
9966
  const now = dayjs10();
9582
9967
  console.log(`\u{1F50D} Checking license compliance at ${now.format()}`);
@@ -9828,7 +10213,7 @@ async function sendLicenseReminder(user, licence) {
9828
10213
  await sendPushNotifications(payload);
9829
10214
  console.log(`\u2705 Sent 7-day reminder to user ${userId} for ${licenceName}`);
9830
10215
  }
9831
- async function processLicenseReminder(user, licence, now) {
10216
+ async function processLicenseReminder(licence, now) {
9832
10217
  if (dayjs11(licence.expiryDate).isBefore(now)) {
9833
10218
  return false;
9834
10219
  }
@@ -9860,7 +10245,7 @@ async function processUserLicenseReminders(user, now) {
9860
10245
  const licenceChecks = await Promise.all(
9861
10246
  validLicences.map(async (licence) => {
9862
10247
  try {
9863
- const shouldSend = await processLicenseReminder(user, licence, now);
10248
+ const shouldSend = await processLicenseReminder(licence, now);
9864
10249
  return { licence, shouldSend };
9865
10250
  } catch (err) {
9866
10251
  console.error(
@@ -9926,6 +10311,8 @@ export {
9926
10311
  AdModel,
9927
10312
  AffiliateModel,
9928
10313
  AppSettingModel,
10314
+ BILLING_CATALOG_COLLECTION_NAME,
10315
+ BillingCatalogModel,
9929
10316
  CategorySchema,
9930
10317
  ChatModel,
9931
10318
  ChatReportModel,
@@ -9961,6 +10348,7 @@ export {
9961
10348
  activeAffiliateCodeExists,
9962
10349
  awardAffiliateVendorSubscriptionRewards,
9963
10350
  baseResourceFields,
10351
+ buildInitialBillingCatalogEntries,
9964
10352
  buildLicenceExpiryPipeline,
9965
10353
  checkOwnerHasLicence,
9966
10354
  connectToDatabase,
@@ -9969,10 +10357,12 @@ export {
9969
10357
  dateTimeSchema2 as dateTimeSchema,
9970
10358
  didRemoveAnyEventDates,
9971
10359
  ensureUserLicenseCompliance,
10360
+ ensureUserLicenseComplianceForUser,
9972
10361
  eventLicences,
9973
10362
  express,
9974
10363
  findAffiliateByPromoCode,
9975
10364
  findEventOrImportedMarketById,
10365
+ getBillingCatalogDefinition,
9976
10366
  getEventResourceInfo,
9977
10367
  getHighestLicenceForCategory,
9978
10368
  getLicenceCategory,
@@ -9994,7 +10384,7 @@ export {
9994
10384
  locationGeoSchema,
9995
10385
  locationsSchema,
9996
10386
  mapVendorLicenceToSubscriptionRewardType,
9997
- mongoose28 as mongoose,
10387
+ mongoose29 as mongoose,
9998
10388
  normalizeAffiliatePromoCodes,
9999
10389
  normalizePromoCode,
10000
10390
  notifyUsers,