@timardex/cluemart-server-shared 3.0.0 → 3.0.2
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/{chunk-YMDOR6W2.mjs → chunk-7JWQ7WKJ.mjs} +289 -232
- package/dist/chunk-7JWQ7WKJ.mjs.map +1 -0
- package/dist/index.cjs +297 -239
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +295 -238
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +290 -232
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +7 -1
- package/dist/mongoose/index.d.ts +7 -1
- package/dist/mongoose/index.mjs +3 -1
- package/dist/service/index.cjs +294 -238
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-YMDOR6W2.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -280,16 +280,54 @@ schema3.index(
|
|
|
280
280
|
);
|
|
281
281
|
var AdBookingModel = mongoose3.models.AdBooking || mongoose3.model("AdBooking", schema3);
|
|
282
282
|
|
|
283
|
+
// src/mongoose/ad/AdPurchase.ts
|
|
284
|
+
import mongoose4 from "mongoose";
|
|
285
|
+
var schema4 = new mongoose4.Schema(
|
|
286
|
+
{
|
|
287
|
+
_id: { required: true, type: String },
|
|
288
|
+
approvalRequired: { type: Boolean },
|
|
289
|
+
bookingIds: { required: true, type: [String] },
|
|
290
|
+
checkoutAttemptId: { required: true, type: String },
|
|
291
|
+
checkoutLeaseUntil: { type: Date },
|
|
292
|
+
checkoutLeaseToken: { type: String },
|
|
293
|
+
createdAt: { default: Date.now, required: true, type: Date },
|
|
294
|
+
expiresAt: { required: true, type: Date },
|
|
295
|
+
holdsReleased: { type: Boolean },
|
|
296
|
+
quote: { required: true, type: mongoose4.Schema.Types.Mixed },
|
|
297
|
+
resource: { required: true, type: schemaAdresource },
|
|
298
|
+
selectionKey: { required: true, type: String },
|
|
299
|
+
state: {
|
|
300
|
+
enum: ["reserving", "checkout", "paid", "failed", "cancelled"],
|
|
301
|
+
required: true,
|
|
302
|
+
type: String
|
|
303
|
+
},
|
|
304
|
+
stripeCheckoutSessionId: { default: null, type: String },
|
|
305
|
+
stripePaymentIntentId: { default: null, type: String },
|
|
306
|
+
stripeRequestStartedAt: { type: Date },
|
|
307
|
+
userId: { required: true, type: String }
|
|
308
|
+
},
|
|
309
|
+
{ collection: "adPurchases" }
|
|
310
|
+
);
|
|
311
|
+
schema4.index({ userId: 1, checkoutAttemptId: 1 }, { unique: true });
|
|
312
|
+
schema4.index(
|
|
313
|
+
{ stripeCheckoutSessionId: 1 },
|
|
314
|
+
{
|
|
315
|
+
unique: true,
|
|
316
|
+
partialFilterExpression: { stripeCheckoutSessionId: { $type: "string" } }
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
schema4.index({ state: 1, expiresAt: 1 });
|
|
320
|
+
var AdPurchaseModel = mongoose4.models.AdPurchase || mongoose4.model("AdPurchase", schema4);
|
|
321
|
+
|
|
283
322
|
// src/mongoose/ad/AdMetrics.ts
|
|
284
323
|
import {
|
|
285
324
|
EnumAdPlatform,
|
|
286
325
|
EnumAdShowOn as EnumAdShowOn4,
|
|
287
326
|
isUtcMidnight as isUtcMidnight3
|
|
288
327
|
} from "@timardex/cluemart-shared";
|
|
289
|
-
import
|
|
290
|
-
var
|
|
328
|
+
import mongoose5 from "mongoose";
|
|
329
|
+
var ResourceMetricsSchema = new mongoose5.Schema(
|
|
291
330
|
{
|
|
292
|
-
adId: { ref: "Ad", required: true, type: String },
|
|
293
331
|
clicks: { default: 0, required: true, type: Number },
|
|
294
332
|
date: {
|
|
295
333
|
immutable: true,
|
|
@@ -314,10 +352,26 @@ var schema4 = new mongoose4.Schema(
|
|
|
314
352
|
type: String
|
|
315
353
|
}
|
|
316
354
|
},
|
|
355
|
+
{ _id: false }
|
|
356
|
+
);
|
|
357
|
+
var schema5 = new mongoose5.Schema(
|
|
358
|
+
{
|
|
359
|
+
adId: { ref: "Ad", required: true, type: String },
|
|
360
|
+
resource: { default: [], type: [ResourceMetricsSchema] }
|
|
361
|
+
},
|
|
317
362
|
{ timestamps: true }
|
|
318
363
|
);
|
|
319
|
-
|
|
320
|
-
|
|
364
|
+
schema5.index({ adId: 1 }, { unique: true });
|
|
365
|
+
schema5.index(
|
|
366
|
+
{
|
|
367
|
+
adId: 1,
|
|
368
|
+
"resource.date": 1,
|
|
369
|
+
"resource.placement": 1,
|
|
370
|
+
"resource.platform": 1
|
|
371
|
+
},
|
|
372
|
+
{ unique: true }
|
|
373
|
+
);
|
|
374
|
+
var AdMetricsModel = mongoose5.models.AdMetrics || mongoose5.model("AdMetrics", schema5);
|
|
321
375
|
|
|
322
376
|
// src/mongoose/BillingCatalog.ts
|
|
323
377
|
import {
|
|
@@ -329,8 +383,8 @@ import {
|
|
|
329
383
|
EnumUserLicence,
|
|
330
384
|
INITIAL_BILLING_CATALOG
|
|
331
385
|
} from "@timardex/cluemart-shared";
|
|
332
|
-
import
|
|
333
|
-
var MongooseSchema2 =
|
|
386
|
+
import mongoose6 from "mongoose";
|
|
387
|
+
var MongooseSchema2 = mongoose6.Schema;
|
|
334
388
|
var BILLING_CATALOG_COLLECTION_NAME = "billingCatalog";
|
|
335
389
|
var paidVendorLicences = [
|
|
336
390
|
EnumUserLicence.PRO_VENDOR,
|
|
@@ -377,7 +431,7 @@ var priceHistorySchema = new MongooseSchema2(
|
|
|
377
431
|
default: null,
|
|
378
432
|
ref: "User",
|
|
379
433
|
required: false,
|
|
380
|
-
type:
|
|
434
|
+
type: mongoose6.Schema.Types.ObjectId
|
|
381
435
|
},
|
|
382
436
|
currency: currencyField,
|
|
383
437
|
effectiveFrom: { required: true, type: Date },
|
|
@@ -388,7 +442,7 @@ var priceHistorySchema = new MongooseSchema2(
|
|
|
388
442
|
},
|
|
389
443
|
{ _id: false }
|
|
390
444
|
);
|
|
391
|
-
var
|
|
445
|
+
var schema6 = new MongooseSchema2(
|
|
392
446
|
{
|
|
393
447
|
active: { default: true, required: true, type: Boolean },
|
|
394
448
|
billingPeriod: {
|
|
@@ -444,7 +498,7 @@ var schema5 = new MongooseSchema2(
|
|
|
444
498
|
default: null,
|
|
445
499
|
ref: "User",
|
|
446
500
|
required: false,
|
|
447
|
-
type:
|
|
501
|
+
type: mongoose6.Schema.Types.ObjectId
|
|
448
502
|
}
|
|
449
503
|
},
|
|
450
504
|
{
|
|
@@ -453,7 +507,7 @@ var schema5 = new MongooseSchema2(
|
|
|
453
507
|
timestamps: true
|
|
454
508
|
}
|
|
455
509
|
);
|
|
456
|
-
|
|
510
|
+
schema6.pre("validate", function validateDefinition() {
|
|
457
511
|
if (!billingCatalogDefinitionMatches(this)) {
|
|
458
512
|
this.invalidate(
|
|
459
513
|
"key",
|
|
@@ -461,18 +515,18 @@ schema5.pre("validate", function validateDefinition() {
|
|
|
461
515
|
);
|
|
462
516
|
}
|
|
463
517
|
});
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
518
|
+
schema6.index({ billingPeriod: 1, licenceType: 1 }, { unique: true });
|
|
519
|
+
schema6.index({ active: 1, licenceType: 1 });
|
|
520
|
+
schema6.index(
|
|
467
521
|
{ stripePriceId: 1 },
|
|
468
522
|
{
|
|
469
523
|
partialFilterExpression: { stripePriceId: { $type: "string" } },
|
|
470
524
|
unique: true
|
|
471
525
|
}
|
|
472
526
|
);
|
|
473
|
-
var BillingCatalogModel =
|
|
527
|
+
var BillingCatalogModel = mongoose6.models.BillingCatalogEntry || mongoose6.model(
|
|
474
528
|
"BillingCatalogEntry",
|
|
475
|
-
|
|
529
|
+
schema6,
|
|
476
530
|
BILLING_CATALOG_COLLECTION_NAME
|
|
477
531
|
);
|
|
478
532
|
function buildInitialBillingCatalogEntries(now = /* @__PURE__ */ new Date()) {
|
|
@@ -500,15 +554,15 @@ function getBillingCatalogDefinition(key) {
|
|
|
500
554
|
import {
|
|
501
555
|
EnumChatType
|
|
502
556
|
} from "@timardex/cluemart-shared";
|
|
503
|
-
import
|
|
504
|
-
var MongooseSchema3 =
|
|
557
|
+
import mongoose7 from "mongoose";
|
|
558
|
+
var MongooseSchema3 = mongoose7.Schema;
|
|
505
559
|
var MessageReplyPreviewSchema = new MongooseSchema3(
|
|
506
560
|
{
|
|
507
561
|
contentPreview: { required: true, type: String },
|
|
508
562
|
senderId: {
|
|
509
563
|
ref: "User",
|
|
510
564
|
required: true,
|
|
511
|
-
type:
|
|
565
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
512
566
|
},
|
|
513
567
|
senderName: { required: true, type: String }
|
|
514
568
|
},
|
|
@@ -520,7 +574,7 @@ var MessageReactionSchema = new MongooseSchema3(
|
|
|
520
574
|
userId: {
|
|
521
575
|
ref: "User",
|
|
522
576
|
required: true,
|
|
523
|
-
type:
|
|
577
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
524
578
|
}
|
|
525
579
|
},
|
|
526
580
|
{ _id: false }
|
|
@@ -531,7 +585,7 @@ var MessageSeenSchema = new MongooseSchema3(
|
|
|
531
585
|
userId: {
|
|
532
586
|
ref: "User",
|
|
533
587
|
required: true,
|
|
534
|
-
type:
|
|
588
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
535
589
|
}
|
|
536
590
|
},
|
|
537
591
|
{ _id: false }
|
|
@@ -547,13 +601,13 @@ var MessageSchema = new MongooseSchema3(
|
|
|
547
601
|
replyToMessageId: {
|
|
548
602
|
ref: "Chat.messages",
|
|
549
603
|
required: false,
|
|
550
|
-
type:
|
|
604
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
551
605
|
},
|
|
552
606
|
seenBy: { default: [], required: false, type: [MessageSeenSchema] },
|
|
553
607
|
senderId: {
|
|
554
608
|
ref: "User",
|
|
555
609
|
required: true,
|
|
556
|
-
type:
|
|
610
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
557
611
|
}
|
|
558
612
|
},
|
|
559
613
|
{ timestamps: true }
|
|
@@ -566,7 +620,7 @@ var ParticipantSchema = new MongooseSchema3(
|
|
|
566
620
|
userId: {
|
|
567
621
|
ref: "User",
|
|
568
622
|
required: true,
|
|
569
|
-
type:
|
|
623
|
+
type: mongoose7.Schema.Types.ObjectId
|
|
570
624
|
},
|
|
571
625
|
userName: { required: true, type: String }
|
|
572
626
|
},
|
|
@@ -597,14 +651,14 @@ ChatSchema.index({
|
|
|
597
651
|
"participants.userId": 1,
|
|
598
652
|
updatedAt: -1
|
|
599
653
|
});
|
|
600
|
-
var ChatModel =
|
|
654
|
+
var ChatModel = mongoose7.models.Chat || mongoose7.model("Chat", ChatSchema);
|
|
601
655
|
|
|
602
656
|
// src/mongoose/chat/ChatReport.ts
|
|
603
657
|
import {
|
|
604
658
|
EnumChatReportReason
|
|
605
659
|
} from "@timardex/cluemart-shared";
|
|
606
|
-
import
|
|
607
|
-
var MongooseSchema4 =
|
|
660
|
+
import mongoose8 from "mongoose";
|
|
661
|
+
var MongooseSchema4 = mongoose8.Schema;
|
|
608
662
|
var ReasonSchema = new MongooseSchema4(
|
|
609
663
|
{
|
|
610
664
|
details: { default: null, required: false, type: String },
|
|
@@ -621,18 +675,18 @@ var ChatReportSchema = new MongooseSchema4(
|
|
|
621
675
|
chatId: {
|
|
622
676
|
ref: "Chat",
|
|
623
677
|
required: true,
|
|
624
|
-
type:
|
|
678
|
+
type: mongoose8.Schema.Types.ObjectId
|
|
625
679
|
},
|
|
626
680
|
reason: { required: true, type: ReasonSchema },
|
|
627
681
|
reportedUserId: {
|
|
628
682
|
ref: "User",
|
|
629
683
|
required: true,
|
|
630
|
-
type:
|
|
684
|
+
type: mongoose8.Schema.Types.ObjectId
|
|
631
685
|
},
|
|
632
686
|
reporterUserId: {
|
|
633
687
|
ref: "User",
|
|
634
688
|
required: true,
|
|
635
|
-
type:
|
|
689
|
+
type: mongoose8.Schema.Types.ObjectId
|
|
636
690
|
},
|
|
637
691
|
resolved: { default: false, required: true, type: Boolean }
|
|
638
692
|
},
|
|
@@ -640,7 +694,7 @@ var ChatReportSchema = new MongooseSchema4(
|
|
|
640
694
|
);
|
|
641
695
|
ChatReportSchema.index({ chatId: 1, reportedUserId: 1 });
|
|
642
696
|
ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
|
|
643
|
-
var ChatReportModel =
|
|
697
|
+
var ChatReportModel = mongoose8.models.ChatReport || mongoose8.model("ChatReport", ChatReportSchema);
|
|
644
698
|
|
|
645
699
|
// src/mongoose/global.ts
|
|
646
700
|
import {
|
|
@@ -648,15 +702,15 @@ import {
|
|
|
648
702
|
EnumPostType,
|
|
649
703
|
EnumUserLicence as EnumUserLicence2
|
|
650
704
|
} from "@timardex/cluemart-shared";
|
|
651
|
-
import
|
|
652
|
-
var MongooseSchema5 =
|
|
705
|
+
import mongoose9 from "mongoose";
|
|
706
|
+
var MongooseSchema5 = mongoose9.Schema;
|
|
653
707
|
var OwnerTypeSchema = new MongooseSchema5(
|
|
654
708
|
{
|
|
655
709
|
email: { required: true, type: String },
|
|
656
710
|
userId: {
|
|
657
711
|
ref: "User",
|
|
658
712
|
required: true,
|
|
659
|
-
type:
|
|
713
|
+
type: mongoose9.Schema.Types.ObjectId
|
|
660
714
|
}
|
|
661
715
|
},
|
|
662
716
|
{ _id: false }
|
|
@@ -799,7 +853,7 @@ var relatedPostSchema = new MongooseSchema5(
|
|
|
799
853
|
postId: {
|
|
800
854
|
ref: "Post",
|
|
801
855
|
required: true,
|
|
802
|
-
type:
|
|
856
|
+
type: mongoose9.Schema.Types.ObjectId
|
|
803
857
|
},
|
|
804
858
|
postSlug: { required: true, type: String },
|
|
805
859
|
postType: {
|
|
@@ -824,7 +878,7 @@ var baseResourceFields = {
|
|
|
824
878
|
adIds: {
|
|
825
879
|
ref: "Ad",
|
|
826
880
|
required: false,
|
|
827
|
-
type: [
|
|
881
|
+
type: [mongoose9.Schema.Types.ObjectId]
|
|
828
882
|
},
|
|
829
883
|
approvedAt: { default: null, required: false, type: Date },
|
|
830
884
|
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
@@ -857,7 +911,7 @@ var baseResourceFields = {
|
|
|
857
911
|
import {
|
|
858
912
|
EnumEventType
|
|
859
913
|
} from "@timardex/cluemart-shared";
|
|
860
|
-
import
|
|
914
|
+
import mongoose10 from "mongoose";
|
|
861
915
|
|
|
862
916
|
// src/mongoose/searchNamePlugin.ts
|
|
863
917
|
function deriveSearchName(name) {
|
|
@@ -903,15 +957,15 @@ function syncSearchNameInUpdate(update) {
|
|
|
903
957
|
}
|
|
904
958
|
return null;
|
|
905
959
|
}
|
|
906
|
-
function searchNamePlugin(
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
960
|
+
function searchNamePlugin(schema26) {
|
|
961
|
+
schema26.add({ searchName: { default: "", required: false, type: String } });
|
|
962
|
+
schema26.index({ searchName: 1 });
|
|
963
|
+
schema26.pre("save", function syncSearchNameOnSave(next) {
|
|
910
964
|
const doc = this;
|
|
911
965
|
doc.searchName = deriveSearchName(doc.name);
|
|
912
966
|
next();
|
|
913
967
|
});
|
|
914
|
-
|
|
968
|
+
schema26.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
915
969
|
const list = Array.isArray(docs) ? docs : [docs];
|
|
916
970
|
for (const doc of list) {
|
|
917
971
|
if (doc && typeof doc.name === "string") {
|
|
@@ -920,7 +974,7 @@ function searchNamePlugin(schema25) {
|
|
|
920
974
|
}
|
|
921
975
|
next();
|
|
922
976
|
});
|
|
923
|
-
|
|
977
|
+
schema26.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
924
978
|
for (const op of ops) {
|
|
925
979
|
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
926
980
|
if (doc && typeof doc.name === "string") {
|
|
@@ -946,14 +1000,14 @@ function searchNamePlugin(schema25) {
|
|
|
946
1000
|
}
|
|
947
1001
|
next();
|
|
948
1002
|
};
|
|
949
|
-
|
|
1003
|
+
schema26.pre(
|
|
950
1004
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
951
1005
|
syncSearchNameOnUpdate
|
|
952
1006
|
);
|
|
953
1007
|
}
|
|
954
1008
|
|
|
955
1009
|
// src/mongoose/GoogleImportedMarket.ts
|
|
956
|
-
var MongooseSchema6 =
|
|
1010
|
+
var MongooseSchema6 = mongoose10.Schema;
|
|
957
1011
|
var addressComponentSchema = new MongooseSchema6(
|
|
958
1012
|
{
|
|
959
1013
|
longName: { required: false, type: String },
|
|
@@ -962,7 +1016,7 @@ var addressComponentSchema = new MongooseSchema6(
|
|
|
962
1016
|
},
|
|
963
1017
|
{ _id: false }
|
|
964
1018
|
);
|
|
965
|
-
var
|
|
1019
|
+
var schema7 = new MongooseSchema6(
|
|
966
1020
|
{
|
|
967
1021
|
active: { default: false, required: true, type: Boolean },
|
|
968
1022
|
address: { required: true, type: String },
|
|
@@ -974,7 +1028,7 @@ var schema6 = new MongooseSchema6(
|
|
|
974
1028
|
claimedByUserId: {
|
|
975
1029
|
ref: "User",
|
|
976
1030
|
required: false,
|
|
977
|
-
type:
|
|
1031
|
+
type: mongoose10.Schema.Types.ObjectId
|
|
978
1032
|
},
|
|
979
1033
|
cover: {
|
|
980
1034
|
required: false,
|
|
@@ -986,7 +1040,7 @@ var schema6 = new MongooseSchema6(
|
|
|
986
1040
|
eventId: {
|
|
987
1041
|
ref: "Event",
|
|
988
1042
|
required: false,
|
|
989
|
-
type:
|
|
1043
|
+
type: mongoose10.Schema.Types.ObjectId
|
|
990
1044
|
},
|
|
991
1045
|
eventType: {
|
|
992
1046
|
enum: Object.values(EnumEventType),
|
|
@@ -1020,23 +1074,23 @@ var schema6 = new MongooseSchema6(
|
|
|
1020
1074
|
},
|
|
1021
1075
|
{ timestamps: true }
|
|
1022
1076
|
);
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
var GoogleImportedMarketModel =
|
|
1077
|
+
schema7.index({ "location.geo": "2dsphere" });
|
|
1078
|
+
schema7.index({ name: 1 });
|
|
1079
|
+
schema7.index({ region: 1 });
|
|
1080
|
+
schema7.index({ deletedAt: 1 });
|
|
1081
|
+
schema7.index({ "dateTime.dateStatus": 1 });
|
|
1082
|
+
schema7.index({ slug: 1 });
|
|
1083
|
+
schema7.index({ description: "text", name: "text" });
|
|
1084
|
+
schema7.plugin(searchNamePlugin);
|
|
1085
|
+
var GoogleImportedMarketModel = mongoose10.models.GoogleImportedMarket || mongoose10.model("GoogleImportedMarket", schema7);
|
|
1032
1086
|
|
|
1033
1087
|
// src/mongoose/Notification.ts
|
|
1034
1088
|
import {
|
|
1035
1089
|
EnumNotificationResourceType,
|
|
1036
1090
|
EnumNotificationType
|
|
1037
1091
|
} from "@timardex/cluemart-shared";
|
|
1038
|
-
import
|
|
1039
|
-
var MongooseSchema7 =
|
|
1092
|
+
import mongoose11 from "mongoose";
|
|
1093
|
+
var MongooseSchema7 = mongoose11.Schema;
|
|
1040
1094
|
var notificationDataSchema = new MongooseSchema7(
|
|
1041
1095
|
{
|
|
1042
1096
|
resourceId: { required: true, type: String },
|
|
@@ -1049,7 +1103,7 @@ var notificationDataSchema = new MongooseSchema7(
|
|
|
1049
1103
|
},
|
|
1050
1104
|
{ _id: false }
|
|
1051
1105
|
);
|
|
1052
|
-
var
|
|
1106
|
+
var schema8 = new MongooseSchema7(
|
|
1053
1107
|
{
|
|
1054
1108
|
data: {
|
|
1055
1109
|
default: null,
|
|
@@ -1068,20 +1122,20 @@ var schema7 = new MongooseSchema7(
|
|
|
1068
1122
|
userId: {
|
|
1069
1123
|
ref: "User",
|
|
1070
1124
|
required: true,
|
|
1071
|
-
type:
|
|
1125
|
+
type: mongoose11.Schema.Types.ObjectId
|
|
1072
1126
|
}
|
|
1073
1127
|
},
|
|
1074
1128
|
{ timestamps: true }
|
|
1075
1129
|
);
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
var NotificationModel =
|
|
1130
|
+
schema8.index({ isRead: 1, userId: 1 });
|
|
1131
|
+
schema8.index({ createdAt: -1, userId: 1 });
|
|
1132
|
+
var NotificationModel = mongoose11.models.Notification || mongoose11.model("Notification", schema8);
|
|
1079
1133
|
|
|
1080
1134
|
// src/mongoose/PushToken.ts
|
|
1081
1135
|
import { EnumOSPlatform } from "@timardex/cluemart-shared/enums";
|
|
1082
|
-
import
|
|
1083
|
-
var MongooseSchema8 =
|
|
1084
|
-
var
|
|
1136
|
+
import mongoose12 from "mongoose";
|
|
1137
|
+
var MongooseSchema8 = mongoose12.Schema;
|
|
1138
|
+
var schema9 = new MongooseSchema8(
|
|
1085
1139
|
{
|
|
1086
1140
|
platform: {
|
|
1087
1141
|
enum: Object.values(EnumOSPlatform),
|
|
@@ -1092,12 +1146,12 @@ var schema8 = new MongooseSchema8(
|
|
|
1092
1146
|
userId: {
|
|
1093
1147
|
ref: "User",
|
|
1094
1148
|
required: true,
|
|
1095
|
-
type:
|
|
1149
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1096
1150
|
}
|
|
1097
1151
|
},
|
|
1098
1152
|
{ timestamps: true }
|
|
1099
1153
|
);
|
|
1100
|
-
var PushTokenModel =
|
|
1154
|
+
var PushTokenModel = mongoose12.models.PushToken || mongoose12.model("PushToken", schema9);
|
|
1101
1155
|
|
|
1102
1156
|
// src/mongoose/Relation.ts
|
|
1103
1157
|
import {
|
|
@@ -1106,15 +1160,15 @@ import {
|
|
|
1106
1160
|
EnumRelationResource,
|
|
1107
1161
|
EnumResourceType as EnumResourceType2
|
|
1108
1162
|
} from "@timardex/cluemart-shared";
|
|
1109
|
-
import
|
|
1163
|
+
import mongoose14 from "mongoose";
|
|
1110
1164
|
|
|
1111
1165
|
// src/mongoose/event/EventInfo.ts
|
|
1112
1166
|
import {
|
|
1113
1167
|
EnumEventDateStatus as EnumEventDateStatus2,
|
|
1114
1168
|
EnumPaymentMethod
|
|
1115
1169
|
} from "@timardex/cluemart-shared";
|
|
1116
|
-
import
|
|
1117
|
-
var MongooseSchema9 =
|
|
1170
|
+
import mongoose13 from "mongoose";
|
|
1171
|
+
var MongooseSchema9 = mongoose13.Schema;
|
|
1118
1172
|
var StallTypeSchema = new MongooseSchema9(
|
|
1119
1173
|
{
|
|
1120
1174
|
label: { required: false, type: String },
|
|
@@ -1175,7 +1229,7 @@ var refundPolicySchema = new MongooseSchema9(
|
|
|
1175
1229
|
},
|
|
1176
1230
|
{ _id: false }
|
|
1177
1231
|
);
|
|
1178
|
-
var
|
|
1232
|
+
var schema10 = new MongooseSchema9(
|
|
1179
1233
|
{
|
|
1180
1234
|
active: { default: true, type: Boolean },
|
|
1181
1235
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -1183,7 +1237,7 @@ var schema9 = new MongooseSchema9(
|
|
|
1183
1237
|
eventId: {
|
|
1184
1238
|
ref: "Event",
|
|
1185
1239
|
required: true,
|
|
1186
|
-
type:
|
|
1240
|
+
type: mongoose13.Schema.Types.ObjectId
|
|
1187
1241
|
},
|
|
1188
1242
|
packInTime: { required: true, type: Number },
|
|
1189
1243
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -1193,11 +1247,11 @@ var schema9 = new MongooseSchema9(
|
|
|
1193
1247
|
},
|
|
1194
1248
|
{ timestamps: true }
|
|
1195
1249
|
);
|
|
1196
|
-
|
|
1197
|
-
var EventInfoModel =
|
|
1250
|
+
schema10.index({ eventId: 1 });
|
|
1251
|
+
var EventInfoModel = mongoose13.models.EventInfo || mongoose13.model("EventInfo", schema10);
|
|
1198
1252
|
|
|
1199
1253
|
// src/mongoose/Relation.ts
|
|
1200
|
-
var MongooseSchema10 =
|
|
1254
|
+
var MongooseSchema10 = mongoose14.Schema;
|
|
1201
1255
|
var relationDateTimeSchema = new MongooseSchema10(
|
|
1202
1256
|
{
|
|
1203
1257
|
dateStatus: {
|
|
@@ -1238,13 +1292,13 @@ var RelationTypeSchema = new MongooseSchema10(
|
|
|
1238
1292
|
chatId: {
|
|
1239
1293
|
ref: "Chat",
|
|
1240
1294
|
required: true,
|
|
1241
|
-
type:
|
|
1295
|
+
type: mongoose14.Schema.Types.ObjectId
|
|
1242
1296
|
},
|
|
1243
1297
|
deletedAt: { default: null, required: false, type: Date },
|
|
1244
1298
|
eventId: {
|
|
1245
1299
|
ref: "Event",
|
|
1246
1300
|
required: true,
|
|
1247
|
-
type:
|
|
1301
|
+
type: mongoose14.Schema.Types.ObjectId
|
|
1248
1302
|
},
|
|
1249
1303
|
lastUpdateBy: {
|
|
1250
1304
|
enum: Object.values(EnumResourceType2),
|
|
@@ -1260,7 +1314,7 @@ var RelationTypeSchema = new MongooseSchema10(
|
|
|
1260
1314
|
vendorId: {
|
|
1261
1315
|
ref: "Vendor",
|
|
1262
1316
|
required: true,
|
|
1263
|
-
type:
|
|
1317
|
+
type: mongoose14.Schema.Types.ObjectId
|
|
1264
1318
|
}
|
|
1265
1319
|
},
|
|
1266
1320
|
{ timestamps: true }
|
|
@@ -1272,7 +1326,7 @@ RelationTypeSchema.index({
|
|
|
1272
1326
|
"relationDates.status": 1,
|
|
1273
1327
|
vendorId: 1
|
|
1274
1328
|
});
|
|
1275
|
-
var RelationModel =
|
|
1329
|
+
var RelationModel = mongoose14.models.Relation || mongoose14.model("Relation", RelationTypeSchema);
|
|
1276
1330
|
|
|
1277
1331
|
// src/mongoose/ResourceActivity.ts
|
|
1278
1332
|
import {
|
|
@@ -1281,8 +1335,8 @@ import {
|
|
|
1281
1335
|
EnumOSPlatform as EnumOSPlatform2,
|
|
1282
1336
|
EnumResourceType as EnumResourceType3
|
|
1283
1337
|
} from "@timardex/cluemart-shared";
|
|
1284
|
-
import
|
|
1285
|
-
var MongooseSchema11 =
|
|
1338
|
+
import mongoose15 from "mongoose";
|
|
1339
|
+
var MongooseSchema11 = mongoose15.Schema;
|
|
1286
1340
|
var ActivitySchema = new MongooseSchema11(
|
|
1287
1341
|
{
|
|
1288
1342
|
activityType: {
|
|
@@ -1311,7 +1365,7 @@ var ActivitySchema = new MongooseSchema11(
|
|
|
1311
1365
|
},
|
|
1312
1366
|
{ _id: false }
|
|
1313
1367
|
);
|
|
1314
|
-
var
|
|
1368
|
+
var schema11 = new MongooseSchema11(
|
|
1315
1369
|
{
|
|
1316
1370
|
activity: { default: [], type: [ActivitySchema] },
|
|
1317
1371
|
resourceId: { required: true, type: String },
|
|
@@ -1323,9 +1377,9 @@ var schema10 = new MongooseSchema11(
|
|
|
1323
1377
|
},
|
|
1324
1378
|
{ timestamps: true }
|
|
1325
1379
|
);
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
var ResourceActivityModel =
|
|
1380
|
+
schema11.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
1381
|
+
schema11.index({ "views.location": "2dsphere" });
|
|
1382
|
+
var ResourceActivityModel = mongoose15.models.ResourceActivity || mongoose15.model("ResourceActivity", schema11);
|
|
1329
1383
|
|
|
1330
1384
|
// src/mongoose/User.ts
|
|
1331
1385
|
import {
|
|
@@ -1339,15 +1393,15 @@ import {
|
|
|
1339
1393
|
EnumUserLicence as EnumUserLicence3,
|
|
1340
1394
|
EnumUserRole
|
|
1341
1395
|
} from "@timardex/cluemart-shared";
|
|
1342
|
-
import
|
|
1343
|
-
var MongooseSchema12 =
|
|
1396
|
+
import mongoose16 from "mongoose";
|
|
1397
|
+
var MongooseSchema12 = mongoose16.Schema;
|
|
1344
1398
|
var userActivityEventSchema = new MongooseSchema12(
|
|
1345
1399
|
{
|
|
1346
1400
|
dateTime: dateTimeSchema,
|
|
1347
1401
|
resourceId: {
|
|
1348
1402
|
ref: "Event",
|
|
1349
1403
|
required: false,
|
|
1350
|
-
type:
|
|
1404
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1351
1405
|
}
|
|
1352
1406
|
},
|
|
1353
1407
|
{ _id: false }
|
|
@@ -1357,17 +1411,17 @@ var userActivityFavouritesSchema = new MongooseSchema12(
|
|
|
1357
1411
|
events: {
|
|
1358
1412
|
ref: "Event",
|
|
1359
1413
|
required: false,
|
|
1360
|
-
type: [
|
|
1414
|
+
type: [mongoose16.Schema.Types.ObjectId]
|
|
1361
1415
|
},
|
|
1362
1416
|
partners: {
|
|
1363
1417
|
ref: "Partner",
|
|
1364
1418
|
required: false,
|
|
1365
|
-
type: [
|
|
1419
|
+
type: [mongoose16.Schema.Types.ObjectId]
|
|
1366
1420
|
},
|
|
1367
1421
|
vendors: {
|
|
1368
1422
|
ref: "Vendor",
|
|
1369
1423
|
required: false,
|
|
1370
|
-
type: [
|
|
1424
|
+
type: [mongoose16.Schema.Types.ObjectId]
|
|
1371
1425
|
}
|
|
1372
1426
|
},
|
|
1373
1427
|
{ _id: false }
|
|
@@ -1479,13 +1533,13 @@ var userOverallPointsSchema = new MongooseSchema12(
|
|
|
1479
1533
|
},
|
|
1480
1534
|
{ _id: false }
|
|
1481
1535
|
);
|
|
1482
|
-
var
|
|
1536
|
+
var schema12 = new MongooseSchema12(
|
|
1483
1537
|
{
|
|
1484
1538
|
active: { default: false, required: true, type: Boolean },
|
|
1485
1539
|
affiliate: {
|
|
1486
1540
|
ref: "Affiliate",
|
|
1487
1541
|
required: false,
|
|
1488
|
-
type:
|
|
1542
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1489
1543
|
},
|
|
1490
1544
|
avatar: {
|
|
1491
1545
|
required: false,
|
|
@@ -1494,7 +1548,7 @@ var schema11 = new MongooseSchema12(
|
|
|
1494
1548
|
coupon: {
|
|
1495
1549
|
ref: "Coupon",
|
|
1496
1550
|
required: false,
|
|
1497
|
-
type:
|
|
1551
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1498
1552
|
},
|
|
1499
1553
|
deletedAt: { default: null, required: false, type: Date },
|
|
1500
1554
|
email: { required: true, type: String },
|
|
@@ -1506,13 +1560,13 @@ var schema11 = new MongooseSchema12(
|
|
|
1506
1560
|
events: {
|
|
1507
1561
|
ref: "Event",
|
|
1508
1562
|
required: false,
|
|
1509
|
-
type: [
|
|
1563
|
+
type: [mongoose16.Schema.Types.ObjectId]
|
|
1510
1564
|
},
|
|
1511
1565
|
firstName: { required: true, type: String },
|
|
1512
1566
|
game: {
|
|
1513
1567
|
ref: "Game",
|
|
1514
1568
|
required: false,
|
|
1515
|
-
type:
|
|
1569
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1516
1570
|
},
|
|
1517
1571
|
interests: {
|
|
1518
1572
|
enum: Object.values(EnumResourceType4),
|
|
@@ -1538,7 +1592,7 @@ var schema11 = new MongooseSchema12(
|
|
|
1538
1592
|
partner: {
|
|
1539
1593
|
ref: "Partner",
|
|
1540
1594
|
required: false,
|
|
1541
|
-
type:
|
|
1595
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1542
1596
|
},
|
|
1543
1597
|
password: { required: true, type: String },
|
|
1544
1598
|
platform: {
|
|
@@ -1579,7 +1633,7 @@ var schema11 = new MongooseSchema12(
|
|
|
1579
1633
|
school: {
|
|
1580
1634
|
ref: "School",
|
|
1581
1635
|
required: false,
|
|
1582
|
-
type:
|
|
1636
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1583
1637
|
},
|
|
1584
1638
|
stripe: {
|
|
1585
1639
|
required: false,
|
|
@@ -1604,21 +1658,21 @@ var schema11 = new MongooseSchema12(
|
|
|
1604
1658
|
vendor: {
|
|
1605
1659
|
ref: "Vendor",
|
|
1606
1660
|
required: false,
|
|
1607
|
-
type:
|
|
1661
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1608
1662
|
}
|
|
1609
1663
|
},
|
|
1610
1664
|
{ strict: false, timestamps: true }
|
|
1611
1665
|
);
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
var UserModel =
|
|
1666
|
+
schema12.index({ "licences.expiryDate": 1 });
|
|
1667
|
+
schema12.index({ "licences.licenceType": 1 });
|
|
1668
|
+
schema12.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
1669
|
+
schema12.index({ email: "text", firstName: "text", lastName: "text" });
|
|
1670
|
+
var UserModel = mongoose16.models.User || mongoose16.model("User", schema12);
|
|
1617
1671
|
|
|
1618
1672
|
// src/mongoose/VerificationToken.ts
|
|
1619
|
-
import
|
|
1620
|
-
var MongooseSchema13 =
|
|
1621
|
-
var
|
|
1673
|
+
import mongoose17 from "mongoose";
|
|
1674
|
+
var MongooseSchema13 = mongoose17.Schema;
|
|
1675
|
+
var schema13 = new MongooseSchema13(
|
|
1622
1676
|
{
|
|
1623
1677
|
createdAt: {
|
|
1624
1678
|
default: Date.now,
|
|
@@ -1633,15 +1687,15 @@ var schema12 = new MongooseSchema13(
|
|
|
1633
1687
|
},
|
|
1634
1688
|
{ timestamps: true }
|
|
1635
1689
|
);
|
|
1636
|
-
var VerificationTokenModel =
|
|
1690
|
+
var VerificationTokenModel = mongoose17.models.VerificationToken || mongoose17.model("VerificationToken", schema13);
|
|
1637
1691
|
|
|
1638
1692
|
// src/mongoose/vendor/Vendor.ts
|
|
1639
1693
|
import {
|
|
1640
1694
|
EnumEventDateStatus as EnumEventDateStatus5,
|
|
1641
1695
|
EnumVendorType
|
|
1642
1696
|
} from "@timardex/cluemart-shared";
|
|
1643
|
-
import
|
|
1644
|
-
var MongooseSchema14 =
|
|
1697
|
+
import mongoose18 from "mongoose";
|
|
1698
|
+
var MongooseSchema14 = mongoose18.Schema;
|
|
1645
1699
|
var vendorProductTypeSchema = new MongooseSchema14(
|
|
1646
1700
|
{
|
|
1647
1701
|
description: { required: false, type: String },
|
|
@@ -1704,7 +1758,7 @@ var downgradeSnapshotSchema = new MongooseSchema14(
|
|
|
1704
1758
|
},
|
|
1705
1759
|
{ _id: false }
|
|
1706
1760
|
);
|
|
1707
|
-
var
|
|
1761
|
+
var schema14 = new MongooseSchema14(
|
|
1708
1762
|
{
|
|
1709
1763
|
...baseResourceFields,
|
|
1710
1764
|
// Importing base resource fields from global.ts
|
|
@@ -1723,12 +1777,12 @@ var schema13 = new MongooseSchema14(
|
|
|
1723
1777
|
unregisteredVendorId: {
|
|
1724
1778
|
ref: "UnregisteredVendor",
|
|
1725
1779
|
required: false,
|
|
1726
|
-
type:
|
|
1780
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1727
1781
|
},
|
|
1728
1782
|
vendorInfoId: {
|
|
1729
1783
|
ref: "VendorInfo",
|
|
1730
1784
|
required: false,
|
|
1731
|
-
type:
|
|
1785
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1732
1786
|
},
|
|
1733
1787
|
vendorType: {
|
|
1734
1788
|
enum: Object.values(EnumVendorType),
|
|
@@ -1738,26 +1792,26 @@ var schema13 = new MongooseSchema14(
|
|
|
1738
1792
|
},
|
|
1739
1793
|
{ timestamps: true }
|
|
1740
1794
|
);
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1795
|
+
schema14.index({ name: 1 });
|
|
1796
|
+
schema14.index({ description: 1 });
|
|
1797
|
+
schema14.index({ region: 1 });
|
|
1798
|
+
schema14.index({ "categories.name": 1 });
|
|
1799
|
+
schema14.index({ slug: 1 });
|
|
1800
|
+
schema14.index({
|
|
1747
1801
|
categoriesNames: "text",
|
|
1748
1802
|
description: "text",
|
|
1749
1803
|
name: "text"
|
|
1750
1804
|
});
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
var VendorModel =
|
|
1805
|
+
schema14.index({ deletedAt: 1, "owner.userId": 1 });
|
|
1806
|
+
schema14.plugin(searchNamePlugin);
|
|
1807
|
+
var VendorModel = mongoose18.models.Vendor || mongoose18.model("Vendor", schema14);
|
|
1754
1808
|
|
|
1755
1809
|
// src/mongoose/vendor/VendorInfo.ts
|
|
1756
1810
|
import {
|
|
1757
1811
|
EnumFoodFlavor
|
|
1758
1812
|
} from "@timardex/cluemart-shared";
|
|
1759
|
-
import
|
|
1760
|
-
var MongooseSchema15 =
|
|
1813
|
+
import mongoose19 from "mongoose";
|
|
1814
|
+
var MongooseSchema15 = mongoose19.Schema;
|
|
1761
1815
|
var AttributesSchema = new MongooseSchema15(
|
|
1762
1816
|
{
|
|
1763
1817
|
details: { required: false, type: String },
|
|
@@ -1765,7 +1819,7 @@ var AttributesSchema = new MongooseSchema15(
|
|
|
1765
1819
|
},
|
|
1766
1820
|
{ _id: false }
|
|
1767
1821
|
);
|
|
1768
|
-
var
|
|
1822
|
+
var schema15 = new MongooseSchema15(
|
|
1769
1823
|
{
|
|
1770
1824
|
active: { default: true, type: Boolean },
|
|
1771
1825
|
compliance: {
|
|
@@ -1800,29 +1854,29 @@ var schema14 = new MongooseSchema15(
|
|
|
1800
1854
|
vendorId: {
|
|
1801
1855
|
ref: "Vendor",
|
|
1802
1856
|
required: true,
|
|
1803
|
-
type:
|
|
1857
|
+
type: mongoose19.Schema.Types.ObjectId
|
|
1804
1858
|
}
|
|
1805
1859
|
},
|
|
1806
1860
|
{ timestamps: true }
|
|
1807
1861
|
);
|
|
1808
|
-
|
|
1809
|
-
var VendorInfoModel =
|
|
1862
|
+
schema15.index({ vendorId: 1 });
|
|
1863
|
+
var VendorInfoModel = mongoose19.models.VendorInfo || mongoose19.model("VendorInfo", schema15);
|
|
1810
1864
|
|
|
1811
1865
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
1812
|
-
import
|
|
1813
|
-
var MongooseSchema16 =
|
|
1866
|
+
import mongoose20 from "mongoose";
|
|
1867
|
+
var MongooseSchema16 = mongoose20.Schema;
|
|
1814
1868
|
var invitationSchema = new MongooseSchema16(
|
|
1815
1869
|
{
|
|
1816
1870
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
1817
1871
|
inviterId: {
|
|
1818
1872
|
ref: "Event",
|
|
1819
1873
|
required: true,
|
|
1820
|
-
type:
|
|
1874
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1821
1875
|
}
|
|
1822
1876
|
},
|
|
1823
1877
|
{ _id: false }
|
|
1824
1878
|
);
|
|
1825
|
-
var
|
|
1879
|
+
var schema16 = new MongooseSchema16(
|
|
1826
1880
|
{
|
|
1827
1881
|
active: { default: true, required: true, type: Boolean },
|
|
1828
1882
|
categoryIds: { required: true, type: [String] },
|
|
@@ -1831,7 +1885,7 @@ var schema15 = new MongooseSchema16(
|
|
|
1831
1885
|
claimedByUserId: {
|
|
1832
1886
|
ref: "User",
|
|
1833
1887
|
required: false,
|
|
1834
|
-
type:
|
|
1888
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1835
1889
|
},
|
|
1836
1890
|
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
1837
1891
|
claimToken: { default: null, required: false, type: String },
|
|
@@ -1844,15 +1898,15 @@ var schema15 = new MongooseSchema16(
|
|
|
1844
1898
|
},
|
|
1845
1899
|
{ timestamps: true }
|
|
1846
1900
|
);
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
var UnregisteredVendorModel =
|
|
1901
|
+
schema16.index({ name: 1 });
|
|
1902
|
+
schema16.index({ email: 1 });
|
|
1903
|
+
var UnregisteredVendorModel = mongoose20.models.UnregisteredVendor || mongoose20.model("UnregisteredVendor", schema16);
|
|
1850
1904
|
|
|
1851
1905
|
// src/mongoose/event/Event.ts
|
|
1852
1906
|
import { EnumEventType as EnumEventType2 } from "@timardex/cluemart-shared";
|
|
1853
|
-
import
|
|
1854
|
-
var MongooseSchema17 =
|
|
1855
|
-
var
|
|
1907
|
+
import mongoose21 from "mongoose";
|
|
1908
|
+
var MongooseSchema17 = mongoose21.Schema;
|
|
1909
|
+
var schema17 = new MongooseSchema17(
|
|
1856
1910
|
{
|
|
1857
1911
|
...baseResourceFields,
|
|
1858
1912
|
// Importing base resource fields from global.ts
|
|
@@ -1861,7 +1915,7 @@ var schema16 = new MongooseSchema17(
|
|
|
1861
1915
|
eventInfoId: {
|
|
1862
1916
|
ref: "EventInfo",
|
|
1863
1917
|
required: false,
|
|
1864
|
-
type:
|
|
1918
|
+
type: mongoose21.Schema.Types.ObjectId
|
|
1865
1919
|
},
|
|
1866
1920
|
eventType: {
|
|
1867
1921
|
enum: Object.values(EnumEventType2),
|
|
@@ -1885,40 +1939,40 @@ var schema16 = new MongooseSchema17(
|
|
|
1885
1939
|
},
|
|
1886
1940
|
{ timestamps: true }
|
|
1887
1941
|
);
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
var EventModel =
|
|
1942
|
+
schema17.index({ name: 1 });
|
|
1943
|
+
schema17.index({ description: 1 });
|
|
1944
|
+
schema17.index({ region: 1 });
|
|
1945
|
+
schema17.index({ "location.geo": "2dsphere" });
|
|
1946
|
+
schema17.index({ tags: 1 });
|
|
1947
|
+
schema17.index({ deletedAt: 1 });
|
|
1948
|
+
schema17.index({ "dateTime.dateStatus": 1 });
|
|
1949
|
+
schema17.index({ slug: 1 });
|
|
1950
|
+
schema17.index({ description: "text", name: "text", tags: "text" });
|
|
1951
|
+
schema17.index({ deletedAt: 1, "owner.userId": 1 });
|
|
1952
|
+
schema17.plugin(searchNamePlugin);
|
|
1953
|
+
var EventModel = mongoose21.models.Event || mongoose21.model("Event", schema17);
|
|
1900
1954
|
|
|
1901
1955
|
// src/mongoose/event/EventDateArchive.ts
|
|
1902
|
-
import
|
|
1903
|
-
var
|
|
1956
|
+
import mongoose22 from "mongoose";
|
|
1957
|
+
var schema18 = new mongoose22.Schema(
|
|
1904
1958
|
{
|
|
1905
1959
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
1906
1960
|
eventId: {
|
|
1907
1961
|
ref: "Event",
|
|
1908
1962
|
required: true,
|
|
1909
|
-
type:
|
|
1963
|
+
type: mongoose22.Schema.Types.ObjectId
|
|
1910
1964
|
}
|
|
1911
1965
|
},
|
|
1912
1966
|
{ timestamps: true }
|
|
1913
1967
|
);
|
|
1914
|
-
|
|
1915
|
-
var EventDateArchiveModel =
|
|
1968
|
+
schema18.index({ eventId: 1 }, { unique: true });
|
|
1969
|
+
var EventDateArchiveModel = mongoose22.models.EventDateArchive || mongoose22.model("EventDateArchive", schema18);
|
|
1916
1970
|
|
|
1917
1971
|
// src/mongoose/Partner.ts
|
|
1918
1972
|
import { EnumPartnerType } from "@timardex/cluemart-shared";
|
|
1919
|
-
import
|
|
1920
|
-
var MongooseSchema18 =
|
|
1921
|
-
var
|
|
1973
|
+
import mongoose23 from "mongoose";
|
|
1974
|
+
var MongooseSchema18 = mongoose23.Schema;
|
|
1975
|
+
var schema19 = new MongooseSchema18(
|
|
1922
1976
|
{
|
|
1923
1977
|
...baseResourceFields,
|
|
1924
1978
|
location: {
|
|
@@ -1934,15 +1988,15 @@ var schema18 = new MongooseSchema18(
|
|
|
1934
1988
|
},
|
|
1935
1989
|
{ timestamps: true }
|
|
1936
1990
|
);
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
var PartnerModel =
|
|
1991
|
+
schema19.index({ name: 1 });
|
|
1992
|
+
schema19.index({ description: 1 });
|
|
1993
|
+
schema19.index({ region: 1 });
|
|
1994
|
+
schema19.index({ "location.geo": "2dsphere" });
|
|
1995
|
+
schema19.index({ slug: 1 });
|
|
1996
|
+
schema19.index({ name: "text", description: "text" });
|
|
1997
|
+
schema19.index({ "owner.userId": 1, deletedAt: 1 });
|
|
1998
|
+
schema19.plugin(searchNamePlugin);
|
|
1999
|
+
var PartnerModel = mongoose23.models.Partner || mongoose23.model("Partner", schema19);
|
|
1946
2000
|
|
|
1947
2001
|
// src/mongoose/Post.ts
|
|
1948
2002
|
import {
|
|
@@ -1950,8 +2004,8 @@ import {
|
|
|
1950
2004
|
EnumPostType as EnumPostType2,
|
|
1951
2005
|
EnumResourceType as EnumResourceType5
|
|
1952
2006
|
} from "@timardex/cluemart-shared";
|
|
1953
|
-
import
|
|
1954
|
-
var MongooseSchema19 =
|
|
2007
|
+
import mongoose24, { Schema } from "mongoose";
|
|
2008
|
+
var MongooseSchema19 = mongoose24.Schema;
|
|
1955
2009
|
var contentSchema = new MongooseSchema19(
|
|
1956
2010
|
{
|
|
1957
2011
|
contentData: Schema.Types.Mixed,
|
|
@@ -1977,7 +2031,7 @@ var resourceSchema = new MongooseSchema19(
|
|
|
1977
2031
|
},
|
|
1978
2032
|
{ _id: false }
|
|
1979
2033
|
);
|
|
1980
|
-
var
|
|
2034
|
+
var schema20 = new MongooseSchema19(
|
|
1981
2035
|
{
|
|
1982
2036
|
active: { default: false, required: true, type: Boolean },
|
|
1983
2037
|
approvedAt: { default: null, required: false, type: Date },
|
|
@@ -2008,14 +2062,14 @@ var schema19 = new MongooseSchema19(
|
|
|
2008
2062
|
},
|
|
2009
2063
|
{ timestamps: true }
|
|
2010
2064
|
);
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
var PostModel =
|
|
2065
|
+
schema20.index({ title: 1 });
|
|
2066
|
+
schema20.index({ tags: 1 });
|
|
2067
|
+
schema20.index({ postType: 1, slug: 1 }, { unique: true });
|
|
2068
|
+
var PostModel = mongoose24.models.Post || mongoose24.model("Post", schema20);
|
|
2015
2069
|
|
|
2016
2070
|
// src/mongoose/AppSetting.ts
|
|
2017
|
-
import
|
|
2018
|
-
var MongooseSchema20 =
|
|
2071
|
+
import mongoose25 from "mongoose";
|
|
2072
|
+
var MongooseSchema20 = mongoose25.Schema;
|
|
2019
2073
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
2020
2074
|
var AppSettingSchema = new MongooseSchema20(
|
|
2021
2075
|
{
|
|
@@ -2039,6 +2093,8 @@ var AppSettingSchema = new MongooseSchema20(
|
|
|
2039
2093
|
validate: Number.isInteger
|
|
2040
2094
|
},
|
|
2041
2095
|
mobileDisplayEnabled: { default: false, required: true, type: Boolean },
|
|
2096
|
+
purchasePricing: { type: MongooseSchema20.Types.Mixed },
|
|
2097
|
+
regionPricing: { type: MongooseSchema20.Types.Mixed },
|
|
2042
2098
|
paidSlotsPerPlacement: { enum: [30], type: Number },
|
|
2043
2099
|
reservedSlotsPerPlacement: { enum: [7], type: Number },
|
|
2044
2100
|
rotationSeconds: { enum: [8], type: Number },
|
|
@@ -2063,12 +2119,12 @@ var AppSettingSchema = new MongooseSchema20(
|
|
|
2063
2119
|
},
|
|
2064
2120
|
{ timestamps: true }
|
|
2065
2121
|
);
|
|
2066
|
-
var AppSettingModel =
|
|
2122
|
+
var AppSettingModel = mongoose25.models.AppSetting || mongoose25.model("AppSetting", AppSettingSchema);
|
|
2067
2123
|
|
|
2068
2124
|
// src/mongoose/AuthHandoffToken.ts
|
|
2069
|
-
import
|
|
2070
|
-
var MongooseSchema21 =
|
|
2071
|
-
var
|
|
2125
|
+
import mongoose26 from "mongoose";
|
|
2126
|
+
var MongooseSchema21 = mongoose26.Schema;
|
|
2127
|
+
var schema21 = new MongooseSchema21(
|
|
2072
2128
|
{
|
|
2073
2129
|
expiresAt: { required: true, type: Date },
|
|
2074
2130
|
jti: { index: true, required: true, type: String, unique: true },
|
|
@@ -2077,27 +2133,27 @@ var schema20 = new MongooseSchema21(
|
|
|
2077
2133
|
index: true,
|
|
2078
2134
|
ref: "User",
|
|
2079
2135
|
required: true,
|
|
2080
|
-
type:
|
|
2136
|
+
type: mongoose26.Schema.Types.ObjectId
|
|
2081
2137
|
}
|
|
2082
2138
|
},
|
|
2083
2139
|
{ timestamps: true }
|
|
2084
2140
|
);
|
|
2085
|
-
|
|
2086
|
-
var AuthHandoffTokenModel =
|
|
2141
|
+
schema21.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2142
|
+
var AuthHandoffTokenModel = mongoose26.models.AuthHandoffToken || mongoose26.model("AuthHandoffToken", schema21);
|
|
2087
2143
|
|
|
2088
2144
|
// src/mongoose/game/Game.ts
|
|
2089
2145
|
import {
|
|
2090
2146
|
EnumGameStatus,
|
|
2091
2147
|
EnumGameType
|
|
2092
2148
|
} from "@timardex/cluemart-shared";
|
|
2093
|
-
import
|
|
2149
|
+
import mongoose30 from "mongoose";
|
|
2094
2150
|
|
|
2095
2151
|
// src/mongoose/game/DailyClue.ts
|
|
2096
|
-
import
|
|
2152
|
+
import mongoose28 from "mongoose";
|
|
2097
2153
|
|
|
2098
2154
|
// src/mongoose/game/utils.ts
|
|
2099
|
-
import
|
|
2100
|
-
var MongooseSchema22 =
|
|
2155
|
+
import mongoose27 from "mongoose";
|
|
2156
|
+
var MongooseSchema22 = mongoose27.Schema;
|
|
2101
2157
|
var schemaGameDate = new MongooseSchema22(
|
|
2102
2158
|
{
|
|
2103
2159
|
endDate: { required: true, type: Date },
|
|
@@ -2107,7 +2163,7 @@ var schemaGameDate = new MongooseSchema22(
|
|
|
2107
2163
|
);
|
|
2108
2164
|
|
|
2109
2165
|
// src/mongoose/game/DailyClue.ts
|
|
2110
|
-
var MongooseSchema23 =
|
|
2166
|
+
var MongooseSchema23 = mongoose28.Schema;
|
|
2111
2167
|
var schemaLetters = new MongooseSchema23(
|
|
2112
2168
|
{
|
|
2113
2169
|
collected: { required: false, type: [String] },
|
|
@@ -2138,8 +2194,8 @@ var schemaDailyClueGameData = new MongooseSchema23(
|
|
|
2138
2194
|
);
|
|
2139
2195
|
|
|
2140
2196
|
// src/mongoose/game/PuzzleGame.ts
|
|
2141
|
-
import
|
|
2142
|
-
var MongooseSchema24 =
|
|
2197
|
+
import mongoose29 from "mongoose";
|
|
2198
|
+
var MongooseSchema24 = mongoose29.Schema;
|
|
2143
2199
|
var schemaPuzzleAnswer = new MongooseSchema24(
|
|
2144
2200
|
{
|
|
2145
2201
|
answer: { required: true, type: String },
|
|
@@ -2184,16 +2240,16 @@ var schemaPuzzleGameData = new MongooseSchema24(
|
|
|
2184
2240
|
);
|
|
2185
2241
|
|
|
2186
2242
|
// src/mongoose/game/Game.ts
|
|
2187
|
-
var MongooseSchema25 =
|
|
2243
|
+
var MongooseSchema25 = mongoose30.Schema;
|
|
2188
2244
|
var gameDataSchemas = {
|
|
2189
2245
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2190
2246
|
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2191
2247
|
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2192
2248
|
};
|
|
2193
2249
|
var gameDataDefinition = Object.fromEntries(
|
|
2194
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2250
|
+
Object.entries(gameDataSchemas).map(([key, schema26]) => [
|
|
2195
2251
|
key,
|
|
2196
|
-
{ default: null, required: false, type:
|
|
2252
|
+
{ default: null, required: false, type: schema26 }
|
|
2197
2253
|
])
|
|
2198
2254
|
);
|
|
2199
2255
|
var gameHistorySchema = new MongooseSchema25(
|
|
@@ -2234,7 +2290,7 @@ var gameTypeSchema = new MongooseSchema25(
|
|
|
2234
2290
|
},
|
|
2235
2291
|
{ timestamps: true }
|
|
2236
2292
|
);
|
|
2237
|
-
var
|
|
2293
|
+
var schema22 = new MongooseSchema25(
|
|
2238
2294
|
{
|
|
2239
2295
|
active: { default: false, required: true, type: Boolean },
|
|
2240
2296
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2247,11 +2303,11 @@ var schema21 = new MongooseSchema25(
|
|
|
2247
2303
|
},
|
|
2248
2304
|
{ timestamps: true }
|
|
2249
2305
|
);
|
|
2250
|
-
var GameModel =
|
|
2306
|
+
var GameModel = mongoose30.models.Game || mongoose30.model("Game", schema22);
|
|
2251
2307
|
|
|
2252
2308
|
// src/mongoose/School.ts
|
|
2253
|
-
import
|
|
2254
|
-
var MongooseSchema26 =
|
|
2309
|
+
import mongoose31 from "mongoose";
|
|
2310
|
+
var MongooseSchema26 = mongoose31.Schema;
|
|
2255
2311
|
var campaignsSchema = new MongooseSchema26(
|
|
2256
2312
|
{
|
|
2257
2313
|
endDate: { required: true, type: Date },
|
|
@@ -2260,7 +2316,7 @@ var campaignsSchema = new MongooseSchema26(
|
|
|
2260
2316
|
},
|
|
2261
2317
|
{ _id: false }
|
|
2262
2318
|
);
|
|
2263
|
-
var
|
|
2319
|
+
var schema23 = new MongooseSchema26(
|
|
2264
2320
|
{
|
|
2265
2321
|
// New schools are active by default
|
|
2266
2322
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2287,14 +2343,14 @@ var schema22 = new MongooseSchema26(
|
|
|
2287
2343
|
},
|
|
2288
2344
|
{ timestamps: true }
|
|
2289
2345
|
);
|
|
2290
|
-
|
|
2346
|
+
schema23.index(
|
|
2291
2347
|
{ schoolCode: 1 },
|
|
2292
2348
|
{
|
|
2293
2349
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2294
2350
|
unique: true
|
|
2295
2351
|
}
|
|
2296
2352
|
);
|
|
2297
|
-
var SchoolModel =
|
|
2353
|
+
var SchoolModel = mongoose31.models.School || mongoose31.model("School", schema23);
|
|
2298
2354
|
|
|
2299
2355
|
// src/mongoose/Affiliate.ts
|
|
2300
2356
|
import {
|
|
@@ -2302,8 +2358,8 @@ import {
|
|
|
2302
2358
|
EnumAffiliateRewardType,
|
|
2303
2359
|
EnumResourceType as EnumResourceType6
|
|
2304
2360
|
} from "@timardex/cluemart-shared";
|
|
2305
|
-
import
|
|
2306
|
-
var MongooseSchema27 =
|
|
2361
|
+
import mongoose32 from "mongoose";
|
|
2362
|
+
var MongooseSchema27 = mongoose32.Schema;
|
|
2307
2363
|
var affiliateRewardSchema = new MongooseSchema27(
|
|
2308
2364
|
{
|
|
2309
2365
|
createdAt: { required: true, type: Date },
|
|
@@ -2324,7 +2380,7 @@ var affiliateResourceSchema = new MongooseSchema27(
|
|
|
2324
2380
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2325
2381
|
resourceId: {
|
|
2326
2382
|
required: true,
|
|
2327
|
-
type:
|
|
2383
|
+
type: mongoose32.Schema.Types.ObjectId
|
|
2328
2384
|
},
|
|
2329
2385
|
resourceName: { required: true, type: String },
|
|
2330
2386
|
resourceOwner: {
|
|
@@ -2387,7 +2443,7 @@ var redeemHistorySchema = new MongooseSchema27(
|
|
|
2387
2443
|
},
|
|
2388
2444
|
{ _id: false }
|
|
2389
2445
|
);
|
|
2390
|
-
var
|
|
2446
|
+
var schema24 = new MongooseSchema27(
|
|
2391
2447
|
{
|
|
2392
2448
|
active: { default: false, required: true, type: Boolean },
|
|
2393
2449
|
affiliateBonusRewards: {
|
|
@@ -2417,22 +2473,22 @@ var schema23 = new MongooseSchema27(
|
|
|
2417
2473
|
},
|
|
2418
2474
|
{ timestamps: true }
|
|
2419
2475
|
);
|
|
2420
|
-
|
|
2476
|
+
schema24.index(
|
|
2421
2477
|
{ affiliateCode: 1 },
|
|
2422
2478
|
{
|
|
2423
2479
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2424
2480
|
unique: true
|
|
2425
2481
|
}
|
|
2426
2482
|
);
|
|
2427
|
-
var AffiliateModel =
|
|
2483
|
+
var AffiliateModel = mongoose32.models.Affiliate || mongoose32.model("Affiliate", schema24);
|
|
2428
2484
|
|
|
2429
2485
|
// src/mongoose/Coupon.ts
|
|
2430
2486
|
import {
|
|
2431
2487
|
EnumCouponQualificationType,
|
|
2432
2488
|
EnumResourceType as EnumResourceType7
|
|
2433
2489
|
} from "@timardex/cluemart-shared";
|
|
2434
|
-
import
|
|
2435
|
-
var MongooseSchema28 =
|
|
2490
|
+
import mongoose33 from "mongoose";
|
|
2491
|
+
var MongooseSchema28 = mongoose33.Schema;
|
|
2436
2492
|
var couponOptionSchema = new MongooseSchema28(
|
|
2437
2493
|
{
|
|
2438
2494
|
buy: { required: false, type: Number },
|
|
@@ -2452,20 +2508,20 @@ var couponVendorProductSchema = new MongooseSchema28(
|
|
|
2452
2508
|
{
|
|
2453
2509
|
couponId: {
|
|
2454
2510
|
required: true,
|
|
2455
|
-
type:
|
|
2511
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2456
2512
|
},
|
|
2457
2513
|
productId: {
|
|
2458
2514
|
required: true,
|
|
2459
|
-
type:
|
|
2515
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2460
2516
|
},
|
|
2461
2517
|
vendorCouponId: {
|
|
2462
2518
|
required: false,
|
|
2463
|
-
type:
|
|
2519
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2464
2520
|
},
|
|
2465
2521
|
vendorId: {
|
|
2466
2522
|
ref: "Vendor",
|
|
2467
2523
|
required: true,
|
|
2468
|
-
type:
|
|
2524
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2469
2525
|
}
|
|
2470
2526
|
},
|
|
2471
2527
|
{ _id: false }
|
|
@@ -2487,7 +2543,7 @@ var couponParticipantUserSchema = new MongooseSchema28(
|
|
|
2487
2543
|
userId: {
|
|
2488
2544
|
ref: "User",
|
|
2489
2545
|
required: true,
|
|
2490
|
-
type:
|
|
2546
|
+
type: mongoose33.Schema.Types.ObjectId
|
|
2491
2547
|
}
|
|
2492
2548
|
},
|
|
2493
2549
|
{ timestamps: true }
|
|
@@ -2519,7 +2575,7 @@ var couponDataSchema = new MongooseSchema28(
|
|
|
2519
2575
|
},
|
|
2520
2576
|
{ timestamps: true }
|
|
2521
2577
|
);
|
|
2522
|
-
var
|
|
2578
|
+
var schema25 = new MongooseSchema28(
|
|
2523
2579
|
{
|
|
2524
2580
|
active: { default: true, required: true, type: Boolean },
|
|
2525
2581
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2531,14 +2587,14 @@ var schema24 = new MongooseSchema28(
|
|
|
2531
2587
|
},
|
|
2532
2588
|
{ timestamps: true }
|
|
2533
2589
|
);
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
var CouponModel =
|
|
2590
|
+
schema25.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2591
|
+
schema25.index({ "couponData.participantUsers.userId": 1 });
|
|
2592
|
+
var CouponModel = mongoose33.models.Coupon || mongoose33.model("Coupon", schema25);
|
|
2537
2593
|
|
|
2538
2594
|
// src/mongoose/Impersonation.ts
|
|
2539
2595
|
import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
|
|
2540
|
-
import
|
|
2541
|
-
var MongooseSchema29 =
|
|
2596
|
+
import mongoose34 from "mongoose";
|
|
2597
|
+
var MongooseSchema29 = mongoose34.Schema;
|
|
2542
2598
|
var impersonationSessionSchema = new MongooseSchema29(
|
|
2543
2599
|
{
|
|
2544
2600
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
@@ -2546,19 +2602,19 @@ var impersonationSessionSchema = new MongooseSchema29(
|
|
|
2546
2602
|
index: true,
|
|
2547
2603
|
ref: "User",
|
|
2548
2604
|
required: true,
|
|
2549
|
-
type:
|
|
2605
|
+
type: mongoose34.Schema.Types.ObjectId
|
|
2550
2606
|
},
|
|
2551
2607
|
impersonatorUserId: {
|
|
2552
2608
|
index: true,
|
|
2553
2609
|
ref: "User",
|
|
2554
2610
|
required: true,
|
|
2555
|
-
type:
|
|
2611
|
+
type: mongoose34.Schema.Types.ObjectId
|
|
2556
2612
|
},
|
|
2557
2613
|
refreshToken: { required: true, type: String }
|
|
2558
2614
|
},
|
|
2559
2615
|
{ timestamps: true }
|
|
2560
2616
|
);
|
|
2561
|
-
var ImpersonationSessionModel =
|
|
2617
|
+
var ImpersonationSessionModel = mongoose34.models.ImpersonationSession || mongoose34.model(
|
|
2562
2618
|
"ImpersonationSession",
|
|
2563
2619
|
impersonationSessionSchema
|
|
2564
2620
|
);
|
|
@@ -2569,24 +2625,24 @@ var impersonationAuditSchema = new MongooseSchema29(
|
|
|
2569
2625
|
impersonatedUserId: {
|
|
2570
2626
|
ref: "User",
|
|
2571
2627
|
required: true,
|
|
2572
|
-
type:
|
|
2628
|
+
type: mongoose34.Schema.Types.ObjectId
|
|
2573
2629
|
},
|
|
2574
2630
|
impersonatorUserId: {
|
|
2575
2631
|
ref: "User",
|
|
2576
2632
|
required: true,
|
|
2577
|
-
type:
|
|
2633
|
+
type: mongoose34.Schema.Types.ObjectId
|
|
2578
2634
|
},
|
|
2579
|
-
resourceId: { type:
|
|
2635
|
+
resourceId: { type: mongoose34.Schema.Types.ObjectId },
|
|
2580
2636
|
resourceType: { enum: Object.values(EnumResourceType8), type: String },
|
|
2581
2637
|
sessionId: {
|
|
2582
2638
|
ref: "ImpersonationSession",
|
|
2583
2639
|
required: true,
|
|
2584
|
-
type:
|
|
2640
|
+
type: mongoose34.Schema.Types.ObjectId
|
|
2585
2641
|
}
|
|
2586
2642
|
},
|
|
2587
2643
|
{ timestamps: true }
|
|
2588
2644
|
);
|
|
2589
|
-
var ImpersonationAuditModel =
|
|
2645
|
+
var ImpersonationAuditModel = mongoose34.models.ImpersonationAudit || mongoose34.model(
|
|
2590
2646
|
"ImpersonationAudit",
|
|
2591
2647
|
impersonationAuditSchema
|
|
2592
2648
|
);
|
|
@@ -3030,7 +3086,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
3030
3086
|
}
|
|
3031
3087
|
|
|
3032
3088
|
// src/service/database.ts
|
|
3033
|
-
import
|
|
3089
|
+
import mongoose35 from "mongoose";
|
|
3034
3090
|
var connectToDatabase = async ({
|
|
3035
3091
|
appName,
|
|
3036
3092
|
dbName,
|
|
@@ -3043,7 +3099,7 @@ var connectToDatabase = async ({
|
|
|
3043
3099
|
// Fallback to MongoDB Atlas connection string
|
|
3044
3100
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
3045
3101
|
);
|
|
3046
|
-
await
|
|
3102
|
+
await mongoose35.connect(mongoUri);
|
|
3047
3103
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
3048
3104
|
console.log(
|
|
3049
3105
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -3056,7 +3112,7 @@ var connectToDatabase = async ({
|
|
|
3056
3112
|
|
|
3057
3113
|
// src/types/index.ts
|
|
3058
3114
|
import express from "express";
|
|
3059
|
-
import
|
|
3115
|
+
import mongoose36 from "mongoose";
|
|
3060
3116
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
3061
3117
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
3062
3118
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -3178,15 +3234,15 @@ async function updateAdStatuses() {
|
|
|
3178
3234
|
}
|
|
3179
3235
|
|
|
3180
3236
|
// src/service/objectIdToString.ts
|
|
3181
|
-
import
|
|
3237
|
+
import mongoose37 from "mongoose";
|
|
3182
3238
|
function isValidObjectId(value) {
|
|
3183
|
-
return
|
|
3239
|
+
return mongoose37.Types.ObjectId.isValid(value);
|
|
3184
3240
|
}
|
|
3185
3241
|
function convertObjectIdsToStrings(obj) {
|
|
3186
3242
|
if (obj === null || obj === void 0) {
|
|
3187
3243
|
return obj;
|
|
3188
3244
|
}
|
|
3189
|
-
if (obj instanceof
|
|
3245
|
+
if (obj instanceof mongoose37.Types.ObjectId) {
|
|
3190
3246
|
return obj.toString();
|
|
3191
3247
|
}
|
|
3192
3248
|
if (obj instanceof Date) {
|
|
@@ -4825,6 +4881,7 @@ export {
|
|
|
4825
4881
|
AdBookingModel,
|
|
4826
4882
|
AdMetricsModel,
|
|
4827
4883
|
AdModel,
|
|
4884
|
+
AdPurchaseModel,
|
|
4828
4885
|
AffiliateModel,
|
|
4829
4886
|
AppSettingModel,
|
|
4830
4887
|
AuthHandoffTokenModel,
|
|
@@ -4911,7 +4968,7 @@ export {
|
|
|
4911
4968
|
locationGeoSchema,
|
|
4912
4969
|
locationsSchema,
|
|
4913
4970
|
mapVendorLicenceToSubscriptionRewardType,
|
|
4914
|
-
|
|
4971
|
+
mongoose36 as mongoose,
|
|
4915
4972
|
normalizeAffiliatePromoCodes,
|
|
4916
4973
|
normalizePromoCode,
|
|
4917
4974
|
notifyUsers,
|