@timardex/cluemart-server-shared 1.1.38 → 1.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Affiliate-xCVhO2Cy.d.mts → Affiliate-BLh0EcNI.d.mts} +18 -5
- package/dist/{Affiliate-CZKOOaz_.d.ts → Affiliate-CBp0M850.d.ts} +18 -5
- package/dist/{chunk-DJHOLZ3J.mjs → chunk-6RUQHYTK.mjs} +636 -287
- package/dist/chunk-6RUQHYTK.mjs.map +1 -0
- package/dist/{Chat-Wn7yfc3v.d.mts → index-zC8a3adw.d.mts} +34 -34
- package/dist/{Chat-Wn7yfc3v.d.ts → index-zC8a3adw.d.ts} +34 -34
- package/dist/index.cjs +694 -307
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +111 -56
- package/dist/index.d.ts +111 -56
- package/dist/index.mjs +688 -306
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +638 -286
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +46 -6
- package/dist/mongoose/index.d.ts +46 -6
- package/dist/mongoose/index.mjs +9 -1
- package/dist/service/index.cjs +627 -306
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +12 -10
- package/dist/service/index.d.ts +12 -10
- package/dist/service/index.mjs +51 -16
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/chunk-DJHOLZ3J.mjs.map +0 -1
package/dist/service/index.cjs
CHANGED
|
@@ -45,6 +45,7 @@ __export(service_exports, {
|
|
|
45
45
|
createLicenceObject: () => createLicenceObject,
|
|
46
46
|
didRemoveAnyEventDates: () => didRemoveAnyEventDates,
|
|
47
47
|
ensureUserLicenseCompliance: () => ensureUserLicenseCompliance,
|
|
48
|
+
ensureUserLicenseComplianceForUser: () => ensureUserLicenseComplianceForUser,
|
|
48
49
|
eventLicences: () => eventLicences,
|
|
49
50
|
findAffiliateByPromoCode: () => findAffiliateByPromoCode,
|
|
50
51
|
findEventOrImportedMarketById: () => findEventOrImportedMarketById,
|
|
@@ -388,8 +389,8 @@ var EnumRelationResource = /* @__PURE__ */ ((EnumRelationResource22) => {
|
|
|
388
389
|
return EnumRelationResource22;
|
|
389
390
|
})(EnumRelationResource || {});
|
|
390
391
|
var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceType22) => {
|
|
391
|
-
EnumNotificationResourceType22["APPROVED_AFFILIATE"] = "approved_affiliate";
|
|
392
392
|
EnumNotificationResourceType22["AFFILIATE_REWARD_RECEIVED"] = "affiliate_reward_received";
|
|
393
|
+
EnumNotificationResourceType22["APPROVED_AFFILIATE"] = "approved_affiliate";
|
|
393
394
|
EnumNotificationResourceType22["APPROVED_EVENT"] = "approved_event";
|
|
394
395
|
EnumNotificationResourceType22["APPROVED_PARTNER"] = "approved_partner";
|
|
395
396
|
EnumNotificationResourceType22["APPROVED_SCHOOL"] = "approved_school";
|
|
@@ -417,6 +418,7 @@ var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceTyp
|
|
|
417
418
|
EnumNotificationResourceType22["NEW_POST_CREATED"] = "new_post_created";
|
|
418
419
|
EnumNotificationResourceType22["REGISTERED_USER_BY_SCHOOL_CODE"] = "registered_user_by_school_code";
|
|
419
420
|
EnumNotificationResourceType22["SYSTEM_ALERT"] = "system_alert";
|
|
421
|
+
EnumNotificationResourceType22["USER_COUPON_REDEEMED"] = "user_coupon_redeemed";
|
|
420
422
|
EnumNotificationResourceType22["VENDOR_APPLICATION_TO_EVENT"] = "vendor_application_to_event";
|
|
421
423
|
EnumNotificationResourceType22["VENDOR_UPDATE_RELATION_TO_EVENT"] = "vendor_update_relation_to_event";
|
|
422
424
|
return EnumNotificationResourceType22;
|
|
@@ -491,6 +493,11 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
|
|
|
491
493
|
EnumSubscriptionStatus22["TRIALING"] = "trialing";
|
|
492
494
|
return EnumSubscriptionStatus22;
|
|
493
495
|
})(EnumSubscriptionStatus || {});
|
|
496
|
+
var EnumBillingPeriod = /* @__PURE__ */ ((EnumBillingPeriod22) => {
|
|
497
|
+
EnumBillingPeriod22["MONTHLY_CANCEL_ANYTIME"] = "monthly_cancel_anytime";
|
|
498
|
+
EnumBillingPeriod22["YEARLY_ANNUAL_BILLED"] = "yearly_annual_billed";
|
|
499
|
+
return EnumBillingPeriod22;
|
|
500
|
+
})(EnumBillingPeriod || {});
|
|
494
501
|
var EnumReward = /* @__PURE__ */ ((EnumReward22) => {
|
|
495
502
|
EnumReward22["MYSTERY_JOY_BOX"] = "mystery_joy_box";
|
|
496
503
|
EnumReward22["MYSTERY_SQUEEZE_BOX"] = "mystery_squeeze_box";
|
|
@@ -1773,6 +1780,42 @@ var availableCategories = assignColorToCategories([
|
|
|
1773
1780
|
...petProductsAndAnimalGoods,
|
|
1774
1781
|
...serviceAndExperience
|
|
1775
1782
|
]);
|
|
1783
|
+
var BILLING_CATALOG_KEYS = [
|
|
1784
|
+
"pro_vendor_monthly",
|
|
1785
|
+
"pro_vendor_yearly",
|
|
1786
|
+
"pro_plus_vendor_monthly",
|
|
1787
|
+
"pro_plus_vendor_yearly"
|
|
1788
|
+
];
|
|
1789
|
+
var BILLING_CATALOG_CURRENCY = "nzd";
|
|
1790
|
+
var BILLING_CATALOG_DEFINITIONS = {
|
|
1791
|
+
pro_plus_vendor_monthly: {
|
|
1792
|
+
billingPeriod: "monthly_cancel_anytime",
|
|
1793
|
+
licenceType: "pro_plus_vendor"
|
|
1794
|
+
/* PRO_PLUS_VENDOR */
|
|
1795
|
+
},
|
|
1796
|
+
pro_plus_vendor_yearly: {
|
|
1797
|
+
billingPeriod: "yearly_annual_billed",
|
|
1798
|
+
licenceType: "pro_plus_vendor"
|
|
1799
|
+
/* PRO_PLUS_VENDOR */
|
|
1800
|
+
},
|
|
1801
|
+
pro_vendor_monthly: {
|
|
1802
|
+
billingPeriod: "monthly_cancel_anytime",
|
|
1803
|
+
licenceType: "pro_vendor"
|
|
1804
|
+
/* PRO_VENDOR */
|
|
1805
|
+
},
|
|
1806
|
+
pro_vendor_yearly: {
|
|
1807
|
+
billingPeriod: "yearly_annual_billed",
|
|
1808
|
+
licenceType: "pro_vendor"
|
|
1809
|
+
/* PRO_VENDOR */
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
function billingCatalogDefinitionMatches(entry) {
|
|
1813
|
+
const definition = BILLING_CATALOG_DEFINITIONS[entry.key];
|
|
1814
|
+
if (!definition) {
|
|
1815
|
+
return false;
|
|
1816
|
+
}
|
|
1817
|
+
return definition.billingPeriod === entry.billingPeriod && definition.licenceType === entry.licenceType;
|
|
1818
|
+
}
|
|
1776
1819
|
var packagingTypes = [
|
|
1777
1820
|
"Biodegradable",
|
|
1778
1821
|
"Compostable",
|
|
@@ -2217,12 +2260,19 @@ var REDEEMED_REWARD_FIELDS_FRAGMENT = gql`
|
|
|
2217
2260
|
`;
|
|
2218
2261
|
var STRIPE_FIELDS_FRAGMENT = gql`
|
|
2219
2262
|
fragment StripeSubscriptionFields on StripeSubscriptionType {
|
|
2263
|
+
billingPeriod
|
|
2264
|
+
cancelAtPeriodEnd
|
|
2220
2265
|
customerId
|
|
2221
2266
|
subscriptionId
|
|
2222
2267
|
status
|
|
2223
2268
|
currentPlan
|
|
2224
2269
|
startDate
|
|
2225
2270
|
endDate
|
|
2271
|
+
pendingPlan
|
|
2272
|
+
pendingBillingPeriod
|
|
2273
|
+
pendingChangeEffectiveAt
|
|
2274
|
+
priceId
|
|
2275
|
+
scheduleId
|
|
2226
2276
|
}
|
|
2227
2277
|
`;
|
|
2228
2278
|
var USER_FIELDS_FRAGMENT = gql`
|
|
@@ -4256,11 +4306,8 @@ var GET_RESOURCE_ACTIVITY = gql`
|
|
|
4256
4306
|
${RESOURCE_ACTIVITY_FIELDS_FRAGMENT}
|
|
4257
4307
|
`;
|
|
4258
4308
|
var CREATE_CHECKOUT_SESSION_MUTATION = gql`
|
|
4259
|
-
mutation createCheckoutSession(
|
|
4260
|
-
|
|
4261
|
-
$billingPeriod: BillingPeriodEnumType
|
|
4262
|
-
) {
|
|
4263
|
-
createCheckoutSession(planId: $planId, billingPeriod: $billingPeriod) {
|
|
4309
|
+
mutation createCheckoutSession($input: CreateCheckoutSessionInputType!) {
|
|
4310
|
+
createCheckoutSession(input: $input) {
|
|
4264
4311
|
data {
|
|
4265
4312
|
sessionId
|
|
4266
4313
|
checkoutUrl
|
|
@@ -4272,25 +4319,38 @@ var CREATE_CHECKOUT_SESSION_MUTATION = gql`
|
|
|
4272
4319
|
var CANCEL_SUBSCRIPTION_MUTATION = gql`
|
|
4273
4320
|
mutation cancelSubscription {
|
|
4274
4321
|
cancelSubscription {
|
|
4275
|
-
data
|
|
4322
|
+
data {
|
|
4323
|
+
billingPeriod
|
|
4324
|
+
cancelAtPeriodEnd
|
|
4325
|
+
currentPlan
|
|
4326
|
+
endDate
|
|
4327
|
+
pendingBillingPeriod
|
|
4328
|
+
pendingChangeEffectiveAt
|
|
4329
|
+
pendingPlan
|
|
4330
|
+
priceId
|
|
4331
|
+
scheduleId
|
|
4332
|
+
status
|
|
4333
|
+
subscriptionId
|
|
4334
|
+
}
|
|
4276
4335
|
message
|
|
4277
4336
|
}
|
|
4278
4337
|
}
|
|
4279
4338
|
`;
|
|
4280
4339
|
var UPDATE_SUBSCRIPTION_PLAN_MUTATION = gql`
|
|
4281
|
-
mutation updateSubscriptionPlan(
|
|
4282
|
-
|
|
4283
|
-
$billingPeriod: BillingPeriodEnumType
|
|
4284
|
-
) {
|
|
4285
|
-
updateSubscriptionPlan(
|
|
4286
|
-
newPlanId: $newPlanId
|
|
4287
|
-
billingPeriod: $billingPeriod
|
|
4288
|
-
) {
|
|
4340
|
+
mutation updateSubscriptionPlan($input: UpdateSubscriptionPlanInputType!) {
|
|
4341
|
+
updateSubscriptionPlan(input: $input) {
|
|
4289
4342
|
data {
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
priceId
|
|
4343
|
+
billingPeriod
|
|
4344
|
+
cancelAtPeriodEnd
|
|
4293
4345
|
currentPlan
|
|
4346
|
+
endDate
|
|
4347
|
+
pendingBillingPeriod
|
|
4348
|
+
pendingChangeEffectiveAt
|
|
4349
|
+
pendingPlan
|
|
4350
|
+
priceId
|
|
4351
|
+
scheduleId
|
|
4352
|
+
status
|
|
4353
|
+
subscriptionId
|
|
4294
4354
|
}
|
|
4295
4355
|
message
|
|
4296
4356
|
}
|
|
@@ -4306,36 +4366,20 @@ var CREATE_CUSTOMER_PORTAL = gql`
|
|
|
4306
4366
|
}
|
|
4307
4367
|
}
|
|
4308
4368
|
`;
|
|
4309
|
-
var SELECT_PACKAGE_MUTATION = gql`
|
|
4310
|
-
mutation selectPackage(
|
|
4311
|
-
$billingPeriod: BillingPeriodEnumType
|
|
4312
|
-
$selectedLicence: LicencesEnumType!
|
|
4313
|
-
$useStripe: Boolean
|
|
4314
|
-
) {
|
|
4315
|
-
selectPackage(
|
|
4316
|
-
billingPeriod: $billingPeriod
|
|
4317
|
-
selectedLicence: $selectedLicence
|
|
4318
|
-
useStripe: $useStripe
|
|
4319
|
-
) {
|
|
4320
|
-
data {
|
|
4321
|
-
checkoutUrl
|
|
4322
|
-
licences {
|
|
4323
|
-
...LicenceFields
|
|
4324
|
-
}
|
|
4325
|
-
userId
|
|
4326
|
-
}
|
|
4327
|
-
message
|
|
4328
|
-
}
|
|
4329
|
-
}
|
|
4330
|
-
${LICENCE_FIELDS_FRAGMENT}
|
|
4331
|
-
`;
|
|
4332
4369
|
var GET_SUBSCRIPTION_STATUS = gql`
|
|
4333
4370
|
query getSubscriptionStatus {
|
|
4334
4371
|
getSubscriptionStatus {
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
priceId
|
|
4372
|
+
billingPeriod
|
|
4373
|
+
cancelAtPeriodEnd
|
|
4338
4374
|
currentPlan
|
|
4375
|
+
endDate
|
|
4376
|
+
pendingBillingPeriod
|
|
4377
|
+
pendingChangeEffectiveAt
|
|
4378
|
+
pendingPlan
|
|
4379
|
+
priceId
|
|
4380
|
+
scheduleId
|
|
4381
|
+
status
|
|
4382
|
+
subscriptionId
|
|
4339
4383
|
}
|
|
4340
4384
|
}
|
|
4341
4385
|
`;
|
|
@@ -4362,7 +4406,6 @@ var GET_SUBSCRIPTION_PLANS = gql`
|
|
|
4362
4406
|
}
|
|
4363
4407
|
}
|
|
4364
4408
|
isNewUser
|
|
4365
|
-
isTester
|
|
4366
4409
|
appliedDiscountType
|
|
4367
4410
|
}
|
|
4368
4411
|
}
|
|
@@ -4470,6 +4513,57 @@ var GET_APP_SETTINGS = gql`
|
|
|
4470
4513
|
}
|
|
4471
4514
|
${APP_SETTINGS_FIELDS_FRAGMENT}
|
|
4472
4515
|
`;
|
|
4516
|
+
var BILLING_CATALOG_FIELDS_FRAGMENT = gql`
|
|
4517
|
+
fragment BillingCatalogFields on BillingCatalogEntryType {
|
|
4518
|
+
_id
|
|
4519
|
+
active
|
|
4520
|
+
billingPeriod
|
|
4521
|
+
createdAt
|
|
4522
|
+
currency
|
|
4523
|
+
effectiveFrom
|
|
4524
|
+
key
|
|
4525
|
+
licenceType
|
|
4526
|
+
revision
|
|
4527
|
+
stripePriceId
|
|
4528
|
+
stripeProductId
|
|
4529
|
+
taxInclusive
|
|
4530
|
+
unitAmount
|
|
4531
|
+
updatedAt
|
|
4532
|
+
updatedBy
|
|
4533
|
+
}
|
|
4534
|
+
`;
|
|
4535
|
+
var GET_BILLING_CATALOG = gql`
|
|
4536
|
+
query getBillingCatalog {
|
|
4537
|
+
billingCatalog {
|
|
4538
|
+
...BillingCatalogFields
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
${BILLING_CATALOG_FIELDS_FRAGMENT}
|
|
4542
|
+
`;
|
|
4543
|
+
var UPDATE_BILLING_CATALOG_PRICE_MUTATION = gql`
|
|
4544
|
+
mutation updateBillingCatalogPrice(
|
|
4545
|
+
$input: UpdateBillingCatalogPriceInputType!
|
|
4546
|
+
) {
|
|
4547
|
+
updateBillingCatalogPrice(input: $input) {
|
|
4548
|
+
data {
|
|
4549
|
+
...BillingCatalogFields
|
|
4550
|
+
}
|
|
4551
|
+
message
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
${BILLING_CATALOG_FIELDS_FRAGMENT}
|
|
4555
|
+
`;
|
|
4556
|
+
var SYNC_BILLING_CATALOG_PRICE_MUTATION = gql`
|
|
4557
|
+
mutation syncBillingCatalogPrice($input: SyncBillingCatalogPriceInputType!) {
|
|
4558
|
+
syncBillingCatalogPrice(input: $input) {
|
|
4559
|
+
data {
|
|
4560
|
+
...BillingCatalogFields
|
|
4561
|
+
}
|
|
4562
|
+
message
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
${BILLING_CATALOG_FIELDS_FRAGMENT}
|
|
4566
|
+
`;
|
|
4473
4567
|
var GAME_HISTORY_FIELDS_FRAGMENT = gql`
|
|
4474
4568
|
fragment GameHistoryFields on GameHistoryType {
|
|
4475
4569
|
createdAt
|
|
@@ -5308,46 +5402,200 @@ schema.index({
|
|
|
5308
5402
|
start: 1,
|
|
5309
5403
|
status: 1
|
|
5310
5404
|
});
|
|
5405
|
+
schema.index({
|
|
5406
|
+
status: 1,
|
|
5407
|
+
targetRegion: 1,
|
|
5408
|
+
// eslint-disable-next-line sort-keys
|
|
5409
|
+
start: -1
|
|
5410
|
+
});
|
|
5311
5411
|
var AdModel = import_mongoose.default.models.Ad || import_mongoose.default.model("Ad", schema);
|
|
5312
5412
|
|
|
5313
|
-
// src/mongoose/
|
|
5413
|
+
// src/mongoose/BillingCatalog.ts
|
|
5314
5414
|
var import_mongoose2 = __toESM(require("mongoose"));
|
|
5315
5415
|
var MongooseSchema2 = import_mongoose2.default.Schema;
|
|
5316
|
-
var
|
|
5416
|
+
var BILLING_CATALOG_COLLECTION_NAME = "billingCatalog";
|
|
5417
|
+
var paidVendorLicences = [
|
|
5418
|
+
EnumUserLicence.PRO_VENDOR,
|
|
5419
|
+
EnumUserLicence.PRO_PLUS_VENDOR
|
|
5420
|
+
];
|
|
5421
|
+
var supportedBillingPeriods = [
|
|
5422
|
+
EnumBillingPeriod.MONTHLY_CANCEL_ANYTIME,
|
|
5423
|
+
EnumBillingPeriod.YEARLY_ANNUAL_BILLED
|
|
5424
|
+
];
|
|
5425
|
+
var unitAmountField = {
|
|
5426
|
+
min: 1,
|
|
5427
|
+
required: true,
|
|
5428
|
+
type: Number,
|
|
5429
|
+
validate: {
|
|
5430
|
+
message: "Billing catalogue price must be a positive integer.",
|
|
5431
|
+
validator: Number.isInteger
|
|
5432
|
+
}
|
|
5433
|
+
};
|
|
5434
|
+
var currencyField = {
|
|
5435
|
+
default: BILLING_CATALOG_CURRENCY,
|
|
5436
|
+
enum: [BILLING_CATALOG_CURRENCY],
|
|
5437
|
+
immutable: true,
|
|
5438
|
+
lowercase: true,
|
|
5439
|
+
required: true,
|
|
5440
|
+
trim: true,
|
|
5441
|
+
type: String
|
|
5442
|
+
};
|
|
5443
|
+
var stripePriceIdField = {
|
|
5444
|
+
default: null,
|
|
5445
|
+
required: false,
|
|
5446
|
+
trim: true,
|
|
5447
|
+
type: String
|
|
5448
|
+
};
|
|
5449
|
+
var stripeProductIdField = {
|
|
5450
|
+
default: null,
|
|
5451
|
+
required: false,
|
|
5452
|
+
trim: true,
|
|
5453
|
+
type: String
|
|
5454
|
+
};
|
|
5455
|
+
var priceHistorySchema = new MongooseSchema2(
|
|
5456
|
+
{
|
|
5457
|
+
changedAt: { required: true, type: Date },
|
|
5458
|
+
changedBy: {
|
|
5459
|
+
default: null,
|
|
5460
|
+
ref: "User",
|
|
5461
|
+
required: false,
|
|
5462
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
5463
|
+
},
|
|
5464
|
+
currency: currencyField,
|
|
5465
|
+
effectiveFrom: { required: true, type: Date },
|
|
5466
|
+
effectiveTo: { required: true, type: Date },
|
|
5467
|
+
stripePriceId: stripePriceIdField,
|
|
5468
|
+
stripeProductId: stripeProductIdField,
|
|
5469
|
+
unitAmount: unitAmountField
|
|
5470
|
+
},
|
|
5471
|
+
{ _id: false }
|
|
5472
|
+
);
|
|
5473
|
+
var schema2 = new MongooseSchema2(
|
|
5474
|
+
{
|
|
5475
|
+
active: { default: true, required: true, type: Boolean },
|
|
5476
|
+
billingPeriod: {
|
|
5477
|
+
enum: supportedBillingPeriods,
|
|
5478
|
+
immutable: true,
|
|
5479
|
+
required: true,
|
|
5480
|
+
type: String
|
|
5481
|
+
},
|
|
5482
|
+
currency: currencyField,
|
|
5483
|
+
effectiveFrom: { default: Date.now, required: true, type: Date },
|
|
5484
|
+
key: {
|
|
5485
|
+
enum: BILLING_CATALOG_KEYS,
|
|
5486
|
+
immutable: true,
|
|
5487
|
+
required: true,
|
|
5488
|
+
type: String,
|
|
5489
|
+
unique: true
|
|
5490
|
+
},
|
|
5491
|
+
licenceType: {
|
|
5492
|
+
enum: paidVendorLicences,
|
|
5493
|
+
immutable: true,
|
|
5494
|
+
required: true,
|
|
5495
|
+
type: String
|
|
5496
|
+
},
|
|
5497
|
+
priceHistory: {
|
|
5498
|
+
default: [],
|
|
5499
|
+
required: true,
|
|
5500
|
+
type: [priceHistorySchema]
|
|
5501
|
+
},
|
|
5502
|
+
revision: {
|
|
5503
|
+
default: 1,
|
|
5504
|
+
min: 1,
|
|
5505
|
+
required: true,
|
|
5506
|
+
type: Number,
|
|
5507
|
+
validate: {
|
|
5508
|
+
message: "Billing catalogue revision must be a positive integer.",
|
|
5509
|
+
validator: Number.isInteger
|
|
5510
|
+
}
|
|
5511
|
+
},
|
|
5512
|
+
stripePriceId: stripePriceIdField,
|
|
5513
|
+
stripeProductId: stripeProductIdField,
|
|
5514
|
+
taxInclusive: {
|
|
5515
|
+
default: true,
|
|
5516
|
+
immutable: true,
|
|
5517
|
+
required: true,
|
|
5518
|
+
type: Boolean,
|
|
5519
|
+
validate: {
|
|
5520
|
+
message: "Billing catalogue prices must include GST.",
|
|
5521
|
+
validator: (value) => value === true
|
|
5522
|
+
}
|
|
5523
|
+
},
|
|
5524
|
+
unitAmount: unitAmountField,
|
|
5525
|
+
updatedBy: {
|
|
5526
|
+
default: null,
|
|
5527
|
+
ref: "User",
|
|
5528
|
+
required: false,
|
|
5529
|
+
type: import_mongoose2.default.Schema.Types.ObjectId
|
|
5530
|
+
}
|
|
5531
|
+
},
|
|
5532
|
+
{
|
|
5533
|
+
collection: BILLING_CATALOG_COLLECTION_NAME,
|
|
5534
|
+
strict: true,
|
|
5535
|
+
timestamps: true
|
|
5536
|
+
}
|
|
5537
|
+
);
|
|
5538
|
+
schema2.pre("validate", function validateDefinition() {
|
|
5539
|
+
if (!billingCatalogDefinitionMatches(this)) {
|
|
5540
|
+
this.invalidate(
|
|
5541
|
+
"key",
|
|
5542
|
+
"Billing catalogue key does not match its licence and billing period."
|
|
5543
|
+
);
|
|
5544
|
+
}
|
|
5545
|
+
});
|
|
5546
|
+
schema2.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });
|
|
5547
|
+
schema2.index({ active: 1, licenceType: 1 });
|
|
5548
|
+
schema2.index(
|
|
5549
|
+
{ stripePriceId: 1 },
|
|
5550
|
+
{
|
|
5551
|
+
partialFilterExpression: { stripePriceId: { $type: "string" } },
|
|
5552
|
+
unique: true
|
|
5553
|
+
}
|
|
5554
|
+
);
|
|
5555
|
+
var BillingCatalogModel = import_mongoose2.default.models.BillingCatalogEntry || import_mongoose2.default.model(
|
|
5556
|
+
"BillingCatalogEntry",
|
|
5557
|
+
schema2,
|
|
5558
|
+
BILLING_CATALOG_COLLECTION_NAME
|
|
5559
|
+
);
|
|
5560
|
+
|
|
5561
|
+
// src/mongoose/chat/Chat.ts
|
|
5562
|
+
var import_mongoose3 = __toESM(require("mongoose"));
|
|
5563
|
+
var MongooseSchema3 = import_mongoose3.default.Schema;
|
|
5564
|
+
var MessageReplyPreviewSchema = new MongooseSchema3(
|
|
5317
5565
|
{
|
|
5318
5566
|
contentPreview: { required: true, type: String },
|
|
5319
5567
|
senderId: {
|
|
5320
5568
|
ref: "User",
|
|
5321
5569
|
required: true,
|
|
5322
|
-
type:
|
|
5570
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
5323
5571
|
},
|
|
5324
5572
|
senderName: { required: true, type: String }
|
|
5325
5573
|
},
|
|
5326
5574
|
{ _id: false }
|
|
5327
5575
|
);
|
|
5328
|
-
var MessageReactionSchema = new
|
|
5576
|
+
var MessageReactionSchema = new MongooseSchema3(
|
|
5329
5577
|
{
|
|
5330
5578
|
createdAt: { required: true, type: Date },
|
|
5331
5579
|
userId: {
|
|
5332
5580
|
ref: "User",
|
|
5333
5581
|
required: true,
|
|
5334
|
-
type:
|
|
5582
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
5335
5583
|
}
|
|
5336
5584
|
},
|
|
5337
5585
|
{ _id: false }
|
|
5338
5586
|
);
|
|
5339
|
-
var MessageSeenSchema = new
|
|
5587
|
+
var MessageSeenSchema = new MongooseSchema3(
|
|
5340
5588
|
{
|
|
5341
5589
|
seenAt: { required: true, type: Date },
|
|
5342
5590
|
userId: {
|
|
5343
5591
|
ref: "User",
|
|
5344
5592
|
required: true,
|
|
5345
|
-
type:
|
|
5593
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
5346
5594
|
}
|
|
5347
5595
|
},
|
|
5348
5596
|
{ _id: false }
|
|
5349
5597
|
);
|
|
5350
|
-
var MessageSchema = new
|
|
5598
|
+
var MessageSchema = new MongooseSchema3(
|
|
5351
5599
|
{
|
|
5352
5600
|
content: { required: true, type: String },
|
|
5353
5601
|
likedBy: { default: [], required: false, type: [MessageReactionSchema] },
|
|
@@ -5358,18 +5606,18 @@ var MessageSchema = new MongooseSchema2(
|
|
|
5358
5606
|
replyToMessageId: {
|
|
5359
5607
|
ref: "Chat.messages",
|
|
5360
5608
|
required: false,
|
|
5361
|
-
type:
|
|
5609
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
5362
5610
|
},
|
|
5363
5611
|
seenBy: { default: [], required: false, type: [MessageSeenSchema] },
|
|
5364
5612
|
senderId: {
|
|
5365
5613
|
ref: "User",
|
|
5366
5614
|
required: true,
|
|
5367
|
-
type:
|
|
5615
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
5368
5616
|
}
|
|
5369
5617
|
},
|
|
5370
5618
|
{ timestamps: true }
|
|
5371
5619
|
);
|
|
5372
|
-
var ParticipantSchema = new
|
|
5620
|
+
var ParticipantSchema = new MongooseSchema3(
|
|
5373
5621
|
{
|
|
5374
5622
|
active: { default: true, required: true, type: Boolean },
|
|
5375
5623
|
userAvatar: { required: false, type: String },
|
|
@@ -5377,14 +5625,14 @@ var ParticipantSchema = new MongooseSchema2(
|
|
|
5377
5625
|
userId: {
|
|
5378
5626
|
ref: "User",
|
|
5379
5627
|
required: true,
|
|
5380
|
-
type:
|
|
5628
|
+
type: import_mongoose3.default.Schema.Types.ObjectId
|
|
5381
5629
|
},
|
|
5382
5630
|
userName: { required: true, type: String }
|
|
5383
5631
|
},
|
|
5384
5632
|
{ _id: false }
|
|
5385
5633
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5386
5634
|
);
|
|
5387
|
-
var ChatSchema = new
|
|
5635
|
+
var ChatSchema = new MongooseSchema3(
|
|
5388
5636
|
{
|
|
5389
5637
|
active: { default: true, required: true, type: Boolean },
|
|
5390
5638
|
chatDescription: { required: false, type: String },
|
|
@@ -5408,12 +5656,12 @@ ChatSchema.index({
|
|
|
5408
5656
|
"participants.userId": 1,
|
|
5409
5657
|
updatedAt: -1
|
|
5410
5658
|
});
|
|
5411
|
-
var ChatModel =
|
|
5659
|
+
var ChatModel = import_mongoose3.default.models.Chat || import_mongoose3.default.model("Chat", ChatSchema);
|
|
5412
5660
|
|
|
5413
5661
|
// src/mongoose/chat/ChatReport.ts
|
|
5414
|
-
var
|
|
5415
|
-
var
|
|
5416
|
-
var ReasonSchema = new
|
|
5662
|
+
var import_mongoose4 = __toESM(require("mongoose"));
|
|
5663
|
+
var MongooseSchema4 = import_mongoose4.default.Schema;
|
|
5664
|
+
var ReasonSchema = new MongooseSchema4(
|
|
5417
5665
|
{
|
|
5418
5666
|
details: { default: null, required: false, type: String },
|
|
5419
5667
|
reasonType: {
|
|
@@ -5424,23 +5672,23 @@ var ReasonSchema = new MongooseSchema3(
|
|
|
5424
5672
|
},
|
|
5425
5673
|
{ _id: false }
|
|
5426
5674
|
);
|
|
5427
|
-
var ChatReportSchema = new
|
|
5675
|
+
var ChatReportSchema = new MongooseSchema4(
|
|
5428
5676
|
{
|
|
5429
5677
|
chatId: {
|
|
5430
5678
|
ref: "Chat",
|
|
5431
5679
|
required: true,
|
|
5432
|
-
type:
|
|
5680
|
+
type: import_mongoose4.default.Schema.Types.ObjectId
|
|
5433
5681
|
},
|
|
5434
5682
|
reason: { required: true, type: ReasonSchema },
|
|
5435
5683
|
reportedUserId: {
|
|
5436
5684
|
ref: "User",
|
|
5437
5685
|
required: true,
|
|
5438
|
-
type:
|
|
5686
|
+
type: import_mongoose4.default.Schema.Types.ObjectId
|
|
5439
5687
|
},
|
|
5440
5688
|
reporterUserId: {
|
|
5441
5689
|
ref: "User",
|
|
5442
5690
|
required: true,
|
|
5443
|
-
type:
|
|
5691
|
+
type: import_mongoose4.default.Schema.Types.ObjectId
|
|
5444
5692
|
},
|
|
5445
5693
|
resolved: { default: false, required: true, type: Boolean }
|
|
5446
5694
|
},
|
|
@@ -5448,18 +5696,18 @@ var ChatReportSchema = new MongooseSchema3(
|
|
|
5448
5696
|
);
|
|
5449
5697
|
ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
|
|
5450
5698
|
ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
|
|
5451
|
-
var ChatReportModel =
|
|
5699
|
+
var ChatReportModel = import_mongoose4.default.models.ChatReport || import_mongoose4.default.model("ChatReport", ChatReportSchema);
|
|
5452
5700
|
|
|
5453
5701
|
// src/mongoose/global.ts
|
|
5454
|
-
var
|
|
5702
|
+
var import_mongoose7 = __toESM(require("mongoose"));
|
|
5455
5703
|
|
|
5456
5704
|
// src/mongoose/Relation.ts
|
|
5457
|
-
var
|
|
5705
|
+
var import_mongoose6 = __toESM(require("mongoose"));
|
|
5458
5706
|
|
|
5459
5707
|
// src/mongoose/event/EventInfo.ts
|
|
5460
|
-
var
|
|
5461
|
-
var
|
|
5462
|
-
var StallTypeSchema = new
|
|
5708
|
+
var import_mongoose5 = __toESM(require("mongoose"));
|
|
5709
|
+
var MongooseSchema5 = import_mongoose5.default.Schema;
|
|
5710
|
+
var StallTypeSchema = new MongooseSchema5(
|
|
5463
5711
|
{
|
|
5464
5712
|
label: { required: false, type: String },
|
|
5465
5713
|
price: { required: false, type: Number },
|
|
@@ -5470,7 +5718,7 @@ var StallTypeSchema = new MongooseSchema4(
|
|
|
5470
5718
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5471
5719
|
}
|
|
5472
5720
|
);
|
|
5473
|
-
var dateTimeSchema = new
|
|
5721
|
+
var dateTimeSchema = new MongooseSchema5(
|
|
5474
5722
|
{
|
|
5475
5723
|
dateStatus: {
|
|
5476
5724
|
enum: Object.values(EnumEventDateStatus),
|
|
@@ -5486,7 +5734,7 @@ var dateTimeSchema = new MongooseSchema4(
|
|
|
5486
5734
|
{ _id: false }
|
|
5487
5735
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5488
5736
|
);
|
|
5489
|
-
var paymentInfoSchema = new
|
|
5737
|
+
var paymentInfoSchema = new MongooseSchema5(
|
|
5490
5738
|
{
|
|
5491
5739
|
accountHolderName: { required: false, type: String },
|
|
5492
5740
|
accountNumber: { required: false, type: String },
|
|
@@ -5500,7 +5748,7 @@ var paymentInfoSchema = new MongooseSchema4(
|
|
|
5500
5748
|
{ _id: false }
|
|
5501
5749
|
// Prevents Mongoose from creating an additional _id field
|
|
5502
5750
|
);
|
|
5503
|
-
var requirementsSchema = new
|
|
5751
|
+
var requirementsSchema = new MongooseSchema5(
|
|
5504
5752
|
{
|
|
5505
5753
|
category: { required: true, type: String },
|
|
5506
5754
|
label: { required: true, type: String },
|
|
@@ -5511,7 +5759,7 @@ var requirementsSchema = new MongooseSchema4(
|
|
|
5511
5759
|
// Prevents Mongoose from creating an additional _id field for
|
|
5512
5760
|
}
|
|
5513
5761
|
);
|
|
5514
|
-
var refundPolicySchema = new
|
|
5762
|
+
var refundPolicySchema = new MongooseSchema5(
|
|
5515
5763
|
{
|
|
5516
5764
|
category: { required: true, type: String },
|
|
5517
5765
|
label: { required: true, type: String },
|
|
@@ -5519,7 +5767,7 @@ var refundPolicySchema = new MongooseSchema4(
|
|
|
5519
5767
|
},
|
|
5520
5768
|
{ _id: false }
|
|
5521
5769
|
);
|
|
5522
|
-
var
|
|
5770
|
+
var schema3 = new MongooseSchema5(
|
|
5523
5771
|
{
|
|
5524
5772
|
active: { default: true, type: Boolean },
|
|
5525
5773
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -5527,7 +5775,7 @@ var schema2 = new MongooseSchema4(
|
|
|
5527
5775
|
eventId: {
|
|
5528
5776
|
ref: "Event",
|
|
5529
5777
|
required: true,
|
|
5530
|
-
type:
|
|
5778
|
+
type: import_mongoose5.default.Schema.Types.ObjectId
|
|
5531
5779
|
},
|
|
5532
5780
|
packInTime: { required: true, type: Number },
|
|
5533
5781
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -5537,11 +5785,11 @@ var schema2 = new MongooseSchema4(
|
|
|
5537
5785
|
},
|
|
5538
5786
|
{ timestamps: true }
|
|
5539
5787
|
);
|
|
5540
|
-
var EventInfoModel =
|
|
5788
|
+
var EventInfoModel = import_mongoose5.default.models.EventInfo || import_mongoose5.default.model("EventInfo", schema3);
|
|
5541
5789
|
|
|
5542
5790
|
// src/mongoose/Relation.ts
|
|
5543
|
-
var
|
|
5544
|
-
var relationDateTimeSchema = new
|
|
5791
|
+
var MongooseSchema6 = import_mongoose6.default.Schema;
|
|
5792
|
+
var relationDateTimeSchema = new MongooseSchema6(
|
|
5545
5793
|
{
|
|
5546
5794
|
dateStatus: {
|
|
5547
5795
|
enum: Object.values(EnumEventDateStatus),
|
|
@@ -5556,7 +5804,7 @@ var relationDateTimeSchema = new MongooseSchema5(
|
|
|
5556
5804
|
},
|
|
5557
5805
|
{ _id: false }
|
|
5558
5806
|
);
|
|
5559
|
-
var relationDatesSchema = new
|
|
5807
|
+
var relationDatesSchema = new MongooseSchema6(
|
|
5560
5808
|
{
|
|
5561
5809
|
dateTime: {
|
|
5562
5810
|
required: true,
|
|
@@ -5575,19 +5823,19 @@ var relationDatesSchema = new MongooseSchema5(
|
|
|
5575
5823
|
},
|
|
5576
5824
|
{ _id: false }
|
|
5577
5825
|
);
|
|
5578
|
-
var RelationTypeSchema = new
|
|
5826
|
+
var RelationTypeSchema = new MongooseSchema6(
|
|
5579
5827
|
{
|
|
5580
5828
|
active: { default: true, required: true, type: Boolean },
|
|
5581
5829
|
chatId: {
|
|
5582
5830
|
ref: "Chat",
|
|
5583
5831
|
required: true,
|
|
5584
|
-
type:
|
|
5832
|
+
type: import_mongoose6.default.Schema.Types.ObjectId
|
|
5585
5833
|
},
|
|
5586
5834
|
deletedAt: { default: null, required: false, type: Date },
|
|
5587
5835
|
eventId: {
|
|
5588
5836
|
ref: "Event",
|
|
5589
5837
|
required: true,
|
|
5590
|
-
type:
|
|
5838
|
+
type: import_mongoose6.default.Schema.Types.ObjectId
|
|
5591
5839
|
},
|
|
5592
5840
|
lastUpdateBy: {
|
|
5593
5841
|
enum: Object.values(EnumResourceType),
|
|
@@ -5603,7 +5851,7 @@ var RelationTypeSchema = new MongooseSchema5(
|
|
|
5603
5851
|
vendorId: {
|
|
5604
5852
|
ref: "Vendor",
|
|
5605
5853
|
required: true,
|
|
5606
|
-
type:
|
|
5854
|
+
type: import_mongoose6.default.Schema.Types.ObjectId
|
|
5607
5855
|
}
|
|
5608
5856
|
},
|
|
5609
5857
|
{ timestamps: true }
|
|
@@ -5615,23 +5863,23 @@ RelationTypeSchema.index({
|
|
|
5615
5863
|
"relationDates.status": 1,
|
|
5616
5864
|
vendorId: 1
|
|
5617
5865
|
});
|
|
5618
|
-
var RelationModel =
|
|
5866
|
+
var RelationModel = import_mongoose6.default.models.Relation || import_mongoose6.default.model("Relation", RelationTypeSchema);
|
|
5619
5867
|
|
|
5620
5868
|
// src/mongoose/global.ts
|
|
5621
|
-
var
|
|
5622
|
-
var OwnerTypeSchema = new
|
|
5869
|
+
var MongooseSchema7 = import_mongoose7.default.Schema;
|
|
5870
|
+
var OwnerTypeSchema = new MongooseSchema7(
|
|
5623
5871
|
{
|
|
5624
5872
|
email: { required: true, type: String },
|
|
5625
5873
|
userId: {
|
|
5626
5874
|
ref: "User",
|
|
5627
5875
|
required: true,
|
|
5628
|
-
type:
|
|
5876
|
+
type: import_mongoose7.default.Schema.Types.ObjectId
|
|
5629
5877
|
}
|
|
5630
5878
|
},
|
|
5631
5879
|
{ _id: false }
|
|
5632
5880
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5633
5881
|
);
|
|
5634
|
-
var SocialMediaTypeSchema = new
|
|
5882
|
+
var SocialMediaTypeSchema = new MongooseSchema7(
|
|
5635
5883
|
{
|
|
5636
5884
|
link: { required: true, type: String },
|
|
5637
5885
|
name: { required: true, type: String }
|
|
@@ -5639,7 +5887,7 @@ var SocialMediaTypeSchema = new MongooseSchema6(
|
|
|
5639
5887
|
{ _id: false }
|
|
5640
5888
|
// Prevents Mongoose from creating an additional _id field
|
|
5641
5889
|
);
|
|
5642
|
-
var ResourceImageTypeSchema = new
|
|
5890
|
+
var ResourceImageTypeSchema = new MongooseSchema7(
|
|
5643
5891
|
{
|
|
5644
5892
|
active: { default: true, required: true, type: Boolean },
|
|
5645
5893
|
source: { required: false, type: String },
|
|
@@ -5648,7 +5896,7 @@ var ResourceImageTypeSchema = new MongooseSchema6(
|
|
|
5648
5896
|
{ _id: false }
|
|
5649
5897
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5650
5898
|
);
|
|
5651
|
-
var SubCategorySchema = new
|
|
5899
|
+
var SubCategorySchema = new MongooseSchema7(
|
|
5652
5900
|
{
|
|
5653
5901
|
id: { required: false, type: String },
|
|
5654
5902
|
items: [
|
|
@@ -5662,7 +5910,7 @@ var SubCategorySchema = new MongooseSchema6(
|
|
|
5662
5910
|
{ _id: false }
|
|
5663
5911
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5664
5912
|
);
|
|
5665
|
-
var CategorySchema = new
|
|
5913
|
+
var CategorySchema = new MongooseSchema7(
|
|
5666
5914
|
{
|
|
5667
5915
|
id: { required: true, type: String },
|
|
5668
5916
|
name: { required: true, type: String },
|
|
@@ -5671,7 +5919,7 @@ var CategorySchema = new MongooseSchema6(
|
|
|
5671
5919
|
{ _id: false }
|
|
5672
5920
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5673
5921
|
);
|
|
5674
|
-
var PosterUsageTypeSchema = new
|
|
5922
|
+
var PosterUsageTypeSchema = new MongooseSchema7(
|
|
5675
5923
|
{
|
|
5676
5924
|
count: { default: 0, required: false, type: Number },
|
|
5677
5925
|
month: { required: false, type: String }
|
|
@@ -5679,7 +5927,7 @@ var PosterUsageTypeSchema = new MongooseSchema6(
|
|
|
5679
5927
|
{ _id: false }
|
|
5680
5928
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5681
5929
|
);
|
|
5682
|
-
var userLicenseSchema = new
|
|
5930
|
+
var userLicenseSchema = new MongooseSchema7(
|
|
5683
5931
|
{
|
|
5684
5932
|
expiryDate: { required: true, type: Date },
|
|
5685
5933
|
issuedDate: { required: true, type: Date },
|
|
@@ -5696,7 +5944,7 @@ var userLicenseSchema = new MongooseSchema6(
|
|
|
5696
5944
|
},
|
|
5697
5945
|
{ _id: false, timestamps: false }
|
|
5698
5946
|
);
|
|
5699
|
-
var ContactDetailsSchema = new
|
|
5947
|
+
var ContactDetailsSchema = new MongooseSchema7(
|
|
5700
5948
|
{
|
|
5701
5949
|
email: { required: false, type: String },
|
|
5702
5950
|
landlinePhone: { required: false, type: String },
|
|
@@ -5705,7 +5953,7 @@ var ContactDetailsSchema = new MongooseSchema6(
|
|
|
5705
5953
|
{ _id: false }
|
|
5706
5954
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5707
5955
|
);
|
|
5708
|
-
var termsAgreementSchema = new
|
|
5956
|
+
var termsAgreementSchema = new MongooseSchema7(
|
|
5709
5957
|
{
|
|
5710
5958
|
appBuildNumber: { required: true, type: String },
|
|
5711
5959
|
appId: { required: true, type: String },
|
|
@@ -5722,7 +5970,7 @@ var termsAgreementSchema = new MongooseSchema6(
|
|
|
5722
5970
|
},
|
|
5723
5971
|
{ _id: false }
|
|
5724
5972
|
);
|
|
5725
|
-
var resourceRelationsSchema = new
|
|
5973
|
+
var resourceRelationsSchema = new MongooseSchema7(
|
|
5726
5974
|
{
|
|
5727
5975
|
relationDates: {
|
|
5728
5976
|
default: [],
|
|
@@ -5732,12 +5980,12 @@ var resourceRelationsSchema = new MongooseSchema6(
|
|
|
5732
5980
|
relationId: {
|
|
5733
5981
|
ref: "Relation",
|
|
5734
5982
|
required: false,
|
|
5735
|
-
type:
|
|
5983
|
+
type: import_mongoose7.default.Schema.Types.ObjectId
|
|
5736
5984
|
}
|
|
5737
5985
|
},
|
|
5738
5986
|
{ _id: false }
|
|
5739
5987
|
);
|
|
5740
|
-
var dateTimeSchema2 = new
|
|
5988
|
+
var dateTimeSchema2 = new MongooseSchema7(
|
|
5741
5989
|
{
|
|
5742
5990
|
dateStatus: {
|
|
5743
5991
|
enum: Object.values(EnumEventDateStatus),
|
|
@@ -5752,7 +6000,7 @@ var dateTimeSchema2 = new MongooseSchema6(
|
|
|
5752
6000
|
{ _id: false }
|
|
5753
6001
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5754
6002
|
);
|
|
5755
|
-
var locationGeoSchema = new
|
|
6003
|
+
var locationGeoSchema = new MongooseSchema7(
|
|
5756
6004
|
{
|
|
5757
6005
|
coordinates: { required: true, type: [Number] },
|
|
5758
6006
|
// [longitude, latitude]
|
|
@@ -5761,7 +6009,7 @@ var locationGeoSchema = new MongooseSchema6(
|
|
|
5761
6009
|
{ _id: false }
|
|
5762
6010
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5763
6011
|
);
|
|
5764
|
-
var locationsSchema = new
|
|
6012
|
+
var locationsSchema = new MongooseSchema7(
|
|
5765
6013
|
{
|
|
5766
6014
|
city: { required: true, type: String },
|
|
5767
6015
|
country: { required: true, type: String },
|
|
@@ -5777,13 +6025,13 @@ var locationsSchema = new MongooseSchema6(
|
|
|
5777
6025
|
{ _id: false }
|
|
5778
6026
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5779
6027
|
);
|
|
5780
|
-
var relatedPostSchema = new
|
|
6028
|
+
var relatedPostSchema = new MongooseSchema7(
|
|
5781
6029
|
{
|
|
5782
6030
|
postActive: { default: true, required: true, type: Boolean },
|
|
5783
6031
|
postId: {
|
|
5784
6032
|
ref: "Post",
|
|
5785
6033
|
required: true,
|
|
5786
|
-
type:
|
|
6034
|
+
type: import_mongoose7.default.Schema.Types.ObjectId
|
|
5787
6035
|
},
|
|
5788
6036
|
postSlug: { required: true, type: String },
|
|
5789
6037
|
postType: {
|
|
@@ -5795,7 +6043,7 @@ var relatedPostSchema = new MongooseSchema6(
|
|
|
5795
6043
|
{ _id: false }
|
|
5796
6044
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
5797
6045
|
);
|
|
5798
|
-
var socialShareResourceSchema = new
|
|
6046
|
+
var socialShareResourceSchema = new MongooseSchema7(
|
|
5799
6047
|
{
|
|
5800
6048
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
5801
6049
|
socialImage: { required: true, type: ResourceImageTypeSchema }
|
|
@@ -5808,7 +6056,7 @@ var baseResourceFields = {
|
|
|
5808
6056
|
adIds: {
|
|
5809
6057
|
ref: "Ad",
|
|
5810
6058
|
required: false,
|
|
5811
|
-
type: [
|
|
6059
|
+
type: [import_mongoose7.default.Schema.Types.ObjectId]
|
|
5812
6060
|
},
|
|
5813
6061
|
approvedAt: { default: null, required: false, type: Date },
|
|
5814
6062
|
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
@@ -5838,9 +6086,9 @@ var baseResourceFields = {
|
|
|
5838
6086
|
};
|
|
5839
6087
|
|
|
5840
6088
|
// src/mongoose/GoogleImportedMarket.ts
|
|
5841
|
-
var
|
|
5842
|
-
var
|
|
5843
|
-
var addressComponentSchema = new
|
|
6089
|
+
var import_mongoose8 = __toESM(require("mongoose"));
|
|
6090
|
+
var MongooseSchema8 = import_mongoose8.default.Schema;
|
|
6091
|
+
var addressComponentSchema = new MongooseSchema8(
|
|
5844
6092
|
{
|
|
5845
6093
|
longName: { required: false, type: String },
|
|
5846
6094
|
shortName: { required: false, type: String },
|
|
@@ -5848,7 +6096,7 @@ var addressComponentSchema = new MongooseSchema7(
|
|
|
5848
6096
|
},
|
|
5849
6097
|
{ _id: false }
|
|
5850
6098
|
);
|
|
5851
|
-
var
|
|
6099
|
+
var schema4 = new MongooseSchema8(
|
|
5852
6100
|
{
|
|
5853
6101
|
active: { default: false, required: true, type: Boolean },
|
|
5854
6102
|
address: { required: true, type: String },
|
|
@@ -5860,7 +6108,7 @@ var schema3 = new MongooseSchema7(
|
|
|
5860
6108
|
claimedByUserId: {
|
|
5861
6109
|
ref: "User",
|
|
5862
6110
|
required: false,
|
|
5863
|
-
type:
|
|
6111
|
+
type: import_mongoose8.default.Schema.Types.ObjectId
|
|
5864
6112
|
},
|
|
5865
6113
|
cover: {
|
|
5866
6114
|
required: false,
|
|
@@ -5872,7 +6120,7 @@ var schema3 = new MongooseSchema7(
|
|
|
5872
6120
|
eventId: {
|
|
5873
6121
|
ref: "Event",
|
|
5874
6122
|
required: false,
|
|
5875
|
-
type:
|
|
6123
|
+
type: import_mongoose8.default.Schema.Types.ObjectId
|
|
5876
6124
|
},
|
|
5877
6125
|
eventType: {
|
|
5878
6126
|
enum: Object.values(EnumEventType),
|
|
@@ -5911,18 +6159,18 @@ var schema3 = new MongooseSchema7(
|
|
|
5911
6159
|
},
|
|
5912
6160
|
{ timestamps: true }
|
|
5913
6161
|
);
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
var GoogleImportedMarketModel =
|
|
6162
|
+
schema4.index({ "location.geo": "2dsphere" });
|
|
6163
|
+
schema4.index({ name: 1 });
|
|
6164
|
+
schema4.index({ region: 1 });
|
|
6165
|
+
schema4.index({ deletedAt: 1 });
|
|
6166
|
+
schema4.index({ "dateTime.dateStatus": 1 });
|
|
6167
|
+
schema4.index({ slug: 1 });
|
|
6168
|
+
var GoogleImportedMarketModel = import_mongoose8.default.models.GoogleImportedMarket || import_mongoose8.default.model("GoogleImportedMarket", schema4);
|
|
5921
6169
|
|
|
5922
6170
|
// src/mongoose/Notification.ts
|
|
5923
|
-
var
|
|
5924
|
-
var
|
|
5925
|
-
var
|
|
6171
|
+
var import_mongoose9 = __toESM(require("mongoose"));
|
|
6172
|
+
var MongooseSchema9 = import_mongoose9.default.Schema;
|
|
6173
|
+
var schema5 = new MongooseSchema9(
|
|
5926
6174
|
{
|
|
5927
6175
|
data: {
|
|
5928
6176
|
resourceId: { required: true, type: String },
|
|
@@ -5945,16 +6193,16 @@ var schema4 = new MongooseSchema8(
|
|
|
5945
6193
|
userId: {
|
|
5946
6194
|
ref: "User",
|
|
5947
6195
|
required: true,
|
|
5948
|
-
type:
|
|
6196
|
+
type: import_mongoose9.default.Schema.Types.ObjectId
|
|
5949
6197
|
}
|
|
5950
6198
|
},
|
|
5951
6199
|
{ timestamps: true }
|
|
5952
6200
|
);
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
var NotificationModel =
|
|
6201
|
+
schema5.index({ isRead: 1, userId: 1 });
|
|
6202
|
+
schema5.index({ createdAt: -1, userId: 1 });
|
|
6203
|
+
var NotificationModel = import_mongoose9.default.models.Notification || import_mongoose9.default.model("Notification", schema5);
|
|
5956
6204
|
|
|
5957
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
6205
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-P4NLBWEJ.mjs
|
|
5958
6206
|
var EnumInviteStatus2 = /* @__PURE__ */ ((EnumInviteStatus22) => {
|
|
5959
6207
|
EnumInviteStatus22["ACCEPTED"] = "Accepted";
|
|
5960
6208
|
EnumInviteStatus22["COMPLETED"] = "Completed";
|
|
@@ -6032,9 +6280,9 @@ var EnumSubscriptionStatus2 = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
|
|
|
6032
6280
|
})(EnumSubscriptionStatus2 || {});
|
|
6033
6281
|
|
|
6034
6282
|
// src/mongoose/PushToken.ts
|
|
6035
|
-
var
|
|
6036
|
-
var
|
|
6037
|
-
var
|
|
6283
|
+
var import_mongoose10 = __toESM(require("mongoose"));
|
|
6284
|
+
var MongooseSchema10 = import_mongoose10.default.Schema;
|
|
6285
|
+
var schema6 = new MongooseSchema10(
|
|
6038
6286
|
{
|
|
6039
6287
|
platform: {
|
|
6040
6288
|
enum: Object.values(EnumOSPlatform2),
|
|
@@ -6045,17 +6293,17 @@ var schema5 = new MongooseSchema9(
|
|
|
6045
6293
|
userId: {
|
|
6046
6294
|
ref: "User",
|
|
6047
6295
|
required: true,
|
|
6048
|
-
type:
|
|
6296
|
+
type: import_mongoose10.default.Schema.Types.ObjectId
|
|
6049
6297
|
}
|
|
6050
6298
|
},
|
|
6051
6299
|
{ timestamps: true }
|
|
6052
6300
|
);
|
|
6053
|
-
var PushTokenModel =
|
|
6301
|
+
var PushTokenModel = import_mongoose10.default.models.PushToken || import_mongoose10.default.model("PushToken", schema6);
|
|
6054
6302
|
|
|
6055
6303
|
// src/mongoose/ResourceActivity.ts
|
|
6056
|
-
var
|
|
6057
|
-
var
|
|
6058
|
-
var ActivitySchema = new
|
|
6304
|
+
var import_mongoose11 = __toESM(require("mongoose"));
|
|
6305
|
+
var MongooseSchema11 = import_mongoose11.default.Schema;
|
|
6306
|
+
var ActivitySchema = new MongooseSchema11(
|
|
6059
6307
|
{
|
|
6060
6308
|
activityType: {
|
|
6061
6309
|
enum: Object.values(EnumActivity),
|
|
@@ -6083,7 +6331,7 @@ var ActivitySchema = new MongooseSchema10(
|
|
|
6083
6331
|
},
|
|
6084
6332
|
{ _id: false }
|
|
6085
6333
|
);
|
|
6086
|
-
var
|
|
6334
|
+
var schema7 = new MongooseSchema11(
|
|
6087
6335
|
{
|
|
6088
6336
|
activity: { default: [], type: [ActivitySchema] },
|
|
6089
6337
|
resourceId: { required: true, type: String },
|
|
@@ -6095,46 +6343,55 @@ var schema6 = new MongooseSchema10(
|
|
|
6095
6343
|
},
|
|
6096
6344
|
{ timestamps: true }
|
|
6097
6345
|
);
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
var ResourceActivityModel =
|
|
6346
|
+
schema7.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
6347
|
+
schema7.index({ "views.location": "2dsphere" });
|
|
6348
|
+
var ResourceActivityModel = import_mongoose11.default.models.ResourceActivity || import_mongoose11.default.model("ResourceActivity", schema7);
|
|
6101
6349
|
|
|
6102
6350
|
// src/mongoose/User.ts
|
|
6103
|
-
var
|
|
6104
|
-
var
|
|
6105
|
-
var userActivityEventSchema = new
|
|
6351
|
+
var import_mongoose12 = __toESM(require("mongoose"));
|
|
6352
|
+
var MongooseSchema12 = import_mongoose12.default.Schema;
|
|
6353
|
+
var userActivityEventSchema = new MongooseSchema12(
|
|
6106
6354
|
{
|
|
6107
6355
|
dateTime: dateTimeSchema2,
|
|
6108
6356
|
resourceId: {
|
|
6109
6357
|
ref: "Event",
|
|
6110
6358
|
required: false,
|
|
6111
|
-
type:
|
|
6359
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
6112
6360
|
}
|
|
6113
6361
|
},
|
|
6114
6362
|
{ _id: false }
|
|
6115
6363
|
);
|
|
6116
|
-
var userActivityFavouritesSchema = new
|
|
6364
|
+
var userActivityFavouritesSchema = new MongooseSchema12(
|
|
6117
6365
|
{
|
|
6118
6366
|
events: {
|
|
6119
6367
|
ref: "Event",
|
|
6120
6368
|
required: false,
|
|
6121
|
-
type: [
|
|
6369
|
+
type: [import_mongoose12.default.Schema.Types.ObjectId]
|
|
6122
6370
|
},
|
|
6123
6371
|
partners: {
|
|
6124
6372
|
ref: "Partner",
|
|
6125
6373
|
required: false,
|
|
6126
|
-
type: [
|
|
6374
|
+
type: [import_mongoose12.default.Schema.Types.ObjectId]
|
|
6127
6375
|
},
|
|
6128
6376
|
vendors: {
|
|
6129
6377
|
ref: "Vendor",
|
|
6130
6378
|
required: false,
|
|
6131
|
-
type: [
|
|
6379
|
+
type: [import_mongoose12.default.Schema.Types.ObjectId]
|
|
6132
6380
|
}
|
|
6133
6381
|
},
|
|
6134
6382
|
{ _id: false }
|
|
6135
6383
|
);
|
|
6136
|
-
var stripeSchema = new
|
|
6384
|
+
var stripeSchema = new MongooseSchema12(
|
|
6137
6385
|
{
|
|
6386
|
+
billingPeriod: {
|
|
6387
|
+
enum: Object.values(EnumBillingPeriod),
|
|
6388
|
+
required: false,
|
|
6389
|
+
type: String
|
|
6390
|
+
},
|
|
6391
|
+
cancelAtPeriodEnd: {
|
|
6392
|
+
required: false,
|
|
6393
|
+
type: Boolean
|
|
6394
|
+
},
|
|
6138
6395
|
currentPlan: {
|
|
6139
6396
|
enum: Object.values(EnumUserLicence),
|
|
6140
6397
|
required: false,
|
|
@@ -6148,6 +6405,28 @@ var stripeSchema = new MongooseSchema11(
|
|
|
6148
6405
|
required: false,
|
|
6149
6406
|
type: Date
|
|
6150
6407
|
},
|
|
6408
|
+
pendingBillingPeriod: {
|
|
6409
|
+
enum: Object.values(EnumBillingPeriod),
|
|
6410
|
+
required: false,
|
|
6411
|
+
type: String
|
|
6412
|
+
},
|
|
6413
|
+
pendingChangeEffectiveAt: {
|
|
6414
|
+
required: false,
|
|
6415
|
+
type: Date
|
|
6416
|
+
},
|
|
6417
|
+
pendingPlan: {
|
|
6418
|
+
enum: Object.values(EnumUserLicence),
|
|
6419
|
+
required: false,
|
|
6420
|
+
type: String
|
|
6421
|
+
},
|
|
6422
|
+
priceId: {
|
|
6423
|
+
required: false,
|
|
6424
|
+
type: String
|
|
6425
|
+
},
|
|
6426
|
+
scheduleId: {
|
|
6427
|
+
required: false,
|
|
6428
|
+
type: String
|
|
6429
|
+
},
|
|
6151
6430
|
startDate: {
|
|
6152
6431
|
required: false,
|
|
6153
6432
|
type: Date
|
|
@@ -6160,11 +6439,19 @@ var stripeSchema = new MongooseSchema11(
|
|
|
6160
6439
|
subscriptionId: {
|
|
6161
6440
|
required: false,
|
|
6162
6441
|
type: String
|
|
6442
|
+
},
|
|
6443
|
+
subscriptionMutationLockExpiresAt: {
|
|
6444
|
+
required: false,
|
|
6445
|
+
type: Date
|
|
6446
|
+
},
|
|
6447
|
+
subscriptionMutationLockId: {
|
|
6448
|
+
required: false,
|
|
6449
|
+
type: String
|
|
6163
6450
|
}
|
|
6164
6451
|
},
|
|
6165
6452
|
{ _id: false }
|
|
6166
6453
|
);
|
|
6167
|
-
var redeemedRewardSchema = new
|
|
6454
|
+
var redeemedRewardSchema = new MongooseSchema12(
|
|
6168
6455
|
{
|
|
6169
6456
|
name: {
|
|
6170
6457
|
enum: Object.values(EnumReward),
|
|
@@ -6176,13 +6463,13 @@ var redeemedRewardSchema = new MongooseSchema11(
|
|
|
6176
6463
|
},
|
|
6177
6464
|
{ _id: false }
|
|
6178
6465
|
);
|
|
6179
|
-
var
|
|
6466
|
+
var schema8 = new MongooseSchema12(
|
|
6180
6467
|
{
|
|
6181
6468
|
active: { default: false, required: true, type: Boolean },
|
|
6182
6469
|
affiliate: {
|
|
6183
6470
|
ref: "Affiliate",
|
|
6184
6471
|
required: false,
|
|
6185
|
-
type:
|
|
6472
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
6186
6473
|
},
|
|
6187
6474
|
avatar: {
|
|
6188
6475
|
required: false,
|
|
@@ -6191,7 +6478,7 @@ var schema7 = new MongooseSchema11(
|
|
|
6191
6478
|
coupon: {
|
|
6192
6479
|
ref: "Coupon",
|
|
6193
6480
|
required: false,
|
|
6194
|
-
type:
|
|
6481
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
6195
6482
|
},
|
|
6196
6483
|
deletedAt: { default: null, required: false, type: Date },
|
|
6197
6484
|
email: { required: true, type: String },
|
|
@@ -6203,13 +6490,13 @@ var schema7 = new MongooseSchema11(
|
|
|
6203
6490
|
events: {
|
|
6204
6491
|
ref: "Event",
|
|
6205
6492
|
required: false,
|
|
6206
|
-
type: [
|
|
6493
|
+
type: [import_mongoose12.default.Schema.Types.ObjectId]
|
|
6207
6494
|
},
|
|
6208
6495
|
firstName: { required: true, type: String },
|
|
6209
6496
|
game: {
|
|
6210
6497
|
ref: "Game",
|
|
6211
6498
|
required: false,
|
|
6212
|
-
type:
|
|
6499
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
6213
6500
|
},
|
|
6214
6501
|
interests: {
|
|
6215
6502
|
enum: Object.values(EnumResourceType),
|
|
@@ -6231,7 +6518,7 @@ var schema7 = new MongooseSchema11(
|
|
|
6231
6518
|
partner: {
|
|
6232
6519
|
ref: "Partner",
|
|
6233
6520
|
required: false,
|
|
6234
|
-
type:
|
|
6521
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
6235
6522
|
},
|
|
6236
6523
|
password: { required: true, type: String },
|
|
6237
6524
|
platform: {
|
|
@@ -6264,7 +6551,7 @@ var schema7 = new MongooseSchema11(
|
|
|
6264
6551
|
school: {
|
|
6265
6552
|
ref: "School",
|
|
6266
6553
|
required: false,
|
|
6267
|
-
type:
|
|
6554
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
6268
6555
|
},
|
|
6269
6556
|
stripe: {
|
|
6270
6557
|
required: false,
|
|
@@ -6289,19 +6576,19 @@ var schema7 = new MongooseSchema11(
|
|
|
6289
6576
|
vendor: {
|
|
6290
6577
|
ref: "Vendor",
|
|
6291
6578
|
required: false,
|
|
6292
|
-
type:
|
|
6579
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
6293
6580
|
}
|
|
6294
6581
|
},
|
|
6295
6582
|
{ strict: false, timestamps: true }
|
|
6296
6583
|
);
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
var UserModel =
|
|
6584
|
+
schema8.index({ "licences.expiryDate": 1 });
|
|
6585
|
+
schema8.index({ "licences.licenceType": 1 });
|
|
6586
|
+
var UserModel = import_mongoose12.default.models.User || import_mongoose12.default.model("User", schema8);
|
|
6300
6587
|
|
|
6301
6588
|
// src/mongoose/VerificationToken.ts
|
|
6302
|
-
var
|
|
6303
|
-
var
|
|
6304
|
-
var
|
|
6589
|
+
var import_mongoose13 = __toESM(require("mongoose"));
|
|
6590
|
+
var MongooseSchema13 = import_mongoose13.default.Schema;
|
|
6591
|
+
var schema9 = new MongooseSchema13(
|
|
6305
6592
|
{
|
|
6306
6593
|
createdAt: {
|
|
6307
6594
|
default: Date.now,
|
|
@@ -6316,12 +6603,12 @@ var schema8 = new MongooseSchema12(
|
|
|
6316
6603
|
},
|
|
6317
6604
|
{ timestamps: true }
|
|
6318
6605
|
);
|
|
6319
|
-
var VerificationTokenModel =
|
|
6606
|
+
var VerificationTokenModel = import_mongoose13.default.models.VerificationToken || import_mongoose13.default.model("VerificationToken", schema9);
|
|
6320
6607
|
|
|
6321
6608
|
// src/mongoose/vendor/Vendor.ts
|
|
6322
|
-
var
|
|
6323
|
-
var
|
|
6324
|
-
var vendorProductTypeSchema = new
|
|
6609
|
+
var import_mongoose14 = __toESM(require("mongoose"));
|
|
6610
|
+
var MongooseSchema14 = import_mongoose14.default.Schema;
|
|
6611
|
+
var vendorProductTypeSchema = new MongooseSchema14(
|
|
6325
6612
|
{
|
|
6326
6613
|
description: { required: false, type: String },
|
|
6327
6614
|
name: { required: true, type: String },
|
|
@@ -6332,14 +6619,14 @@ var vendorProductTypeSchema = new MongooseSchema13(
|
|
|
6332
6619
|
},
|
|
6333
6620
|
{ timestamps: true }
|
|
6334
6621
|
);
|
|
6335
|
-
var productWrapperSchema = new
|
|
6622
|
+
var productWrapperSchema = new MongooseSchema14(
|
|
6336
6623
|
{
|
|
6337
6624
|
active: { default: false, required: false, type: Boolean },
|
|
6338
6625
|
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
6339
6626
|
},
|
|
6340
6627
|
{ _id: false }
|
|
6341
6628
|
);
|
|
6342
|
-
var calendarSchema = new
|
|
6629
|
+
var calendarSchema = new MongooseSchema14(
|
|
6343
6630
|
{
|
|
6344
6631
|
dateTime: {
|
|
6345
6632
|
dateStatus: {
|
|
@@ -6360,14 +6647,14 @@ var calendarSchema = new MongooseSchema13(
|
|
|
6360
6647
|
},
|
|
6361
6648
|
{ _id: false }
|
|
6362
6649
|
);
|
|
6363
|
-
var calendarWrapperSchema = new
|
|
6650
|
+
var calendarWrapperSchema = new MongooseSchema14(
|
|
6364
6651
|
{
|
|
6365
6652
|
active: { default: false, required: true, type: Boolean },
|
|
6366
6653
|
calendarData: { required: false, type: [calendarSchema] }
|
|
6367
6654
|
},
|
|
6368
6655
|
{ _id: false }
|
|
6369
6656
|
);
|
|
6370
|
-
var
|
|
6657
|
+
var schema10 = new MongooseSchema14(
|
|
6371
6658
|
{
|
|
6372
6659
|
...baseResourceFields,
|
|
6373
6660
|
// Importing base resource fields from global.ts
|
|
@@ -6393,12 +6680,12 @@ var schema9 = new MongooseSchema13(
|
|
|
6393
6680
|
unregisteredVendorId: {
|
|
6394
6681
|
ref: "UnregisteredVendor",
|
|
6395
6682
|
required: false,
|
|
6396
|
-
type:
|
|
6683
|
+
type: import_mongoose14.default.Schema.Types.ObjectId
|
|
6397
6684
|
},
|
|
6398
6685
|
vendorInfoId: {
|
|
6399
6686
|
ref: "VendorInfo",
|
|
6400
6687
|
required: false,
|
|
6401
|
-
type:
|
|
6688
|
+
type: import_mongoose14.default.Schema.Types.ObjectId
|
|
6402
6689
|
},
|
|
6403
6690
|
vendorType: {
|
|
6404
6691
|
enum: Object.values(EnumVendorType),
|
|
@@ -6408,24 +6695,24 @@ var schema9 = new MongooseSchema13(
|
|
|
6408
6695
|
},
|
|
6409
6696
|
{ timestamps: true }
|
|
6410
6697
|
);
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
var VendorModel =
|
|
6698
|
+
schema10.index({ name: 1 });
|
|
6699
|
+
schema10.index({ description: 1 });
|
|
6700
|
+
schema10.index({ region: 1 });
|
|
6701
|
+
schema10.index({ "categories.name": 1 });
|
|
6702
|
+
schema10.index({ slug: 1 });
|
|
6703
|
+
var VendorModel = import_mongoose14.default.models.Vendor || import_mongoose14.default.model("Vendor", schema10);
|
|
6417
6704
|
|
|
6418
6705
|
// src/mongoose/vendor/VendorInfo.ts
|
|
6419
|
-
var
|
|
6420
|
-
var
|
|
6421
|
-
var AttributesSchema = new
|
|
6706
|
+
var import_mongoose15 = __toESM(require("mongoose"));
|
|
6707
|
+
var MongooseSchema15 = import_mongoose15.default.Schema;
|
|
6708
|
+
var AttributesSchema = new MongooseSchema15(
|
|
6422
6709
|
{
|
|
6423
6710
|
details: { required: false, type: String },
|
|
6424
6711
|
isRequired: { default: false, required: true, type: Boolean }
|
|
6425
6712
|
},
|
|
6426
6713
|
{ _id: false }
|
|
6427
6714
|
);
|
|
6428
|
-
var
|
|
6715
|
+
var schema11 = new MongooseSchema15(
|
|
6429
6716
|
{
|
|
6430
6717
|
active: { default: true, type: Boolean },
|
|
6431
6718
|
compliance: {
|
|
@@ -6460,28 +6747,28 @@ var schema10 = new MongooseSchema14(
|
|
|
6460
6747
|
vendorId: {
|
|
6461
6748
|
ref: "Vendor",
|
|
6462
6749
|
required: true,
|
|
6463
|
-
type:
|
|
6750
|
+
type: import_mongoose15.default.Schema.Types.ObjectId
|
|
6464
6751
|
}
|
|
6465
6752
|
},
|
|
6466
6753
|
{ timestamps: true }
|
|
6467
6754
|
);
|
|
6468
|
-
var VendorInfoModel =
|
|
6755
|
+
var VendorInfoModel = import_mongoose15.default.models.VendorInfo || import_mongoose15.default.model("VendorInfo", schema11);
|
|
6469
6756
|
|
|
6470
6757
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
6471
|
-
var
|
|
6472
|
-
var
|
|
6473
|
-
var invitationSchema = new
|
|
6758
|
+
var import_mongoose16 = __toESM(require("mongoose"));
|
|
6759
|
+
var MongooseSchema16 = import_mongoose16.default.Schema;
|
|
6760
|
+
var invitationSchema = new MongooseSchema16(
|
|
6474
6761
|
{
|
|
6475
6762
|
dateTime: { required: true, type: [dateTimeSchema2] },
|
|
6476
6763
|
inviterId: {
|
|
6477
6764
|
ref: "Event",
|
|
6478
6765
|
required: true,
|
|
6479
|
-
type:
|
|
6766
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
6480
6767
|
}
|
|
6481
6768
|
},
|
|
6482
6769
|
{ _id: false }
|
|
6483
6770
|
);
|
|
6484
|
-
var
|
|
6771
|
+
var schema12 = new MongooseSchema16(
|
|
6485
6772
|
{
|
|
6486
6773
|
active: { default: true, required: true, type: Boolean },
|
|
6487
6774
|
categoryIds: { required: true, type: [String] },
|
|
@@ -6490,7 +6777,7 @@ var schema11 = new MongooseSchema15(
|
|
|
6490
6777
|
claimedByUserId: {
|
|
6491
6778
|
ref: "User",
|
|
6492
6779
|
required: false,
|
|
6493
|
-
type:
|
|
6780
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
6494
6781
|
},
|
|
6495
6782
|
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
6496
6783
|
claimToken: { default: null, required: false, type: String },
|
|
@@ -6503,14 +6790,14 @@ var schema11 = new MongooseSchema15(
|
|
|
6503
6790
|
},
|
|
6504
6791
|
{ timestamps: true }
|
|
6505
6792
|
);
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
var UnregisteredVendorModel =
|
|
6793
|
+
schema12.index({ name: 1 });
|
|
6794
|
+
schema12.index({ email: 1 });
|
|
6795
|
+
var UnregisteredVendorModel = import_mongoose16.default.models.UnregisteredVendor || import_mongoose16.default.model("UnregisteredVendor", schema12);
|
|
6509
6796
|
|
|
6510
6797
|
// src/mongoose/event/Event.ts
|
|
6511
|
-
var
|
|
6512
|
-
var
|
|
6513
|
-
var
|
|
6798
|
+
var import_mongoose17 = __toESM(require("mongoose"));
|
|
6799
|
+
var MongooseSchema17 = import_mongoose17.default.Schema;
|
|
6800
|
+
var schema13 = new MongooseSchema17(
|
|
6514
6801
|
{
|
|
6515
6802
|
...baseResourceFields,
|
|
6516
6803
|
// Importing base resource fields from global.ts
|
|
@@ -6519,7 +6806,7 @@ var schema12 = new MongooseSchema16(
|
|
|
6519
6806
|
eventInfoId: {
|
|
6520
6807
|
ref: "EventInfo",
|
|
6521
6808
|
required: false,
|
|
6522
|
-
type:
|
|
6809
|
+
type: import_mongoose17.default.Schema.Types.ObjectId
|
|
6523
6810
|
},
|
|
6524
6811
|
eventType: {
|
|
6525
6812
|
enum: Object.values(EnumEventType),
|
|
@@ -6548,20 +6835,20 @@ var schema12 = new MongooseSchema16(
|
|
|
6548
6835
|
},
|
|
6549
6836
|
{ timestamps: true }
|
|
6550
6837
|
);
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
var EventModel =
|
|
6838
|
+
schema13.index({ name: 1 });
|
|
6839
|
+
schema13.index({ description: 1 });
|
|
6840
|
+
schema13.index({ region: 1 });
|
|
6841
|
+
schema13.index({ "location.geo": "2dsphere" });
|
|
6842
|
+
schema13.index({ tags: 1 });
|
|
6843
|
+
schema13.index({ deletedAt: 1 });
|
|
6844
|
+
schema13.index({ "dateTime.dateStatus": 1 });
|
|
6845
|
+
schema13.index({ slug: 1 });
|
|
6846
|
+
var EventModel = import_mongoose17.default.models.Event || import_mongoose17.default.model("Event", schema13);
|
|
6560
6847
|
|
|
6561
6848
|
// src/mongoose/Partner.ts
|
|
6562
|
-
var
|
|
6563
|
-
var
|
|
6564
|
-
var
|
|
6849
|
+
var import_mongoose18 = __toESM(require("mongoose"));
|
|
6850
|
+
var MongooseSchema18 = import_mongoose18.default.Schema;
|
|
6851
|
+
var schema14 = new MongooseSchema18(
|
|
6565
6852
|
{
|
|
6566
6853
|
...baseResourceFields,
|
|
6567
6854
|
location: {
|
|
@@ -6577,19 +6864,19 @@ var schema13 = new MongooseSchema17(
|
|
|
6577
6864
|
},
|
|
6578
6865
|
{ timestamps: true }
|
|
6579
6866
|
);
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
var PartnerModel =
|
|
6867
|
+
schema14.index({ name: 1 });
|
|
6868
|
+
schema14.index({ description: 1 });
|
|
6869
|
+
schema14.index({ region: 1 });
|
|
6870
|
+
schema14.index({ "location.geo": "2dsphere" });
|
|
6871
|
+
schema14.index({ slug: 1 });
|
|
6872
|
+
var PartnerModel = import_mongoose18.default.models.Partner || import_mongoose18.default.model("Partner", schema14);
|
|
6586
6873
|
|
|
6587
6874
|
// src/mongoose/Post.ts
|
|
6588
|
-
var
|
|
6589
|
-
var
|
|
6590
|
-
var contentSchema = new
|
|
6875
|
+
var import_mongoose19 = __toESM(require("mongoose"));
|
|
6876
|
+
var MongooseSchema19 = import_mongoose19.default.Schema;
|
|
6877
|
+
var contentSchema = new MongooseSchema19(
|
|
6591
6878
|
{
|
|
6592
|
-
contentData:
|
|
6879
|
+
contentData: import_mongoose19.Schema.Types.Mixed,
|
|
6593
6880
|
contentOrder: { required: true, type: Number },
|
|
6594
6881
|
contentType: {
|
|
6595
6882
|
enum: Object.values(EnumPostContentType),
|
|
@@ -6599,7 +6886,7 @@ var contentSchema = new MongooseSchema18(
|
|
|
6599
6886
|
},
|
|
6600
6887
|
{ _id: false }
|
|
6601
6888
|
);
|
|
6602
|
-
var resourceSchema = new
|
|
6889
|
+
var resourceSchema = new MongooseSchema19(
|
|
6603
6890
|
{
|
|
6604
6891
|
resourceId: { required: true, type: String },
|
|
6605
6892
|
resourceRegion: { required: true, type: String },
|
|
@@ -6612,7 +6899,7 @@ var resourceSchema = new MongooseSchema18(
|
|
|
6612
6899
|
},
|
|
6613
6900
|
{ _id: false }
|
|
6614
6901
|
);
|
|
6615
|
-
var
|
|
6902
|
+
var schema15 = new MongooseSchema19(
|
|
6616
6903
|
{
|
|
6617
6904
|
active: { default: false, required: true, type: Boolean },
|
|
6618
6905
|
approvedAt: { default: null, required: false, type: Date },
|
|
@@ -6643,16 +6930,16 @@ var schema14 = new MongooseSchema18(
|
|
|
6643
6930
|
},
|
|
6644
6931
|
{ timestamps: true }
|
|
6645
6932
|
);
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
var PostModel =
|
|
6933
|
+
schema15.index({ title: 1 });
|
|
6934
|
+
schema15.index({ tags: 1 });
|
|
6935
|
+
schema15.index({ postType: 1, slug: 1 }, { unique: true });
|
|
6936
|
+
var PostModel = import_mongoose19.default.models.Post || import_mongoose19.default.model("Post", schema15);
|
|
6650
6937
|
|
|
6651
6938
|
// src/mongoose/AppSetting.ts
|
|
6652
|
-
var
|
|
6653
|
-
var
|
|
6939
|
+
var import_mongoose20 = __toESM(require("mongoose"));
|
|
6940
|
+
var MongooseSchema20 = import_mongoose20.default.Schema;
|
|
6654
6941
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
6655
|
-
var AppSettingSchema = new
|
|
6942
|
+
var AppSettingSchema = new MongooseSchema20(
|
|
6656
6943
|
{
|
|
6657
6944
|
activeSchoolsStudentCountTotal: {
|
|
6658
6945
|
default: 0,
|
|
@@ -6683,18 +6970,18 @@ var AppSettingSchema = new MongooseSchema19(
|
|
|
6683
6970
|
},
|
|
6684
6971
|
{ timestamps: true }
|
|
6685
6972
|
);
|
|
6686
|
-
var AppSettingModel =
|
|
6973
|
+
var AppSettingModel = import_mongoose20.default.models.AppSetting || import_mongoose20.default.model("AppSetting", AppSettingSchema);
|
|
6687
6974
|
|
|
6688
6975
|
// src/mongoose/game/Game.ts
|
|
6689
|
-
var
|
|
6976
|
+
var import_mongoose24 = __toESM(require("mongoose"));
|
|
6690
6977
|
|
|
6691
6978
|
// src/mongoose/game/DailyClue.ts
|
|
6692
|
-
var
|
|
6979
|
+
var import_mongoose22 = __toESM(require("mongoose"));
|
|
6693
6980
|
|
|
6694
6981
|
// src/mongoose/game/utils.ts
|
|
6695
|
-
var
|
|
6696
|
-
var
|
|
6697
|
-
var schemaGameDate = new
|
|
6982
|
+
var import_mongoose21 = __toESM(require("mongoose"));
|
|
6983
|
+
var MongooseSchema21 = import_mongoose21.default.Schema;
|
|
6984
|
+
var schemaGameDate = new MongooseSchema21(
|
|
6698
6985
|
{
|
|
6699
6986
|
endDate: { required: true, type: Date },
|
|
6700
6987
|
startDate: { required: true, type: Date }
|
|
@@ -6703,8 +6990,8 @@ var schemaGameDate = new MongooseSchema20(
|
|
|
6703
6990
|
);
|
|
6704
6991
|
|
|
6705
6992
|
// src/mongoose/game/DailyClue.ts
|
|
6706
|
-
var
|
|
6707
|
-
var schemaLetters = new
|
|
6993
|
+
var MongooseSchema22 = import_mongoose22.default.Schema;
|
|
6994
|
+
var schemaLetters = new MongooseSchema22(
|
|
6708
6995
|
{
|
|
6709
6996
|
collected: { required: false, type: [String] },
|
|
6710
6997
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -6712,14 +6999,14 @@ var schemaLetters = new MongooseSchema21(
|
|
|
6712
6999
|
},
|
|
6713
7000
|
{ _id: false }
|
|
6714
7001
|
);
|
|
6715
|
-
var schemaDailyClueBaseGame = new
|
|
7002
|
+
var schemaDailyClueBaseGame = new MongooseSchema22(
|
|
6716
7003
|
{
|
|
6717
7004
|
gameDate: { required: true, type: schemaGameDate },
|
|
6718
7005
|
gameSolution: { required: true, type: String }
|
|
6719
7006
|
},
|
|
6720
7007
|
{ _id: false }
|
|
6721
7008
|
);
|
|
6722
|
-
var schemaDailyClueGameData = new
|
|
7009
|
+
var schemaDailyClueGameData = new MongooseSchema22(
|
|
6723
7010
|
{
|
|
6724
7011
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
6725
7012
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -6734,9 +7021,9 @@ var schemaDailyClueGameData = new MongooseSchema21(
|
|
|
6734
7021
|
);
|
|
6735
7022
|
|
|
6736
7023
|
// src/mongoose/game/PuzzleGame.ts
|
|
6737
|
-
var
|
|
6738
|
-
var
|
|
6739
|
-
var schemaPuzzleAnswer = new
|
|
7024
|
+
var import_mongoose23 = __toESM(require("mongoose"));
|
|
7025
|
+
var MongooseSchema23 = import_mongoose23.default.Schema;
|
|
7026
|
+
var schemaPuzzleAnswer = new MongooseSchema23(
|
|
6740
7027
|
{
|
|
6741
7028
|
answer: { required: true, type: String },
|
|
6742
7029
|
answerId: { required: true, type: String },
|
|
@@ -6744,7 +7031,7 @@ var schemaPuzzleAnswer = new MongooseSchema22(
|
|
|
6744
7031
|
},
|
|
6745
7032
|
{ _id: false }
|
|
6746
7033
|
);
|
|
6747
|
-
var schemaPuzzleQuestion = new
|
|
7034
|
+
var schemaPuzzleQuestion = new MongooseSchema23(
|
|
6748
7035
|
{
|
|
6749
7036
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
6750
7037
|
question: { required: true, type: String },
|
|
@@ -6752,20 +7039,20 @@ var schemaPuzzleQuestion = new MongooseSchema22(
|
|
|
6752
7039
|
},
|
|
6753
7040
|
{ _id: false }
|
|
6754
7041
|
);
|
|
6755
|
-
var schemaPuzzleBaseGame = new
|
|
7042
|
+
var schemaPuzzleBaseGame = new MongooseSchema23(
|
|
6756
7043
|
{
|
|
6757
7044
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
6758
7045
|
},
|
|
6759
7046
|
{ _id: false }
|
|
6760
7047
|
);
|
|
6761
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
7048
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema23(
|
|
6762
7049
|
{
|
|
6763
7050
|
questionId: { required: true, type: String },
|
|
6764
7051
|
selectedAnswerId: { required: true, type: String }
|
|
6765
7052
|
},
|
|
6766
7053
|
{ _id: false }
|
|
6767
7054
|
);
|
|
6768
|
-
var schemaPuzzleGameData = new
|
|
7055
|
+
var schemaPuzzleGameData = new MongooseSchema23(
|
|
6769
7056
|
{
|
|
6770
7057
|
answeredQuestions: {
|
|
6771
7058
|
default: null,
|
|
@@ -6780,19 +7067,19 @@ var schemaPuzzleGameData = new MongooseSchema22(
|
|
|
6780
7067
|
);
|
|
6781
7068
|
|
|
6782
7069
|
// src/mongoose/game/Game.ts
|
|
6783
|
-
var
|
|
7070
|
+
var MongooseSchema24 = import_mongoose24.default.Schema;
|
|
6784
7071
|
var gameDataSchemas = {
|
|
6785
7072
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
6786
7073
|
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
6787
7074
|
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
6788
7075
|
};
|
|
6789
7076
|
var gameDataDefinition = Object.fromEntries(
|
|
6790
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
7077
|
+
Object.entries(gameDataSchemas).map(([key, schema20]) => [
|
|
6791
7078
|
key,
|
|
6792
|
-
{ default: null, required: false, type:
|
|
7079
|
+
{ default: null, required: false, type: schema20 }
|
|
6793
7080
|
])
|
|
6794
7081
|
);
|
|
6795
|
-
var gameHistorySchema = new
|
|
7082
|
+
var gameHistorySchema = new MongooseSchema24(
|
|
6796
7083
|
{
|
|
6797
7084
|
createdAt: { required: true, type: Date },
|
|
6798
7085
|
gameDate: { required: true, type: schemaGameDate },
|
|
@@ -6812,7 +7099,7 @@ var gameHistorySchema = new MongooseSchema23(
|
|
|
6812
7099
|
},
|
|
6813
7100
|
{ _id: false }
|
|
6814
7101
|
);
|
|
6815
|
-
var gameTypeSchema = new
|
|
7102
|
+
var gameTypeSchema = new MongooseSchema24(
|
|
6816
7103
|
{
|
|
6817
7104
|
active: { default: true, required: true, type: Boolean },
|
|
6818
7105
|
gameData: gameDataDefinition,
|
|
@@ -6827,7 +7114,7 @@ var gameTypeSchema = new MongooseSchema23(
|
|
|
6827
7114
|
},
|
|
6828
7115
|
{ timestamps: true }
|
|
6829
7116
|
);
|
|
6830
|
-
var
|
|
7117
|
+
var schema16 = new MongooseSchema24(
|
|
6831
7118
|
{
|
|
6832
7119
|
active: { default: false, required: true, type: Boolean },
|
|
6833
7120
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -6840,12 +7127,12 @@ var schema15 = new MongooseSchema23(
|
|
|
6840
7127
|
},
|
|
6841
7128
|
{ timestamps: true }
|
|
6842
7129
|
);
|
|
6843
|
-
var GameModel =
|
|
7130
|
+
var GameModel = import_mongoose24.default.models.Game || import_mongoose24.default.model("Game", schema16);
|
|
6844
7131
|
|
|
6845
7132
|
// src/mongoose/School.ts
|
|
6846
|
-
var
|
|
6847
|
-
var
|
|
6848
|
-
var campaignsSchema = new
|
|
7133
|
+
var import_mongoose25 = __toESM(require("mongoose"));
|
|
7134
|
+
var MongooseSchema25 = import_mongoose25.default.Schema;
|
|
7135
|
+
var campaignsSchema = new MongooseSchema25(
|
|
6849
7136
|
{
|
|
6850
7137
|
endDate: { required: true, type: Date },
|
|
6851
7138
|
name: { required: true, type: String },
|
|
@@ -6853,7 +7140,7 @@ var campaignsSchema = new MongooseSchema24(
|
|
|
6853
7140
|
},
|
|
6854
7141
|
{ _id: false }
|
|
6855
7142
|
);
|
|
6856
|
-
var
|
|
7143
|
+
var schema17 = new MongooseSchema25(
|
|
6857
7144
|
{
|
|
6858
7145
|
// New schools are active by default
|
|
6859
7146
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -6880,19 +7167,19 @@ var schema16 = new MongooseSchema24(
|
|
|
6880
7167
|
},
|
|
6881
7168
|
{ timestamps: true }
|
|
6882
7169
|
);
|
|
6883
|
-
|
|
7170
|
+
schema17.index(
|
|
6884
7171
|
{ schoolCode: 1 },
|
|
6885
7172
|
{
|
|
6886
7173
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
6887
7174
|
unique: true
|
|
6888
7175
|
}
|
|
6889
7176
|
);
|
|
6890
|
-
var SchoolModel =
|
|
7177
|
+
var SchoolModel = import_mongoose25.default.models.School || import_mongoose25.default.model("School", schema17);
|
|
6891
7178
|
|
|
6892
7179
|
// src/mongoose/Affiliate.ts
|
|
6893
|
-
var
|
|
6894
|
-
var
|
|
6895
|
-
var affiliateRewardSchema = new
|
|
7180
|
+
var import_mongoose26 = __toESM(require("mongoose"));
|
|
7181
|
+
var MongooseSchema26 = import_mongoose26.default.Schema;
|
|
7182
|
+
var affiliateRewardSchema = new MongooseSchema26(
|
|
6896
7183
|
{
|
|
6897
7184
|
createdAt: { required: true, type: Date },
|
|
6898
7185
|
redeemedAt: { default: null, required: false, type: Date },
|
|
@@ -6906,13 +7193,13 @@ var affiliateRewardSchema = new MongooseSchema25(
|
|
|
6906
7193
|
},
|
|
6907
7194
|
{ _id: false }
|
|
6908
7195
|
);
|
|
6909
|
-
var affiliateResourceSchema = new
|
|
7196
|
+
var affiliateResourceSchema = new MongooseSchema26(
|
|
6910
7197
|
{
|
|
6911
7198
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
6912
7199
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
6913
7200
|
resourceId: {
|
|
6914
7201
|
required: true,
|
|
6915
|
-
type:
|
|
7202
|
+
type: import_mongoose26.default.Schema.Types.ObjectId
|
|
6916
7203
|
},
|
|
6917
7204
|
resourceName: { required: true, type: String },
|
|
6918
7205
|
resourceOwner: {
|
|
@@ -6932,20 +7219,20 @@ var affiliateResourceSchema = new MongooseSchema25(
|
|
|
6932
7219
|
},
|
|
6933
7220
|
{ _id: false }
|
|
6934
7221
|
);
|
|
6935
|
-
var affiliateContactDetailsSchema = new
|
|
7222
|
+
var affiliateContactDetailsSchema = new MongooseSchema26(
|
|
6936
7223
|
{
|
|
6937
7224
|
mobilePhone: { required: true, type: String }
|
|
6938
7225
|
},
|
|
6939
7226
|
{ _id: false }
|
|
6940
7227
|
);
|
|
6941
|
-
var affiliateBankAccountDetailsSchema = new
|
|
7228
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema26(
|
|
6942
7229
|
{
|
|
6943
7230
|
accountHolderName: { required: true, type: String },
|
|
6944
7231
|
accountNumber: { required: true, type: String }
|
|
6945
7232
|
},
|
|
6946
7233
|
{ _id: false }
|
|
6947
7234
|
);
|
|
6948
|
-
var affiliateDetailsSchema = new
|
|
7235
|
+
var affiliateDetailsSchema = new MongooseSchema26(
|
|
6949
7236
|
{
|
|
6950
7237
|
bankAccountDetails: {
|
|
6951
7238
|
required: true,
|
|
@@ -6967,7 +7254,7 @@ var affiliateDetailsSchema = new MongooseSchema25(
|
|
|
6967
7254
|
},
|
|
6968
7255
|
{ _id: false }
|
|
6969
7256
|
);
|
|
6970
|
-
var redeemHistorySchema = new
|
|
7257
|
+
var redeemHistorySchema = new MongooseSchema26(
|
|
6971
7258
|
{
|
|
6972
7259
|
paidAt: { default: null, required: false, type: Date },
|
|
6973
7260
|
redeemedAt: { required: true, type: Date },
|
|
@@ -6975,7 +7262,7 @@ var redeemHistorySchema = new MongooseSchema25(
|
|
|
6975
7262
|
},
|
|
6976
7263
|
{ _id: false }
|
|
6977
7264
|
);
|
|
6978
|
-
var
|
|
7265
|
+
var schema18 = new MongooseSchema26(
|
|
6979
7266
|
{
|
|
6980
7267
|
active: { default: false, required: true, type: Boolean },
|
|
6981
7268
|
affiliateBonusRewards: {
|
|
@@ -7005,19 +7292,19 @@ var schema17 = new MongooseSchema25(
|
|
|
7005
7292
|
},
|
|
7006
7293
|
{ timestamps: true }
|
|
7007
7294
|
);
|
|
7008
|
-
|
|
7295
|
+
schema18.index(
|
|
7009
7296
|
{ affiliateCode: 1 },
|
|
7010
7297
|
{
|
|
7011
7298
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
7012
7299
|
unique: true
|
|
7013
7300
|
}
|
|
7014
7301
|
);
|
|
7015
|
-
var AffiliateModel =
|
|
7302
|
+
var AffiliateModel = import_mongoose26.default.models.Affiliate || import_mongoose26.default.model("Affiliate", schema18);
|
|
7016
7303
|
|
|
7017
7304
|
// src/mongoose/Coupon.ts
|
|
7018
|
-
var
|
|
7019
|
-
var
|
|
7020
|
-
var couponOptionSchema = new
|
|
7305
|
+
var import_mongoose27 = __toESM(require("mongoose"));
|
|
7306
|
+
var MongooseSchema27 = import_mongoose27.default.Schema;
|
|
7307
|
+
var couponOptionSchema = new MongooseSchema27(
|
|
7021
7308
|
{
|
|
7022
7309
|
buy: { required: false, type: Number },
|
|
7023
7310
|
get: { required: false, type: Number },
|
|
@@ -7032,29 +7319,29 @@ var couponOptionSchema = new MongooseSchema26(
|
|
|
7032
7319
|
},
|
|
7033
7320
|
{ _id: false }
|
|
7034
7321
|
);
|
|
7035
|
-
var couponVendorProductSchema = new
|
|
7322
|
+
var couponVendorProductSchema = new MongooseSchema27(
|
|
7036
7323
|
{
|
|
7037
7324
|
couponId: {
|
|
7038
7325
|
required: true,
|
|
7039
|
-
type:
|
|
7326
|
+
type: import_mongoose27.default.Schema.Types.ObjectId
|
|
7040
7327
|
},
|
|
7041
7328
|
productId: {
|
|
7042
7329
|
required: true,
|
|
7043
|
-
type:
|
|
7330
|
+
type: import_mongoose27.default.Schema.Types.ObjectId
|
|
7044
7331
|
},
|
|
7045
7332
|
vendorCouponId: {
|
|
7046
7333
|
required: false,
|
|
7047
|
-
type:
|
|
7334
|
+
type: import_mongoose27.default.Schema.Types.ObjectId
|
|
7048
7335
|
},
|
|
7049
7336
|
vendorId: {
|
|
7050
7337
|
ref: "Vendor",
|
|
7051
7338
|
required: true,
|
|
7052
|
-
type:
|
|
7339
|
+
type: import_mongoose27.default.Schema.Types.ObjectId
|
|
7053
7340
|
}
|
|
7054
7341
|
},
|
|
7055
7342
|
{ _id: false }
|
|
7056
7343
|
);
|
|
7057
|
-
var couponCodeSchema = new
|
|
7344
|
+
var couponCodeSchema = new MongooseSchema27(
|
|
7058
7345
|
{
|
|
7059
7346
|
code: { required: true, type: String },
|
|
7060
7347
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -7062,7 +7349,7 @@ var couponCodeSchema = new MongooseSchema26(
|
|
|
7062
7349
|
},
|
|
7063
7350
|
{ _id: false }
|
|
7064
7351
|
);
|
|
7065
|
-
var couponParticipantUserSchema = new
|
|
7352
|
+
var couponParticipantUserSchema = new MongooseSchema27(
|
|
7066
7353
|
{
|
|
7067
7354
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
7068
7355
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -7071,12 +7358,12 @@ var couponParticipantUserSchema = new MongooseSchema26(
|
|
|
7071
7358
|
userId: {
|
|
7072
7359
|
ref: "User",
|
|
7073
7360
|
required: true,
|
|
7074
|
-
type:
|
|
7361
|
+
type: import_mongoose27.default.Schema.Types.ObjectId
|
|
7075
7362
|
}
|
|
7076
7363
|
},
|
|
7077
7364
|
{ timestamps: true }
|
|
7078
7365
|
);
|
|
7079
|
-
var couponDataSchema = new
|
|
7366
|
+
var couponDataSchema = new MongooseSchema27(
|
|
7080
7367
|
{
|
|
7081
7368
|
active: { default: true, required: true, type: Boolean },
|
|
7082
7369
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -7103,7 +7390,7 @@ var couponDataSchema = new MongooseSchema26(
|
|
|
7103
7390
|
},
|
|
7104
7391
|
{ timestamps: true }
|
|
7105
7392
|
);
|
|
7106
|
-
var
|
|
7393
|
+
var schema19 = new MongooseSchema27(
|
|
7107
7394
|
{
|
|
7108
7395
|
active: { default: true, required: true, type: Boolean },
|
|
7109
7396
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -7115,7 +7402,7 @@ var schema18 = new MongooseSchema26(
|
|
|
7115
7402
|
},
|
|
7116
7403
|
{ timestamps: true }
|
|
7117
7404
|
);
|
|
7118
|
-
var CouponModel =
|
|
7405
|
+
var CouponModel = import_mongoose27.default.models.Coupon || import_mongoose27.default.model("Coupon", schema19);
|
|
7119
7406
|
|
|
7120
7407
|
// src/service/promoCode/constants.ts
|
|
7121
7408
|
var ACTIVE_NOT_DELETED_FILTER = {
|
|
@@ -7132,7 +7419,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
|
|
|
7132
7419
|
return existing !== null;
|
|
7133
7420
|
}
|
|
7134
7421
|
|
|
7135
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
7422
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-YRO6KEZG.mjs
|
|
7136
7423
|
var import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
7137
7424
|
var import_customParseFormat2 = __toESM(require("dayjs/plugin/customParseFormat.js"), 1);
|
|
7138
7425
|
var import_isSameOrAfter2 = __toESM(require("dayjs/plugin/isSameOrAfter.js"), 1);
|
|
@@ -7205,7 +7492,7 @@ var SHARE_RESOURCE_LABEL2 = {
|
|
|
7205
7492
|
school: "School"
|
|
7206
7493
|
};
|
|
7207
7494
|
|
|
7208
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
7495
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-STNE7PMX.mjs
|
|
7209
7496
|
var PROMO_CODE_PREFIX2 = "CM-";
|
|
7210
7497
|
var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
|
|
7211
7498
|
var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
|
|
@@ -7317,7 +7604,7 @@ var gameScreenIdentifierList2 = [
|
|
|
7317
7604
|
}
|
|
7318
7605
|
];
|
|
7319
7606
|
|
|
7320
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
7607
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-3ZPHXVUT.mjs
|
|
7321
7608
|
var import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
7322
7609
|
var statusOptions2 = [
|
|
7323
7610
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -8754,7 +9041,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
8754
9041
|
}
|
|
8755
9042
|
|
|
8756
9043
|
// src/service/database.ts
|
|
8757
|
-
var
|
|
9044
|
+
var import_mongoose31 = __toESM(require("mongoose"));
|
|
8758
9045
|
var connectToDatabase = async ({
|
|
8759
9046
|
appName,
|
|
8760
9047
|
dbName,
|
|
@@ -8767,7 +9054,7 @@ var connectToDatabase = async ({
|
|
|
8767
9054
|
// Fallback to MongoDB Atlas connection string
|
|
8768
9055
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
8769
9056
|
);
|
|
8770
|
-
await
|
|
9057
|
+
await import_mongoose31.default.connect(mongoUri);
|
|
8771
9058
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
8772
9059
|
console.log(
|
|
8773
9060
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -8780,7 +9067,7 @@ var connectToDatabase = async ({
|
|
|
8780
9067
|
|
|
8781
9068
|
// src/types/index.ts
|
|
8782
9069
|
var import_express = __toESM(require("express"));
|
|
8783
|
-
var
|
|
9070
|
+
var import_mongoose32 = __toESM(require("mongoose"));
|
|
8784
9071
|
|
|
8785
9072
|
// src/service/notifyUsers.ts
|
|
8786
9073
|
async function publishNotificationEvents(userId, pubsub) {
|
|
@@ -8863,15 +9150,15 @@ async function updateAdStatuses() {
|
|
|
8863
9150
|
}
|
|
8864
9151
|
|
|
8865
9152
|
// src/service/objectIdToString.ts
|
|
8866
|
-
var
|
|
9153
|
+
var import_mongoose34 = __toESM(require("mongoose"));
|
|
8867
9154
|
function isValidObjectId(value) {
|
|
8868
|
-
return
|
|
9155
|
+
return import_mongoose34.default.Types.ObjectId.isValid(value);
|
|
8869
9156
|
}
|
|
8870
9157
|
function convertObjectIdsToStrings(obj) {
|
|
8871
9158
|
if (obj === null || obj === void 0) {
|
|
8872
9159
|
return obj;
|
|
8873
9160
|
}
|
|
8874
|
-
if (obj instanceof
|
|
9161
|
+
if (obj instanceof import_mongoose34.default.Types.ObjectId) {
|
|
8875
9162
|
return obj.toString();
|
|
8876
9163
|
}
|
|
8877
9164
|
if (obj instanceof Date) {
|
|
@@ -9426,20 +9713,24 @@ var buildLicenceReplacePipeline = ({
|
|
|
9426
9713
|
async function replaceUserLicenceWithObject({
|
|
9427
9714
|
userId,
|
|
9428
9715
|
licenceObject,
|
|
9429
|
-
protectHigherLicence = true
|
|
9716
|
+
protectHigherLicence = true,
|
|
9717
|
+
refreshExistingLicence = false
|
|
9430
9718
|
}) {
|
|
9431
9719
|
const user = await UserModel.findById(userId, { licences: 1 }).lean();
|
|
9432
9720
|
if (!user) throw new import_graphql3.GraphQLError("User not found");
|
|
9433
|
-
|
|
9721
|
+
const existingLicence = user.licences?.find(
|
|
9722
|
+
(licence) => licence.licenceType === licenceObject.licenceType
|
|
9723
|
+
);
|
|
9724
|
+
if (existingLicence && !refreshExistingLicence) {
|
|
9434
9725
|
return;
|
|
9435
9726
|
}
|
|
9727
|
+
const category = getLicenceCategory(licenceObject.licenceType);
|
|
9436
9728
|
const updatedLicenceObject = {
|
|
9437
9729
|
...licenceObject,
|
|
9438
|
-
prevLicenceType: user.licences?.find(
|
|
9439
|
-
(
|
|
9730
|
+
prevLicenceType: existingLicence && refreshExistingLicence ? existingLicence.prevLicenceType : user.licences?.find(
|
|
9731
|
+
(licence) => licence.licenceType && getLicenceCategory(licence.licenceType) === category
|
|
9440
9732
|
)?.licenceType
|
|
9441
9733
|
};
|
|
9442
|
-
const category = getLicenceCategory(updatedLicenceObject.licenceType);
|
|
9443
9734
|
if (protectHigherLicence) {
|
|
9444
9735
|
const highestLicence = getHighestLicenceForCategory(
|
|
9445
9736
|
user.licences,
|
|
@@ -9553,6 +9844,17 @@ var vendorLicences = [
|
|
|
9553
9844
|
EnumUserLicence.PRO_VENDOR,
|
|
9554
9845
|
EnumUserLicence.PRO_PLUS_VENDOR
|
|
9555
9846
|
];
|
|
9847
|
+
function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
9848
|
+
const stripe = user.stripe;
|
|
9849
|
+
if (!stripe?.subscriptionId || stripe.currentPlan !== licenceType || stripe.status !== EnumSubscriptionStatus.ACTIVE && stripe.status !== EnumSubscriptionStatus.TRIALING) {
|
|
9850
|
+
return false;
|
|
9851
|
+
}
|
|
9852
|
+
if (stripe.cancelAtPeriodEnd !== true || !stripe.endDate) {
|
|
9853
|
+
return true;
|
|
9854
|
+
}
|
|
9855
|
+
const paidThrough = (0, import_dayjs8.default)(stripe.endDate);
|
|
9856
|
+
return !paidThrough.isValid() || paidThrough.isAfter(now);
|
|
9857
|
+
}
|
|
9556
9858
|
async function handleVendorLicenceCompliance(user, now) {
|
|
9557
9859
|
if (!user.licences || !user.vendor) {
|
|
9558
9860
|
return;
|
|
@@ -9566,12 +9868,20 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
9566
9868
|
const proLicences = vendorLicencesOfUser.filter(
|
|
9567
9869
|
(licence) => licence.licenceType !== EnumUserLicence.STANDARD_VENDOR
|
|
9568
9870
|
);
|
|
9569
|
-
const
|
|
9871
|
+
const expiredProLicences = proLicences.filter(
|
|
9570
9872
|
(licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now)
|
|
9571
9873
|
);
|
|
9572
|
-
const
|
|
9874
|
+
const stripeProtectedLicenceTypes = new Set(
|
|
9875
|
+
expiredProLicences.filter(
|
|
9876
|
+
(licence) => isProtectedByCurrentStripeSubscription(user, licence.licenceType, now)
|
|
9877
|
+
).map((licence) => licence.licenceType)
|
|
9878
|
+
);
|
|
9879
|
+
const expiredProLicence = expiredProLicences.some(
|
|
9880
|
+
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
9881
|
+
);
|
|
9882
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, vendorLicences, now);
|
|
9573
9883
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
9574
|
-
(licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now)
|
|
9884
|
+
(licence) => !(0, import_dayjs8.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
9575
9885
|
);
|
|
9576
9886
|
if (!hasExpiredVendorLicence) {
|
|
9577
9887
|
return;
|
|
@@ -9585,7 +9895,10 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
9585
9895
|
"owner.userId": user._id
|
|
9586
9896
|
}).lean().exec();
|
|
9587
9897
|
}
|
|
9588
|
-
|
|
9898
|
+
const licencesToSync = vendorLicences.filter(
|
|
9899
|
+
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
9900
|
+
);
|
|
9901
|
+
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
9589
9902
|
if (!expiredProLicence || !vendor || hasValidProLicence) {
|
|
9590
9903
|
return;
|
|
9591
9904
|
}
|
|
@@ -9674,6 +9987,13 @@ async function processUserCompliance(user, now) {
|
|
|
9674
9987
|
}
|
|
9675
9988
|
|
|
9676
9989
|
// src/service/license/compliance/ensureUserLicenseCompliance.ts
|
|
9990
|
+
async function ensureUserLicenseComplianceForUser(userId, now = (0, import_dayjs10.default)()) {
|
|
9991
|
+
const user = await UserModel.findById(userId);
|
|
9992
|
+
if (!user) {
|
|
9993
|
+
return;
|
|
9994
|
+
}
|
|
9995
|
+
await processUserCompliance(user, now);
|
|
9996
|
+
}
|
|
9677
9997
|
async function ensureUserLicenseCompliance() {
|
|
9678
9998
|
const now = (0, import_dayjs10.default)();
|
|
9679
9999
|
console.log(`\u{1F50D} Checking license compliance at ${now.format()}`);
|
|
@@ -9925,7 +10245,7 @@ async function sendLicenseReminder(user, licence) {
|
|
|
9925
10245
|
await sendPushNotifications(payload);
|
|
9926
10246
|
console.log(`\u2705 Sent 7-day reminder to user ${userId} for ${licenceName}`);
|
|
9927
10247
|
}
|
|
9928
|
-
async function processLicenseReminder(
|
|
10248
|
+
async function processLicenseReminder(licence, now) {
|
|
9929
10249
|
if ((0, import_dayjs11.default)(licence.expiryDate).isBefore(now)) {
|
|
9930
10250
|
return false;
|
|
9931
10251
|
}
|
|
@@ -9957,7 +10277,7 @@ async function processUserLicenseReminders(user, now) {
|
|
|
9957
10277
|
const licenceChecks = await Promise.all(
|
|
9958
10278
|
validLicences.map(async (licence) => {
|
|
9959
10279
|
try {
|
|
9960
|
-
const shouldSend = await processLicenseReminder(
|
|
10280
|
+
const shouldSend = await processLicenseReminder(licence, now);
|
|
9961
10281
|
return { licence, shouldSend };
|
|
9962
10282
|
} catch (err) {
|
|
9963
10283
|
console.error(
|
|
@@ -10034,6 +10354,7 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
10034
10354
|
createLicenceObject,
|
|
10035
10355
|
didRemoveAnyEventDates,
|
|
10036
10356
|
ensureUserLicenseCompliance,
|
|
10357
|
+
ensureUserLicenseComplianceForUser,
|
|
10037
10358
|
eventLicences,
|
|
10038
10359
|
findAffiliateByPromoCode,
|
|
10039
10360
|
findEventOrImportedMarketById,
|