@timardex/cluemart-server-shared 4.0.1 → 4.0.4
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-J7ZINA3I.mjs → chunk-AHC434D4.mjs} +351 -242
- package/dist/chunk-AHC434D4.mjs.map +1 -0
- package/dist/index.cjs +541 -432
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +93 -10
- package/dist/index.d.ts +93 -10
- package/dist/index.mjs +357 -248
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +411 -302
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +89 -7
- package/dist/mongoose/index.d.ts +89 -7
- package/dist/mongoose/index.mjs +9 -3
- package/dist/service/index.cjs +530 -428
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +4 -3
- package/dist/service/index.d.ts +4 -3
- package/dist/service/index.mjs +1 -1
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-J7ZINA3I.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -957,15 +957,15 @@ function syncSearchNameInUpdate(update) {
|
|
|
957
957
|
}
|
|
958
958
|
return null;
|
|
959
959
|
}
|
|
960
|
-
function searchNamePlugin(
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
960
|
+
function searchNamePlugin(schema29) {
|
|
961
|
+
schema29.add({ searchName: { default: "", required: false, type: String } });
|
|
962
|
+
schema29.index({ searchName: 1 });
|
|
963
|
+
schema29.pre("save", function syncSearchNameOnSave(next) {
|
|
964
964
|
const doc = this;
|
|
965
965
|
doc.searchName = deriveSearchName(doc.name);
|
|
966
966
|
next();
|
|
967
967
|
});
|
|
968
|
-
|
|
968
|
+
schema29.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
969
969
|
const list = Array.isArray(docs) ? docs : [docs];
|
|
970
970
|
for (const doc of list) {
|
|
971
971
|
if (doc && typeof doc.name === "string") {
|
|
@@ -974,7 +974,7 @@ function searchNamePlugin(schema27) {
|
|
|
974
974
|
}
|
|
975
975
|
next();
|
|
976
976
|
});
|
|
977
|
-
|
|
977
|
+
schema29.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
978
978
|
for (const op of ops) {
|
|
979
979
|
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
980
980
|
if (doc && typeof doc.name === "string") {
|
|
@@ -1000,7 +1000,7 @@ function searchNamePlugin(schema27) {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
next();
|
|
1002
1002
|
};
|
|
1003
|
-
|
|
1003
|
+
schema29.pre(
|
|
1004
1004
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
1005
1005
|
syncSearchNameOnUpdate
|
|
1006
1006
|
);
|
|
@@ -1089,6 +1089,7 @@ var GoogleImportedMarketModel = mongoose10.models.GoogleImportedMarket || mongoo
|
|
|
1089
1089
|
// src/mongoose/AiImportedMarket.ts
|
|
1090
1090
|
import {
|
|
1091
1091
|
EnumEventType as EnumEventType2,
|
|
1092
|
+
EnumImportedMarketDeactivationReason,
|
|
1092
1093
|
EnumImportedMarketReviewStatus
|
|
1093
1094
|
} from "@timardex/cluemart-shared";
|
|
1094
1095
|
import mongoose11 from "mongoose";
|
|
@@ -1119,8 +1120,15 @@ var schema8 = new MongooseSchema7(
|
|
|
1119
1120
|
type: ResourceImageTypeSchema
|
|
1120
1121
|
},
|
|
1121
1122
|
dateTime: [dateTimeSchema],
|
|
1123
|
+
deactivatedReason: {
|
|
1124
|
+
enum: Object.values(EnumImportedMarketDeactivationReason),
|
|
1125
|
+
required: false,
|
|
1126
|
+
type: String
|
|
1127
|
+
},
|
|
1122
1128
|
deletedAt: { default: null, required: false, type: Date },
|
|
1123
1129
|
description: { required: true, type: String },
|
|
1130
|
+
descriptionSourceHash: { required: false, type: String },
|
|
1131
|
+
duplicateHint: { required: false, type: String },
|
|
1124
1132
|
earliestStartDate: { default: null, required: false, type: Date },
|
|
1125
1133
|
eventId: {
|
|
1126
1134
|
ref: "Event",
|
|
@@ -1133,11 +1141,13 @@ var schema8 = new MongooseSchema7(
|
|
|
1133
1141
|
type: String
|
|
1134
1142
|
},
|
|
1135
1143
|
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
1144
|
+
lastSeenAt: { default: null, required: false, type: Date },
|
|
1136
1145
|
location: {
|
|
1137
1146
|
required: true,
|
|
1138
1147
|
type: locationsSchema
|
|
1139
1148
|
},
|
|
1140
1149
|
logo: { required: false, type: ResourceImageTypeSchema },
|
|
1150
|
+
missedRuns: { default: 0, required: true, type: Number },
|
|
1141
1151
|
name: { required: true, type: String },
|
|
1142
1152
|
openingHours: { required: false, type: [String] },
|
|
1143
1153
|
rainOrShine: { required: true, type: Boolean },
|
|
@@ -1167,6 +1177,7 @@ var schema8 = new MongooseSchema7(
|
|
|
1167
1177
|
},
|
|
1168
1178
|
sourceName: { required: true, type: String },
|
|
1169
1179
|
sourceUrl: { required: true, type: String },
|
|
1180
|
+
tags: { required: false, type: [String] },
|
|
1170
1181
|
website: { required: false, type: String }
|
|
1171
1182
|
},
|
|
1172
1183
|
{ timestamps: true }
|
|
@@ -1177,19 +1188,109 @@ schema8.index({ region: 1 });
|
|
|
1177
1188
|
schema8.index({ deletedAt: 1 });
|
|
1178
1189
|
schema8.index({ "dateTime.dateStatus": 1 });
|
|
1179
1190
|
schema8.index({ earliestStartDate: 1, _id: 1 });
|
|
1191
|
+
schema8.index({ reviewStatus: 1, active: 1, earliestStartDate: 1, _id: 1 });
|
|
1192
|
+
schema8.index({
|
|
1193
|
+
region: 1,
|
|
1194
|
+
reviewStatus: 1,
|
|
1195
|
+
active: 1,
|
|
1196
|
+
earliestStartDate: 1,
|
|
1197
|
+
_id: 1
|
|
1198
|
+
});
|
|
1199
|
+
schema8.index({ region: 1, searchName: 1 });
|
|
1180
1200
|
schema8.index({ slug: 1 });
|
|
1181
1201
|
schema8.index({ reviewStatus: 1 });
|
|
1182
1202
|
schema8.index({ description: "text", name: "text" });
|
|
1183
1203
|
schema8.plugin(searchNamePlugin);
|
|
1184
1204
|
var AiImportedMarketModel = mongoose11.models.AiImportedMarket || mongoose11.model("AiImportedMarket", schema8);
|
|
1185
1205
|
|
|
1186
|
-
// src/mongoose/
|
|
1206
|
+
// src/mongoose/AiImportRun.ts
|
|
1207
|
+
import {
|
|
1208
|
+
EnumAiImportRunStatus
|
|
1209
|
+
} from "@timardex/cluemart-shared";
|
|
1187
1210
|
import mongoose12 from "mongoose";
|
|
1188
|
-
var SCRAPE_SITES_CONFIG_KEY = "scrapeSites";
|
|
1189
1211
|
var MongooseSchema8 = mongoose12.Schema;
|
|
1190
|
-
var
|
|
1212
|
+
var usageSchema = new MongooseSchema8(
|
|
1213
|
+
{
|
|
1214
|
+
completionTokens: { default: 0, required: true, type: Number },
|
|
1215
|
+
promptTokens: { default: 0, required: true, type: Number },
|
|
1216
|
+
totalTokens: { default: 0, required: true, type: Number }
|
|
1217
|
+
},
|
|
1218
|
+
{ _id: false }
|
|
1219
|
+
);
|
|
1220
|
+
var siteResultSchema = new MongooseSchema8(
|
|
1221
|
+
{
|
|
1222
|
+
error: { required: false, type: String },
|
|
1223
|
+
errors: { default: 0, required: true, type: Number },
|
|
1224
|
+
found: { default: 0, required: true, type: Number },
|
|
1225
|
+
imported: { default: 0, required: true, type: Number },
|
|
1226
|
+
name: { required: true, type: String },
|
|
1227
|
+
skipped: { default: 0, required: true, type: Number },
|
|
1228
|
+
status: {
|
|
1229
|
+
enum: [EnumAiImportRunStatus.SUCCESS, EnumAiImportRunStatus.ERROR],
|
|
1230
|
+
required: true,
|
|
1231
|
+
type: String
|
|
1232
|
+
},
|
|
1233
|
+
url: { required: true, type: String },
|
|
1234
|
+
usage: { required: true, type: usageSchema }
|
|
1235
|
+
},
|
|
1236
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1237
|
+
);
|
|
1238
|
+
var resultSchema = new MongooseSchema8(
|
|
1239
|
+
{
|
|
1240
|
+
errors: { default: 0, required: true, type: Number },
|
|
1241
|
+
totalFound: { default: 0, required: true, type: Number },
|
|
1242
|
+
totalImported: { default: 0, required: true, type: Number },
|
|
1243
|
+
totalSkipped: { default: 0, required: true, type: Number }
|
|
1244
|
+
},
|
|
1245
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1246
|
+
);
|
|
1247
|
+
var schema9 = new MongooseSchema8(
|
|
1248
|
+
{
|
|
1249
|
+
error: { required: false, type: String },
|
|
1250
|
+
finishedAt: { required: false, type: Date },
|
|
1251
|
+
result: { required: false, type: resultSchema },
|
|
1252
|
+
siteResults: { default: [], required: true, type: [siteResultSchema] },
|
|
1253
|
+
startedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
|
|
1254
|
+
status: {
|
|
1255
|
+
default: EnumAiImportRunStatus.PENDING,
|
|
1256
|
+
enum: Object.values(EnumAiImportRunStatus),
|
|
1257
|
+
required: true,
|
|
1258
|
+
type: String
|
|
1259
|
+
},
|
|
1260
|
+
triggeredByUserId: {
|
|
1261
|
+
ref: "User",
|
|
1262
|
+
required: false,
|
|
1263
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1264
|
+
},
|
|
1265
|
+
usage: { required: false, type: usageSchema }
|
|
1266
|
+
},
|
|
1267
|
+
{ timestamps: true }
|
|
1268
|
+
);
|
|
1269
|
+
schema9.index({ createdAt: -1 });
|
|
1270
|
+
var AiImportRunModel = mongoose12.models.AiImportRun || mongoose12.model("AiImportRun", schema9);
|
|
1271
|
+
|
|
1272
|
+
// src/mongoose/AiImportRunLock.ts
|
|
1273
|
+
import mongoose13 from "mongoose";
|
|
1274
|
+
var AI_IMPORT_RUN_LOCK_KEY = "ai-import-run";
|
|
1275
|
+
var MongooseSchema9 = mongoose13.Schema;
|
|
1276
|
+
var schema10 = new MongooseSchema9(
|
|
1277
|
+
{
|
|
1278
|
+
_id: { required: true, type: String },
|
|
1279
|
+
lockedAt: { required: false, type: Date },
|
|
1280
|
+
token: { required: false, type: String }
|
|
1281
|
+
},
|
|
1282
|
+
{ timestamps: true }
|
|
1283
|
+
);
|
|
1284
|
+
var AiImportRunLockModel = mongoose13.models.AiImportRunLock || mongoose13.model("AiImportRunLock", schema10);
|
|
1285
|
+
|
|
1286
|
+
// src/mongoose/ScrapeSite.ts
|
|
1287
|
+
import mongoose14 from "mongoose";
|
|
1288
|
+
var SCRAPE_SITES_CONFIG_ID = "scrapeSites";
|
|
1289
|
+
var MongooseSchema10 = mongoose14.Schema;
|
|
1290
|
+
var scrapeSiteItemSchema = new MongooseSchema10(
|
|
1191
1291
|
{
|
|
1192
1292
|
enabled: { default: true, required: true, type: Boolean },
|
|
1293
|
+
lastCount: { required: false, type: Number },
|
|
1193
1294
|
lastError: { required: false, type: String },
|
|
1194
1295
|
lastScrapedAt: { required: false, type: Date },
|
|
1195
1296
|
lastScrapeStatus: { required: false, type: String },
|
|
@@ -1199,27 +1300,32 @@ var scrapeSiteItemSchema = new MongooseSchema8(
|
|
|
1199
1300
|
},
|
|
1200
1301
|
{ timestamps: true }
|
|
1201
1302
|
);
|
|
1202
|
-
var configSchema = new
|
|
1303
|
+
var configSchema = new MongooseSchema10(
|
|
1203
1304
|
{
|
|
1204
|
-
|
|
1305
|
+
_id: { required: true, type: String },
|
|
1205
1306
|
sites: {
|
|
1206
1307
|
default: [],
|
|
1207
1308
|
required: true,
|
|
1208
1309
|
type: [scrapeSiteItemSchema]
|
|
1310
|
+
},
|
|
1311
|
+
updatedByUserId: {
|
|
1312
|
+
ref: "User",
|
|
1313
|
+
required: false,
|
|
1314
|
+
type: mongoose14.Schema.Types.ObjectId
|
|
1209
1315
|
}
|
|
1210
1316
|
},
|
|
1211
1317
|
{ timestamps: true }
|
|
1212
1318
|
);
|
|
1213
|
-
var ScrapeSiteConfigModel =
|
|
1319
|
+
var ScrapeSiteConfigModel = mongoose14.models.ScrapeSiteConfig || mongoose14.model("ScrapeSiteConfig", configSchema);
|
|
1214
1320
|
|
|
1215
1321
|
// src/mongoose/Notification.ts
|
|
1216
1322
|
import {
|
|
1217
1323
|
EnumNotificationResourceType,
|
|
1218
1324
|
EnumNotificationType
|
|
1219
1325
|
} from "@timardex/cluemart-shared";
|
|
1220
|
-
import
|
|
1221
|
-
var
|
|
1222
|
-
var notificationDataSchema = new
|
|
1326
|
+
import mongoose15 from "mongoose";
|
|
1327
|
+
var MongooseSchema11 = mongoose15.Schema;
|
|
1328
|
+
var notificationDataSchema = new MongooseSchema11(
|
|
1223
1329
|
{
|
|
1224
1330
|
resourceId: { required: true, type: String },
|
|
1225
1331
|
resourceName: { required: true, type: String },
|
|
@@ -1231,7 +1337,7 @@ var notificationDataSchema = new MongooseSchema9(
|
|
|
1231
1337
|
},
|
|
1232
1338
|
{ _id: false }
|
|
1233
1339
|
);
|
|
1234
|
-
var
|
|
1340
|
+
var schema11 = new MongooseSchema11(
|
|
1235
1341
|
{
|
|
1236
1342
|
data: {
|
|
1237
1343
|
default: null,
|
|
@@ -1250,20 +1356,20 @@ var schema9 = new MongooseSchema9(
|
|
|
1250
1356
|
userId: {
|
|
1251
1357
|
ref: "User",
|
|
1252
1358
|
required: true,
|
|
1253
|
-
type:
|
|
1359
|
+
type: mongoose15.Schema.Types.ObjectId
|
|
1254
1360
|
}
|
|
1255
1361
|
},
|
|
1256
1362
|
{ timestamps: true }
|
|
1257
1363
|
);
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
var NotificationModel =
|
|
1364
|
+
schema11.index({ isRead: 1, userId: 1 });
|
|
1365
|
+
schema11.index({ createdAt: -1, userId: 1 });
|
|
1366
|
+
var NotificationModel = mongoose15.models.Notification || mongoose15.model("Notification", schema11);
|
|
1261
1367
|
|
|
1262
1368
|
// src/mongoose/PushToken.ts
|
|
1263
1369
|
import { EnumOSPlatform } from "@timardex/cluemart-shared/enums";
|
|
1264
|
-
import
|
|
1265
|
-
var
|
|
1266
|
-
var
|
|
1370
|
+
import mongoose16 from "mongoose";
|
|
1371
|
+
var MongooseSchema12 = mongoose16.Schema;
|
|
1372
|
+
var schema12 = new MongooseSchema12(
|
|
1267
1373
|
{
|
|
1268
1374
|
platform: {
|
|
1269
1375
|
enum: Object.values(EnumOSPlatform),
|
|
@@ -1274,12 +1380,12 @@ var schema10 = new MongooseSchema10(
|
|
|
1274
1380
|
userId: {
|
|
1275
1381
|
ref: "User",
|
|
1276
1382
|
required: true,
|
|
1277
|
-
type:
|
|
1383
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1278
1384
|
}
|
|
1279
1385
|
},
|
|
1280
1386
|
{ timestamps: true }
|
|
1281
1387
|
);
|
|
1282
|
-
var PushTokenModel =
|
|
1388
|
+
var PushTokenModel = mongoose16.models.PushToken || mongoose16.model("PushToken", schema12);
|
|
1283
1389
|
|
|
1284
1390
|
// src/mongoose/Relation.ts
|
|
1285
1391
|
import {
|
|
@@ -1288,16 +1394,16 @@ import {
|
|
|
1288
1394
|
EnumRelationResource,
|
|
1289
1395
|
EnumResourceType as EnumResourceType2
|
|
1290
1396
|
} from "@timardex/cluemart-shared";
|
|
1291
|
-
import
|
|
1397
|
+
import mongoose18 from "mongoose";
|
|
1292
1398
|
|
|
1293
1399
|
// src/mongoose/event/EventInfo.ts
|
|
1294
1400
|
import {
|
|
1295
1401
|
EnumEventDateStatus as EnumEventDateStatus2,
|
|
1296
1402
|
EnumPaymentMethod
|
|
1297
1403
|
} from "@timardex/cluemart-shared";
|
|
1298
|
-
import
|
|
1299
|
-
var
|
|
1300
|
-
var StallTypeSchema = new
|
|
1404
|
+
import mongoose17 from "mongoose";
|
|
1405
|
+
var MongooseSchema13 = mongoose17.Schema;
|
|
1406
|
+
var StallTypeSchema = new MongooseSchema13(
|
|
1301
1407
|
{
|
|
1302
1408
|
label: { required: false, type: String },
|
|
1303
1409
|
price: { required: false, type: Number },
|
|
@@ -1308,7 +1414,7 @@ var StallTypeSchema = new MongooseSchema11(
|
|
|
1308
1414
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1309
1415
|
}
|
|
1310
1416
|
);
|
|
1311
|
-
var dateTimeSchema2 = new
|
|
1417
|
+
var dateTimeSchema2 = new MongooseSchema13(
|
|
1312
1418
|
{
|
|
1313
1419
|
dateStatus: {
|
|
1314
1420
|
enum: Object.values(EnumEventDateStatus2),
|
|
@@ -1324,7 +1430,7 @@ var dateTimeSchema2 = new MongooseSchema11(
|
|
|
1324
1430
|
{ _id: false }
|
|
1325
1431
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1326
1432
|
);
|
|
1327
|
-
var paymentInfoSchema = new
|
|
1433
|
+
var paymentInfoSchema = new MongooseSchema13(
|
|
1328
1434
|
{
|
|
1329
1435
|
accountHolderName: { required: false, type: String },
|
|
1330
1436
|
accountNumber: { required: false, type: String },
|
|
@@ -1338,7 +1444,7 @@ var paymentInfoSchema = new MongooseSchema11(
|
|
|
1338
1444
|
{ _id: false }
|
|
1339
1445
|
// Prevents Mongoose from creating an additional _id field
|
|
1340
1446
|
);
|
|
1341
|
-
var requirementsSchema = new
|
|
1447
|
+
var requirementsSchema = new MongooseSchema13(
|
|
1342
1448
|
{
|
|
1343
1449
|
category: { required: true, type: String },
|
|
1344
1450
|
label: { required: true, type: String },
|
|
@@ -1349,7 +1455,7 @@ var requirementsSchema = new MongooseSchema11(
|
|
|
1349
1455
|
// Prevents Mongoose from creating an additional _id field for
|
|
1350
1456
|
}
|
|
1351
1457
|
);
|
|
1352
|
-
var refundPolicySchema = new
|
|
1458
|
+
var refundPolicySchema = new MongooseSchema13(
|
|
1353
1459
|
{
|
|
1354
1460
|
category: { required: true, type: String },
|
|
1355
1461
|
label: { required: true, type: String },
|
|
@@ -1357,7 +1463,7 @@ var refundPolicySchema = new MongooseSchema11(
|
|
|
1357
1463
|
},
|
|
1358
1464
|
{ _id: false }
|
|
1359
1465
|
);
|
|
1360
|
-
var
|
|
1466
|
+
var schema13 = new MongooseSchema13(
|
|
1361
1467
|
{
|
|
1362
1468
|
active: { default: true, type: Boolean },
|
|
1363
1469
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -1365,7 +1471,7 @@ var schema11 = new MongooseSchema11(
|
|
|
1365
1471
|
eventId: {
|
|
1366
1472
|
ref: "Event",
|
|
1367
1473
|
required: true,
|
|
1368
|
-
type:
|
|
1474
|
+
type: mongoose17.Schema.Types.ObjectId
|
|
1369
1475
|
},
|
|
1370
1476
|
packInTime: { required: true, type: Number },
|
|
1371
1477
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -1375,12 +1481,12 @@ var schema11 = new MongooseSchema11(
|
|
|
1375
1481
|
},
|
|
1376
1482
|
{ timestamps: true }
|
|
1377
1483
|
);
|
|
1378
|
-
|
|
1379
|
-
var EventInfoModel =
|
|
1484
|
+
schema13.index({ eventId: 1 });
|
|
1485
|
+
var EventInfoModel = mongoose17.models.EventInfo || mongoose17.model("EventInfo", schema13);
|
|
1380
1486
|
|
|
1381
1487
|
// src/mongoose/Relation.ts
|
|
1382
|
-
var
|
|
1383
|
-
var relationDateTimeSchema = new
|
|
1488
|
+
var MongooseSchema14 = mongoose18.Schema;
|
|
1489
|
+
var relationDateTimeSchema = new MongooseSchema14(
|
|
1384
1490
|
{
|
|
1385
1491
|
dateStatus: {
|
|
1386
1492
|
enum: Object.values(EnumEventDateStatus3),
|
|
@@ -1395,7 +1501,7 @@ var relationDateTimeSchema = new MongooseSchema12(
|
|
|
1395
1501
|
},
|
|
1396
1502
|
{ _id: false }
|
|
1397
1503
|
);
|
|
1398
|
-
var relationDatesSchema = new
|
|
1504
|
+
var relationDatesSchema = new MongooseSchema14(
|
|
1399
1505
|
{
|
|
1400
1506
|
dateTime: {
|
|
1401
1507
|
required: true,
|
|
@@ -1414,19 +1520,19 @@ var relationDatesSchema = new MongooseSchema12(
|
|
|
1414
1520
|
},
|
|
1415
1521
|
{ _id: false }
|
|
1416
1522
|
);
|
|
1417
|
-
var RelationTypeSchema = new
|
|
1523
|
+
var RelationTypeSchema = new MongooseSchema14(
|
|
1418
1524
|
{
|
|
1419
1525
|
active: { default: true, required: true, type: Boolean },
|
|
1420
1526
|
chatId: {
|
|
1421
1527
|
ref: "Chat",
|
|
1422
1528
|
required: true,
|
|
1423
|
-
type:
|
|
1529
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1424
1530
|
},
|
|
1425
1531
|
deletedAt: { default: null, required: false, type: Date },
|
|
1426
1532
|
eventId: {
|
|
1427
1533
|
ref: "Event",
|
|
1428
1534
|
required: true,
|
|
1429
|
-
type:
|
|
1535
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1430
1536
|
},
|
|
1431
1537
|
lastUpdateBy: {
|
|
1432
1538
|
enum: Object.values(EnumResourceType2),
|
|
@@ -1442,7 +1548,7 @@ var RelationTypeSchema = new MongooseSchema12(
|
|
|
1442
1548
|
vendorId: {
|
|
1443
1549
|
ref: "Vendor",
|
|
1444
1550
|
required: true,
|
|
1445
|
-
type:
|
|
1551
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1446
1552
|
}
|
|
1447
1553
|
},
|
|
1448
1554
|
{ timestamps: true }
|
|
@@ -1454,7 +1560,7 @@ RelationTypeSchema.index({
|
|
|
1454
1560
|
"relationDates.status": 1,
|
|
1455
1561
|
vendorId: 1
|
|
1456
1562
|
});
|
|
1457
|
-
var RelationModel =
|
|
1563
|
+
var RelationModel = mongoose18.models.Relation || mongoose18.model("Relation", RelationTypeSchema);
|
|
1458
1564
|
|
|
1459
1565
|
// src/mongoose/ResourceActivity.ts
|
|
1460
1566
|
import {
|
|
@@ -1463,9 +1569,9 @@ import {
|
|
|
1463
1569
|
EnumOSPlatform as EnumOSPlatform2,
|
|
1464
1570
|
EnumResourceType as EnumResourceType3
|
|
1465
1571
|
} from "@timardex/cluemart-shared";
|
|
1466
|
-
import
|
|
1467
|
-
var
|
|
1468
|
-
var ActivitySchema = new
|
|
1572
|
+
import mongoose19 from "mongoose";
|
|
1573
|
+
var MongooseSchema15 = mongoose19.Schema;
|
|
1574
|
+
var ActivitySchema = new MongooseSchema15(
|
|
1469
1575
|
{
|
|
1470
1576
|
activityType: {
|
|
1471
1577
|
enum: Object.values(EnumActivity),
|
|
@@ -1493,7 +1599,7 @@ var ActivitySchema = new MongooseSchema13(
|
|
|
1493
1599
|
},
|
|
1494
1600
|
{ _id: false }
|
|
1495
1601
|
);
|
|
1496
|
-
var
|
|
1602
|
+
var schema14 = new MongooseSchema15(
|
|
1497
1603
|
{
|
|
1498
1604
|
activity: { default: [], type: [ActivitySchema] },
|
|
1499
1605
|
resourceId: { required: true, type: String },
|
|
@@ -1505,9 +1611,9 @@ var schema12 = new MongooseSchema13(
|
|
|
1505
1611
|
},
|
|
1506
1612
|
{ timestamps: true }
|
|
1507
1613
|
);
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
var ResourceActivityModel =
|
|
1614
|
+
schema14.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
1615
|
+
schema14.index({ "views.location": "2dsphere" });
|
|
1616
|
+
var ResourceActivityModel = mongoose19.models.ResourceActivity || mongoose19.model("ResourceActivity", schema14);
|
|
1511
1617
|
|
|
1512
1618
|
// src/mongoose/User.ts
|
|
1513
1619
|
import {
|
|
@@ -1521,40 +1627,40 @@ import {
|
|
|
1521
1627
|
EnumUserLicence as EnumUserLicence3,
|
|
1522
1628
|
EnumUserRole
|
|
1523
1629
|
} from "@timardex/cluemart-shared";
|
|
1524
|
-
import
|
|
1525
|
-
var
|
|
1526
|
-
var userActivityEventSchema = new
|
|
1630
|
+
import mongoose20 from "mongoose";
|
|
1631
|
+
var MongooseSchema16 = mongoose20.Schema;
|
|
1632
|
+
var userActivityEventSchema = new MongooseSchema16(
|
|
1527
1633
|
{
|
|
1528
1634
|
dateTime: dateTimeSchema,
|
|
1529
1635
|
resourceId: {
|
|
1530
1636
|
ref: "Event",
|
|
1531
1637
|
required: false,
|
|
1532
|
-
type:
|
|
1638
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1533
1639
|
}
|
|
1534
1640
|
},
|
|
1535
1641
|
{ _id: false }
|
|
1536
1642
|
);
|
|
1537
|
-
var userActivityFavouritesSchema = new
|
|
1643
|
+
var userActivityFavouritesSchema = new MongooseSchema16(
|
|
1538
1644
|
{
|
|
1539
1645
|
events: {
|
|
1540
1646
|
ref: "Event",
|
|
1541
1647
|
required: false,
|
|
1542
|
-
type: [
|
|
1648
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1543
1649
|
},
|
|
1544
1650
|
partners: {
|
|
1545
1651
|
ref: "Partner",
|
|
1546
1652
|
required: false,
|
|
1547
|
-
type: [
|
|
1653
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1548
1654
|
},
|
|
1549
1655
|
vendors: {
|
|
1550
1656
|
ref: "Vendor",
|
|
1551
1657
|
required: false,
|
|
1552
|
-
type: [
|
|
1658
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1553
1659
|
}
|
|
1554
1660
|
},
|
|
1555
1661
|
{ _id: false }
|
|
1556
1662
|
);
|
|
1557
|
-
var stripeSchema = new
|
|
1663
|
+
var stripeSchema = new MongooseSchema16(
|
|
1558
1664
|
{
|
|
1559
1665
|
billingPeriod: {
|
|
1560
1666
|
enum: Object.values(EnumBillingPeriod2),
|
|
@@ -1636,7 +1742,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1636
1742
|
},
|
|
1637
1743
|
{ _id: false }
|
|
1638
1744
|
);
|
|
1639
|
-
var redeemedRewardSchema = new
|
|
1745
|
+
var redeemedRewardSchema = new MongooseSchema16(
|
|
1640
1746
|
{
|
|
1641
1747
|
name: {
|
|
1642
1748
|
enum: Object.values(EnumReward),
|
|
@@ -1648,7 +1754,7 @@ var redeemedRewardSchema = new MongooseSchema14(
|
|
|
1648
1754
|
},
|
|
1649
1755
|
{ _id: false }
|
|
1650
1756
|
);
|
|
1651
|
-
var userOverallPointsSchema = new
|
|
1757
|
+
var userOverallPointsSchema = new MongooseSchema16(
|
|
1652
1758
|
{
|
|
1653
1759
|
createdAt: { required: true, type: Date },
|
|
1654
1760
|
points: { default: 0, required: true, type: Number },
|
|
@@ -1661,13 +1767,13 @@ var userOverallPointsSchema = new MongooseSchema14(
|
|
|
1661
1767
|
},
|
|
1662
1768
|
{ _id: false }
|
|
1663
1769
|
);
|
|
1664
|
-
var
|
|
1770
|
+
var schema15 = new MongooseSchema16(
|
|
1665
1771
|
{
|
|
1666
1772
|
active: { default: false, required: true, type: Boolean },
|
|
1667
1773
|
affiliate: {
|
|
1668
1774
|
ref: "Affiliate",
|
|
1669
1775
|
required: false,
|
|
1670
|
-
type:
|
|
1776
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1671
1777
|
},
|
|
1672
1778
|
avatar: {
|
|
1673
1779
|
required: false,
|
|
@@ -1676,7 +1782,7 @@ var schema13 = new MongooseSchema14(
|
|
|
1676
1782
|
coupon: {
|
|
1677
1783
|
ref: "Coupon",
|
|
1678
1784
|
required: false,
|
|
1679
|
-
type:
|
|
1785
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1680
1786
|
},
|
|
1681
1787
|
deletedAt: { default: null, required: false, type: Date },
|
|
1682
1788
|
email: { required: true, type: String },
|
|
@@ -1688,13 +1794,13 @@ var schema13 = new MongooseSchema14(
|
|
|
1688
1794
|
events: {
|
|
1689
1795
|
ref: "Event",
|
|
1690
1796
|
required: false,
|
|
1691
|
-
type: [
|
|
1797
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1692
1798
|
},
|
|
1693
1799
|
firstName: { required: true, type: String },
|
|
1694
1800
|
game: {
|
|
1695
1801
|
ref: "Game",
|
|
1696
1802
|
required: false,
|
|
1697
|
-
type:
|
|
1803
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1698
1804
|
},
|
|
1699
1805
|
interests: {
|
|
1700
1806
|
enum: Object.values(EnumResourceType4),
|
|
@@ -1720,7 +1826,7 @@ var schema13 = new MongooseSchema14(
|
|
|
1720
1826
|
partner: {
|
|
1721
1827
|
ref: "Partner",
|
|
1722
1828
|
required: false,
|
|
1723
|
-
type:
|
|
1829
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1724
1830
|
},
|
|
1725
1831
|
password: { required: true, type: String },
|
|
1726
1832
|
platform: {
|
|
@@ -1761,7 +1867,7 @@ var schema13 = new MongooseSchema14(
|
|
|
1761
1867
|
school: {
|
|
1762
1868
|
ref: "School",
|
|
1763
1869
|
required: false,
|
|
1764
|
-
type:
|
|
1870
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1765
1871
|
},
|
|
1766
1872
|
stripe: {
|
|
1767
1873
|
required: false,
|
|
@@ -1786,21 +1892,21 @@ var schema13 = new MongooseSchema14(
|
|
|
1786
1892
|
vendor: {
|
|
1787
1893
|
ref: "Vendor",
|
|
1788
1894
|
required: false,
|
|
1789
|
-
type:
|
|
1895
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1790
1896
|
}
|
|
1791
1897
|
},
|
|
1792
1898
|
{ strict: false, timestamps: true }
|
|
1793
1899
|
);
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
var UserModel =
|
|
1900
|
+
schema15.index({ "licences.expiryDate": 1 });
|
|
1901
|
+
schema15.index({ "licences.licenceType": 1 });
|
|
1902
|
+
schema15.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
1903
|
+
schema15.index({ email: "text", firstName: "text", lastName: "text" });
|
|
1904
|
+
var UserModel = mongoose20.models.User || mongoose20.model("User", schema15);
|
|
1799
1905
|
|
|
1800
1906
|
// src/mongoose/VerificationToken.ts
|
|
1801
|
-
import
|
|
1802
|
-
var
|
|
1803
|
-
var
|
|
1907
|
+
import mongoose21 from "mongoose";
|
|
1908
|
+
var MongooseSchema17 = mongoose21.Schema;
|
|
1909
|
+
var schema16 = new MongooseSchema17(
|
|
1804
1910
|
{
|
|
1805
1911
|
createdAt: {
|
|
1806
1912
|
default: Date.now,
|
|
@@ -1815,16 +1921,16 @@ var schema14 = new MongooseSchema15(
|
|
|
1815
1921
|
},
|
|
1816
1922
|
{ timestamps: true }
|
|
1817
1923
|
);
|
|
1818
|
-
var VerificationTokenModel =
|
|
1924
|
+
var VerificationTokenModel = mongoose21.models.VerificationToken || mongoose21.model("VerificationToken", schema16);
|
|
1819
1925
|
|
|
1820
1926
|
// src/mongoose/vendor/Vendor.ts
|
|
1821
1927
|
import {
|
|
1822
1928
|
EnumEventDateStatus as EnumEventDateStatus5,
|
|
1823
1929
|
EnumVendorType
|
|
1824
1930
|
} from "@timardex/cluemart-shared";
|
|
1825
|
-
import
|
|
1826
|
-
var
|
|
1827
|
-
var vendorProductTypeSchema = new
|
|
1931
|
+
import mongoose22 from "mongoose";
|
|
1932
|
+
var MongooseSchema18 = mongoose22.Schema;
|
|
1933
|
+
var vendorProductTypeSchema = new MongooseSchema18(
|
|
1828
1934
|
{
|
|
1829
1935
|
description: { required: false, type: String },
|
|
1830
1936
|
name: { required: true, type: String },
|
|
@@ -1835,14 +1941,14 @@ var vendorProductTypeSchema = new MongooseSchema16(
|
|
|
1835
1941
|
},
|
|
1836
1942
|
{ timestamps: true }
|
|
1837
1943
|
);
|
|
1838
|
-
var productWrapperSchema = new
|
|
1944
|
+
var productWrapperSchema = new MongooseSchema18(
|
|
1839
1945
|
{
|
|
1840
1946
|
active: { default: false, required: false, type: Boolean },
|
|
1841
1947
|
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
1842
1948
|
},
|
|
1843
1949
|
{ _id: false }
|
|
1844
1950
|
);
|
|
1845
|
-
var calendarSchema = new
|
|
1951
|
+
var calendarSchema = new MongooseSchema18(
|
|
1846
1952
|
{
|
|
1847
1953
|
dateTime: {
|
|
1848
1954
|
dateStatus: {
|
|
@@ -1863,14 +1969,14 @@ var calendarSchema = new MongooseSchema16(
|
|
|
1863
1969
|
},
|
|
1864
1970
|
{ _id: false }
|
|
1865
1971
|
);
|
|
1866
|
-
var calendarWrapperSchema = new
|
|
1972
|
+
var calendarWrapperSchema = new MongooseSchema18(
|
|
1867
1973
|
{
|
|
1868
1974
|
active: { default: false, required: true, type: Boolean },
|
|
1869
1975
|
calendarData: { required: false, type: [calendarSchema] }
|
|
1870
1976
|
},
|
|
1871
1977
|
{ _id: false }
|
|
1872
1978
|
);
|
|
1873
|
-
var vendorAvailabilitySchema = new
|
|
1979
|
+
var vendorAvailabilitySchema = new MongooseSchema18(
|
|
1874
1980
|
{
|
|
1875
1981
|
corporate: { default: false, required: false, type: Boolean },
|
|
1876
1982
|
private: { default: false, required: false, type: Boolean },
|
|
@@ -1878,7 +1984,7 @@ var vendorAvailabilitySchema = new MongooseSchema16(
|
|
|
1878
1984
|
},
|
|
1879
1985
|
{ _id: false }
|
|
1880
1986
|
);
|
|
1881
|
-
var downgradeSnapshotSchema = new
|
|
1987
|
+
var downgradeSnapshotSchema = new MongooseSchema18(
|
|
1882
1988
|
{
|
|
1883
1989
|
availability: { required: false, type: vendorAvailabilitySchema },
|
|
1884
1990
|
calendarActive: { required: false, type: Boolean },
|
|
@@ -1886,7 +1992,7 @@ var downgradeSnapshotSchema = new MongooseSchema16(
|
|
|
1886
1992
|
},
|
|
1887
1993
|
{ _id: false }
|
|
1888
1994
|
);
|
|
1889
|
-
var
|
|
1995
|
+
var schema17 = new MongooseSchema18(
|
|
1890
1996
|
{
|
|
1891
1997
|
...baseResourceFields,
|
|
1892
1998
|
// Importing base resource fields from global.ts
|
|
@@ -1905,12 +2011,12 @@ var schema15 = new MongooseSchema16(
|
|
|
1905
2011
|
unregisteredVendorId: {
|
|
1906
2012
|
ref: "UnregisteredVendor",
|
|
1907
2013
|
required: false,
|
|
1908
|
-
type:
|
|
2014
|
+
type: mongoose22.Schema.Types.ObjectId
|
|
1909
2015
|
},
|
|
1910
2016
|
vendorInfoId: {
|
|
1911
2017
|
ref: "VendorInfo",
|
|
1912
2018
|
required: false,
|
|
1913
|
-
type:
|
|
2019
|
+
type: mongoose22.Schema.Types.ObjectId
|
|
1914
2020
|
},
|
|
1915
2021
|
vendorType: {
|
|
1916
2022
|
enum: Object.values(EnumVendorType),
|
|
@@ -1920,34 +2026,34 @@ var schema15 = new MongooseSchema16(
|
|
|
1920
2026
|
},
|
|
1921
2027
|
{ timestamps: true }
|
|
1922
2028
|
);
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
2029
|
+
schema17.index({ name: 1 });
|
|
2030
|
+
schema17.index({ description: 1 });
|
|
2031
|
+
schema17.index({ region: 1 });
|
|
2032
|
+
schema17.index({ "categories.name": 1 });
|
|
2033
|
+
schema17.index({ slug: 1 });
|
|
2034
|
+
schema17.index({
|
|
1929
2035
|
categoriesNames: "text",
|
|
1930
2036
|
description: "text",
|
|
1931
2037
|
name: "text"
|
|
1932
2038
|
});
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
var VendorModel =
|
|
2039
|
+
schema17.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2040
|
+
schema17.plugin(searchNamePlugin);
|
|
2041
|
+
var VendorModel = mongoose22.models.Vendor || mongoose22.model("Vendor", schema17);
|
|
1936
2042
|
|
|
1937
2043
|
// src/mongoose/vendor/VendorInfo.ts
|
|
1938
2044
|
import {
|
|
1939
2045
|
EnumFoodFlavor
|
|
1940
2046
|
} from "@timardex/cluemart-shared";
|
|
1941
|
-
import
|
|
1942
|
-
var
|
|
1943
|
-
var AttributesSchema = new
|
|
2047
|
+
import mongoose23 from "mongoose";
|
|
2048
|
+
var MongooseSchema19 = mongoose23.Schema;
|
|
2049
|
+
var AttributesSchema = new MongooseSchema19(
|
|
1944
2050
|
{
|
|
1945
2051
|
details: { required: false, type: String },
|
|
1946
2052
|
isRequired: { default: false, required: true, type: Boolean }
|
|
1947
2053
|
},
|
|
1948
2054
|
{ _id: false }
|
|
1949
2055
|
);
|
|
1950
|
-
var
|
|
2056
|
+
var schema18 = new MongooseSchema19(
|
|
1951
2057
|
{
|
|
1952
2058
|
active: { default: true, type: Boolean },
|
|
1953
2059
|
compliance: {
|
|
@@ -1982,29 +2088,29 @@ var schema16 = new MongooseSchema17(
|
|
|
1982
2088
|
vendorId: {
|
|
1983
2089
|
ref: "Vendor",
|
|
1984
2090
|
required: true,
|
|
1985
|
-
type:
|
|
2091
|
+
type: mongoose23.Schema.Types.ObjectId
|
|
1986
2092
|
}
|
|
1987
2093
|
},
|
|
1988
2094
|
{ timestamps: true }
|
|
1989
2095
|
);
|
|
1990
|
-
|
|
1991
|
-
var VendorInfoModel =
|
|
2096
|
+
schema18.index({ vendorId: 1 });
|
|
2097
|
+
var VendorInfoModel = mongoose23.models.VendorInfo || mongoose23.model("VendorInfo", schema18);
|
|
1992
2098
|
|
|
1993
2099
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
1994
|
-
import
|
|
1995
|
-
var
|
|
1996
|
-
var invitationSchema = new
|
|
2100
|
+
import mongoose24 from "mongoose";
|
|
2101
|
+
var MongooseSchema20 = mongoose24.Schema;
|
|
2102
|
+
var invitationSchema = new MongooseSchema20(
|
|
1997
2103
|
{
|
|
1998
2104
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
1999
2105
|
inviterId: {
|
|
2000
2106
|
ref: "Event",
|
|
2001
2107
|
required: true,
|
|
2002
|
-
type:
|
|
2108
|
+
type: mongoose24.Schema.Types.ObjectId
|
|
2003
2109
|
}
|
|
2004
2110
|
},
|
|
2005
2111
|
{ _id: false }
|
|
2006
2112
|
);
|
|
2007
|
-
var
|
|
2113
|
+
var schema19 = new MongooseSchema20(
|
|
2008
2114
|
{
|
|
2009
2115
|
active: { default: true, required: true, type: Boolean },
|
|
2010
2116
|
categoryIds: { required: true, type: [String] },
|
|
@@ -2013,7 +2119,7 @@ var schema17 = new MongooseSchema18(
|
|
|
2013
2119
|
claimedByUserId: {
|
|
2014
2120
|
ref: "User",
|
|
2015
2121
|
required: false,
|
|
2016
|
-
type:
|
|
2122
|
+
type: mongoose24.Schema.Types.ObjectId
|
|
2017
2123
|
},
|
|
2018
2124
|
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
2019
2125
|
claimToken: { default: null, required: false, type: String },
|
|
@@ -2026,15 +2132,15 @@ var schema17 = new MongooseSchema18(
|
|
|
2026
2132
|
},
|
|
2027
2133
|
{ timestamps: true }
|
|
2028
2134
|
);
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
var UnregisteredVendorModel =
|
|
2135
|
+
schema19.index({ name: 1 });
|
|
2136
|
+
schema19.index({ email: 1 });
|
|
2137
|
+
var UnregisteredVendorModel = mongoose24.models.UnregisteredVendor || mongoose24.model("UnregisteredVendor", schema19);
|
|
2032
2138
|
|
|
2033
2139
|
// src/mongoose/event/Event.ts
|
|
2034
2140
|
import { EnumEventType as EnumEventType3 } from "@timardex/cluemart-shared";
|
|
2035
|
-
import
|
|
2036
|
-
var
|
|
2037
|
-
var
|
|
2141
|
+
import mongoose25 from "mongoose";
|
|
2142
|
+
var MongooseSchema21 = mongoose25.Schema;
|
|
2143
|
+
var schema20 = new MongooseSchema21(
|
|
2038
2144
|
{
|
|
2039
2145
|
...baseResourceFields,
|
|
2040
2146
|
// Importing base resource fields from global.ts
|
|
@@ -2043,7 +2149,7 @@ var schema18 = new MongooseSchema19(
|
|
|
2043
2149
|
eventInfoId: {
|
|
2044
2150
|
ref: "EventInfo",
|
|
2045
2151
|
required: false,
|
|
2046
|
-
type:
|
|
2152
|
+
type: mongoose25.Schema.Types.ObjectId
|
|
2047
2153
|
},
|
|
2048
2154
|
eventType: {
|
|
2049
2155
|
enum: Object.values(EnumEventType3),
|
|
@@ -2067,40 +2173,40 @@ var schema18 = new MongooseSchema19(
|
|
|
2067
2173
|
},
|
|
2068
2174
|
{ timestamps: true }
|
|
2069
2175
|
);
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
var EventModel =
|
|
2176
|
+
schema20.index({ name: 1 });
|
|
2177
|
+
schema20.index({ description: 1 });
|
|
2178
|
+
schema20.index({ region: 1 });
|
|
2179
|
+
schema20.index({ "location.geo": "2dsphere" });
|
|
2180
|
+
schema20.index({ tags: 1 });
|
|
2181
|
+
schema20.index({ deletedAt: 1 });
|
|
2182
|
+
schema20.index({ "dateTime.dateStatus": 1 });
|
|
2183
|
+
schema20.index({ slug: 1 });
|
|
2184
|
+
schema20.index({ description: "text", name: "text", tags: "text" });
|
|
2185
|
+
schema20.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2186
|
+
schema20.plugin(searchNamePlugin);
|
|
2187
|
+
var EventModel = mongoose25.models.Event || mongoose25.model("Event", schema20);
|
|
2082
2188
|
|
|
2083
2189
|
// src/mongoose/event/EventDateArchive.ts
|
|
2084
|
-
import
|
|
2085
|
-
var
|
|
2190
|
+
import mongoose26 from "mongoose";
|
|
2191
|
+
var schema21 = new mongoose26.Schema(
|
|
2086
2192
|
{
|
|
2087
2193
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
2088
2194
|
eventId: {
|
|
2089
2195
|
ref: "Event",
|
|
2090
2196
|
required: true,
|
|
2091
|
-
type:
|
|
2197
|
+
type: mongoose26.Schema.Types.ObjectId
|
|
2092
2198
|
}
|
|
2093
2199
|
},
|
|
2094
2200
|
{ timestamps: true }
|
|
2095
2201
|
);
|
|
2096
|
-
|
|
2097
|
-
var EventDateArchiveModel =
|
|
2202
|
+
schema21.index({ eventId: 1 }, { unique: true });
|
|
2203
|
+
var EventDateArchiveModel = mongoose26.models.EventDateArchive || mongoose26.model("EventDateArchive", schema21);
|
|
2098
2204
|
|
|
2099
2205
|
// src/mongoose/Partner.ts
|
|
2100
2206
|
import { EnumPartnerType } from "@timardex/cluemart-shared";
|
|
2101
|
-
import
|
|
2102
|
-
var
|
|
2103
|
-
var
|
|
2207
|
+
import mongoose27 from "mongoose";
|
|
2208
|
+
var MongooseSchema22 = mongoose27.Schema;
|
|
2209
|
+
var schema22 = new MongooseSchema22(
|
|
2104
2210
|
{
|
|
2105
2211
|
...baseResourceFields,
|
|
2106
2212
|
location: {
|
|
@@ -2116,15 +2222,15 @@ var schema20 = new MongooseSchema20(
|
|
|
2116
2222
|
},
|
|
2117
2223
|
{ timestamps: true }
|
|
2118
2224
|
);
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
var PartnerModel =
|
|
2225
|
+
schema22.index({ name: 1 });
|
|
2226
|
+
schema22.index({ description: 1 });
|
|
2227
|
+
schema22.index({ region: 1 });
|
|
2228
|
+
schema22.index({ "location.geo": "2dsphere" });
|
|
2229
|
+
schema22.index({ slug: 1 });
|
|
2230
|
+
schema22.index({ name: "text", description: "text" });
|
|
2231
|
+
schema22.index({ "owner.userId": 1, deletedAt: 1 });
|
|
2232
|
+
schema22.plugin(searchNamePlugin);
|
|
2233
|
+
var PartnerModel = mongoose27.models.Partner || mongoose27.model("Partner", schema22);
|
|
2128
2234
|
|
|
2129
2235
|
// src/mongoose/Post.ts
|
|
2130
2236
|
import {
|
|
@@ -2132,9 +2238,9 @@ import {
|
|
|
2132
2238
|
EnumPostType as EnumPostType2,
|
|
2133
2239
|
EnumResourceType as EnumResourceType5
|
|
2134
2240
|
} from "@timardex/cluemart-shared";
|
|
2135
|
-
import
|
|
2136
|
-
var
|
|
2137
|
-
var contentSchema = new
|
|
2241
|
+
import mongoose28, { Schema } from "mongoose";
|
|
2242
|
+
var MongooseSchema23 = mongoose28.Schema;
|
|
2243
|
+
var contentSchema = new MongooseSchema23(
|
|
2138
2244
|
{
|
|
2139
2245
|
contentData: Schema.Types.Mixed,
|
|
2140
2246
|
contentOrder: { required: true, type: Number },
|
|
@@ -2146,7 +2252,7 @@ var contentSchema = new MongooseSchema21(
|
|
|
2146
2252
|
},
|
|
2147
2253
|
{ _id: false }
|
|
2148
2254
|
);
|
|
2149
|
-
var resourceSchema = new
|
|
2255
|
+
var resourceSchema = new MongooseSchema23(
|
|
2150
2256
|
{
|
|
2151
2257
|
resourceId: { required: true, type: String },
|
|
2152
2258
|
resourceRegion: { required: true, type: String },
|
|
@@ -2159,7 +2265,7 @@ var resourceSchema = new MongooseSchema21(
|
|
|
2159
2265
|
},
|
|
2160
2266
|
{ _id: false }
|
|
2161
2267
|
);
|
|
2162
|
-
var
|
|
2268
|
+
var schema23 = new MongooseSchema23(
|
|
2163
2269
|
{
|
|
2164
2270
|
active: { default: false, required: true, type: Boolean },
|
|
2165
2271
|
approvedAt: { default: null, required: false, type: Date },
|
|
@@ -2190,16 +2296,16 @@ var schema21 = new MongooseSchema21(
|
|
|
2190
2296
|
},
|
|
2191
2297
|
{ timestamps: true }
|
|
2192
2298
|
);
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
var PostModel =
|
|
2299
|
+
schema23.index({ title: 1 });
|
|
2300
|
+
schema23.index({ tags: 1 });
|
|
2301
|
+
schema23.index({ postType: 1, slug: 1 }, { unique: true });
|
|
2302
|
+
var PostModel = mongoose28.models.Post || mongoose28.model("Post", schema23);
|
|
2197
2303
|
|
|
2198
2304
|
// src/mongoose/AppSetting.ts
|
|
2199
|
-
import
|
|
2200
|
-
var
|
|
2305
|
+
import mongoose29 from "mongoose";
|
|
2306
|
+
var MongooseSchema24 = mongoose29.Schema;
|
|
2201
2307
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
2202
|
-
var AppSettingSchema = new
|
|
2308
|
+
var AppSettingSchema = new MongooseSchema24(
|
|
2203
2309
|
{
|
|
2204
2310
|
activeSchoolsStudentCountTotal: {
|
|
2205
2311
|
default: 0,
|
|
@@ -2221,8 +2327,8 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2221
2327
|
validate: Number.isInteger
|
|
2222
2328
|
},
|
|
2223
2329
|
mobileDisplayEnabled: { default: false, required: true, type: Boolean },
|
|
2224
|
-
purchasePricing: { type:
|
|
2225
|
-
regionPricing: { type:
|
|
2330
|
+
purchasePricing: { type: MongooseSchema24.Types.Mixed },
|
|
2331
|
+
regionPricing: { type: MongooseSchema24.Types.Mixed },
|
|
2226
2332
|
paidSlotsPerPlacement: { enum: [30], type: Number },
|
|
2227
2333
|
reservedSlotsPerPlacement: { enum: [7], type: Number },
|
|
2228
2334
|
rotationSeconds: { enum: [8], type: Number },
|
|
@@ -2247,12 +2353,12 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2247
2353
|
},
|
|
2248
2354
|
{ timestamps: true }
|
|
2249
2355
|
);
|
|
2250
|
-
var AppSettingModel =
|
|
2356
|
+
var AppSettingModel = mongoose29.models.AppSetting || mongoose29.model("AppSetting", AppSettingSchema);
|
|
2251
2357
|
|
|
2252
2358
|
// src/mongoose/AuthHandoffToken.ts
|
|
2253
|
-
import
|
|
2254
|
-
var
|
|
2255
|
-
var
|
|
2359
|
+
import mongoose30 from "mongoose";
|
|
2360
|
+
var MongooseSchema25 = mongoose30.Schema;
|
|
2361
|
+
var schema24 = new MongooseSchema25(
|
|
2256
2362
|
{
|
|
2257
2363
|
expiresAt: { required: true, type: Date },
|
|
2258
2364
|
jti: { index: true, required: true, type: String, unique: true },
|
|
@@ -2261,28 +2367,28 @@ var schema22 = new MongooseSchema23(
|
|
|
2261
2367
|
index: true,
|
|
2262
2368
|
ref: "User",
|
|
2263
2369
|
required: true,
|
|
2264
|
-
type:
|
|
2370
|
+
type: mongoose30.Schema.Types.ObjectId
|
|
2265
2371
|
}
|
|
2266
2372
|
},
|
|
2267
2373
|
{ timestamps: true }
|
|
2268
2374
|
);
|
|
2269
|
-
|
|
2270
|
-
var AuthHandoffTokenModel =
|
|
2375
|
+
schema24.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2376
|
+
var AuthHandoffTokenModel = mongoose30.models.AuthHandoffToken || mongoose30.model("AuthHandoffToken", schema24);
|
|
2271
2377
|
|
|
2272
2378
|
// src/mongoose/game/Game.ts
|
|
2273
2379
|
import {
|
|
2274
2380
|
EnumGameStatus,
|
|
2275
2381
|
EnumGameType
|
|
2276
2382
|
} from "@timardex/cluemart-shared";
|
|
2277
|
-
import
|
|
2383
|
+
import mongoose34 from "mongoose";
|
|
2278
2384
|
|
|
2279
2385
|
// src/mongoose/game/DailyClue.ts
|
|
2280
|
-
import
|
|
2386
|
+
import mongoose32 from "mongoose";
|
|
2281
2387
|
|
|
2282
2388
|
// src/mongoose/game/utils.ts
|
|
2283
|
-
import
|
|
2284
|
-
var
|
|
2285
|
-
var schemaGameDate = new
|
|
2389
|
+
import mongoose31 from "mongoose";
|
|
2390
|
+
var MongooseSchema26 = mongoose31.Schema;
|
|
2391
|
+
var schemaGameDate = new MongooseSchema26(
|
|
2286
2392
|
{
|
|
2287
2393
|
endDate: { required: true, type: Date },
|
|
2288
2394
|
startDate: { required: true, type: Date }
|
|
@@ -2291,8 +2397,8 @@ var schemaGameDate = new MongooseSchema24(
|
|
|
2291
2397
|
);
|
|
2292
2398
|
|
|
2293
2399
|
// src/mongoose/game/DailyClue.ts
|
|
2294
|
-
var
|
|
2295
|
-
var schemaLetters = new
|
|
2400
|
+
var MongooseSchema27 = mongoose32.Schema;
|
|
2401
|
+
var schemaLetters = new MongooseSchema27(
|
|
2296
2402
|
{
|
|
2297
2403
|
collected: { required: false, type: [String] },
|
|
2298
2404
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -2300,14 +2406,14 @@ var schemaLetters = new MongooseSchema25(
|
|
|
2300
2406
|
},
|
|
2301
2407
|
{ _id: false }
|
|
2302
2408
|
);
|
|
2303
|
-
var schemaDailyClueBaseGame = new
|
|
2409
|
+
var schemaDailyClueBaseGame = new MongooseSchema27(
|
|
2304
2410
|
{
|
|
2305
2411
|
gameDate: { required: true, type: schemaGameDate },
|
|
2306
2412
|
gameSolution: { required: true, type: String }
|
|
2307
2413
|
},
|
|
2308
2414
|
{ _id: false }
|
|
2309
2415
|
);
|
|
2310
|
-
var schemaDailyClueGameData = new
|
|
2416
|
+
var schemaDailyClueGameData = new MongooseSchema27(
|
|
2311
2417
|
{
|
|
2312
2418
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
2313
2419
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -2322,9 +2428,9 @@ var schemaDailyClueGameData = new MongooseSchema25(
|
|
|
2322
2428
|
);
|
|
2323
2429
|
|
|
2324
2430
|
// src/mongoose/game/PuzzleGame.ts
|
|
2325
|
-
import
|
|
2326
|
-
var
|
|
2327
|
-
var schemaPuzzleAnswer = new
|
|
2431
|
+
import mongoose33 from "mongoose";
|
|
2432
|
+
var MongooseSchema28 = mongoose33.Schema;
|
|
2433
|
+
var schemaPuzzleAnswer = new MongooseSchema28(
|
|
2328
2434
|
{
|
|
2329
2435
|
answer: { required: true, type: String },
|
|
2330
2436
|
answerId: { required: true, type: String },
|
|
@@ -2332,7 +2438,7 @@ var schemaPuzzleAnswer = new MongooseSchema26(
|
|
|
2332
2438
|
},
|
|
2333
2439
|
{ _id: false }
|
|
2334
2440
|
);
|
|
2335
|
-
var schemaPuzzleQuestion = new
|
|
2441
|
+
var schemaPuzzleQuestion = new MongooseSchema28(
|
|
2336
2442
|
{
|
|
2337
2443
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
2338
2444
|
question: { required: true, type: String },
|
|
@@ -2340,20 +2446,20 @@ var schemaPuzzleQuestion = new MongooseSchema26(
|
|
|
2340
2446
|
},
|
|
2341
2447
|
{ _id: false }
|
|
2342
2448
|
);
|
|
2343
|
-
var schemaPuzzleBaseGame = new
|
|
2449
|
+
var schemaPuzzleBaseGame = new MongooseSchema28(
|
|
2344
2450
|
{
|
|
2345
2451
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
2346
2452
|
},
|
|
2347
2453
|
{ _id: false }
|
|
2348
2454
|
);
|
|
2349
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
2455
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema28(
|
|
2350
2456
|
{
|
|
2351
2457
|
questionId: { required: true, type: String },
|
|
2352
2458
|
selectedAnswerId: { required: true, type: String }
|
|
2353
2459
|
},
|
|
2354
2460
|
{ _id: false }
|
|
2355
2461
|
);
|
|
2356
|
-
var schemaPuzzleGameData = new
|
|
2462
|
+
var schemaPuzzleGameData = new MongooseSchema28(
|
|
2357
2463
|
{
|
|
2358
2464
|
answeredQuestions: {
|
|
2359
2465
|
default: null,
|
|
@@ -2368,19 +2474,19 @@ var schemaPuzzleGameData = new MongooseSchema26(
|
|
|
2368
2474
|
);
|
|
2369
2475
|
|
|
2370
2476
|
// src/mongoose/game/Game.ts
|
|
2371
|
-
var
|
|
2477
|
+
var MongooseSchema29 = mongoose34.Schema;
|
|
2372
2478
|
var gameDataSchemas = {
|
|
2373
2479
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2374
2480
|
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2375
2481
|
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2376
2482
|
};
|
|
2377
2483
|
var gameDataDefinition = Object.fromEntries(
|
|
2378
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2484
|
+
Object.entries(gameDataSchemas).map(([key, schema29]) => [
|
|
2379
2485
|
key,
|
|
2380
|
-
{ default: null, required: false, type:
|
|
2486
|
+
{ default: null, required: false, type: schema29 }
|
|
2381
2487
|
])
|
|
2382
2488
|
);
|
|
2383
|
-
var gameHistorySchema = new
|
|
2489
|
+
var gameHistorySchema = new MongooseSchema29(
|
|
2384
2490
|
{
|
|
2385
2491
|
createdAt: { required: true, type: Date },
|
|
2386
2492
|
gameDate: { required: true, type: schemaGameDate },
|
|
@@ -2400,7 +2506,7 @@ var gameHistorySchema = new MongooseSchema27(
|
|
|
2400
2506
|
},
|
|
2401
2507
|
{ _id: false }
|
|
2402
2508
|
);
|
|
2403
|
-
var gameTypeSchema = new
|
|
2509
|
+
var gameTypeSchema = new MongooseSchema29(
|
|
2404
2510
|
{
|
|
2405
2511
|
active: { default: true, required: true, type: Boolean },
|
|
2406
2512
|
gameData: gameDataDefinition,
|
|
@@ -2418,7 +2524,7 @@ var gameTypeSchema = new MongooseSchema27(
|
|
|
2418
2524
|
},
|
|
2419
2525
|
{ timestamps: true }
|
|
2420
2526
|
);
|
|
2421
|
-
var
|
|
2527
|
+
var schema25 = new MongooseSchema29(
|
|
2422
2528
|
{
|
|
2423
2529
|
active: { default: false, required: true, type: Boolean },
|
|
2424
2530
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2431,12 +2537,12 @@ var schema23 = new MongooseSchema27(
|
|
|
2431
2537
|
},
|
|
2432
2538
|
{ timestamps: true }
|
|
2433
2539
|
);
|
|
2434
|
-
var GameModel =
|
|
2540
|
+
var GameModel = mongoose34.models.Game || mongoose34.model("Game", schema25);
|
|
2435
2541
|
|
|
2436
2542
|
// src/mongoose/School.ts
|
|
2437
|
-
import
|
|
2438
|
-
var
|
|
2439
|
-
var campaignsSchema = new
|
|
2543
|
+
import mongoose35 from "mongoose";
|
|
2544
|
+
var MongooseSchema30 = mongoose35.Schema;
|
|
2545
|
+
var campaignsSchema = new MongooseSchema30(
|
|
2440
2546
|
{
|
|
2441
2547
|
endDate: { required: true, type: Date },
|
|
2442
2548
|
name: { required: true, type: String },
|
|
@@ -2444,7 +2550,7 @@ var campaignsSchema = new MongooseSchema28(
|
|
|
2444
2550
|
},
|
|
2445
2551
|
{ _id: false }
|
|
2446
2552
|
);
|
|
2447
|
-
var
|
|
2553
|
+
var schema26 = new MongooseSchema30(
|
|
2448
2554
|
{
|
|
2449
2555
|
// New schools are active by default
|
|
2450
2556
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2471,14 +2577,14 @@ var schema24 = new MongooseSchema28(
|
|
|
2471
2577
|
},
|
|
2472
2578
|
{ timestamps: true }
|
|
2473
2579
|
);
|
|
2474
|
-
|
|
2580
|
+
schema26.index(
|
|
2475
2581
|
{ schoolCode: 1 },
|
|
2476
2582
|
{
|
|
2477
2583
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2478
2584
|
unique: true
|
|
2479
2585
|
}
|
|
2480
2586
|
);
|
|
2481
|
-
var SchoolModel =
|
|
2587
|
+
var SchoolModel = mongoose35.models.School || mongoose35.model("School", schema26);
|
|
2482
2588
|
|
|
2483
2589
|
// src/mongoose/Affiliate.ts
|
|
2484
2590
|
import {
|
|
@@ -2486,9 +2592,9 @@ import {
|
|
|
2486
2592
|
EnumAffiliateRewardType,
|
|
2487
2593
|
EnumResourceType as EnumResourceType6
|
|
2488
2594
|
} from "@timardex/cluemart-shared";
|
|
2489
|
-
import
|
|
2490
|
-
var
|
|
2491
|
-
var affiliateRewardSchema = new
|
|
2595
|
+
import mongoose36 from "mongoose";
|
|
2596
|
+
var MongooseSchema31 = mongoose36.Schema;
|
|
2597
|
+
var affiliateRewardSchema = new MongooseSchema31(
|
|
2492
2598
|
{
|
|
2493
2599
|
createdAt: { required: true, type: Date },
|
|
2494
2600
|
redeemedAt: { default: null, required: false, type: Date },
|
|
@@ -2502,13 +2608,13 @@ var affiliateRewardSchema = new MongooseSchema29(
|
|
|
2502
2608
|
},
|
|
2503
2609
|
{ _id: false }
|
|
2504
2610
|
);
|
|
2505
|
-
var affiliateResourceSchema = new
|
|
2611
|
+
var affiliateResourceSchema = new MongooseSchema31(
|
|
2506
2612
|
{
|
|
2507
2613
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
2508
2614
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2509
2615
|
resourceId: {
|
|
2510
2616
|
required: true,
|
|
2511
|
-
type:
|
|
2617
|
+
type: mongoose36.Schema.Types.ObjectId
|
|
2512
2618
|
},
|
|
2513
2619
|
resourceName: { required: true, type: String },
|
|
2514
2620
|
resourceOwner: {
|
|
@@ -2528,20 +2634,20 @@ var affiliateResourceSchema = new MongooseSchema29(
|
|
|
2528
2634
|
},
|
|
2529
2635
|
{ _id: false }
|
|
2530
2636
|
);
|
|
2531
|
-
var affiliateContactDetailsSchema = new
|
|
2637
|
+
var affiliateContactDetailsSchema = new MongooseSchema31(
|
|
2532
2638
|
{
|
|
2533
2639
|
mobilePhone: { required: true, type: String }
|
|
2534
2640
|
},
|
|
2535
2641
|
{ _id: false }
|
|
2536
2642
|
);
|
|
2537
|
-
var affiliateBankAccountDetailsSchema = new
|
|
2643
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema31(
|
|
2538
2644
|
{
|
|
2539
2645
|
accountHolderName: { required: true, type: String },
|
|
2540
2646
|
accountNumber: { required: true, type: String }
|
|
2541
2647
|
},
|
|
2542
2648
|
{ _id: false }
|
|
2543
2649
|
);
|
|
2544
|
-
var affiliateDetailsSchema = new
|
|
2650
|
+
var affiliateDetailsSchema = new MongooseSchema31(
|
|
2545
2651
|
{
|
|
2546
2652
|
bankAccountDetails: {
|
|
2547
2653
|
required: true,
|
|
@@ -2563,7 +2669,7 @@ var affiliateDetailsSchema = new MongooseSchema29(
|
|
|
2563
2669
|
},
|
|
2564
2670
|
{ _id: false }
|
|
2565
2671
|
);
|
|
2566
|
-
var redeemHistorySchema = new
|
|
2672
|
+
var redeemHistorySchema = new MongooseSchema31(
|
|
2567
2673
|
{
|
|
2568
2674
|
paidAt: { default: null, required: false, type: Date },
|
|
2569
2675
|
redeemedAt: { required: true, type: Date },
|
|
@@ -2571,7 +2677,7 @@ var redeemHistorySchema = new MongooseSchema29(
|
|
|
2571
2677
|
},
|
|
2572
2678
|
{ _id: false }
|
|
2573
2679
|
);
|
|
2574
|
-
var
|
|
2680
|
+
var schema27 = new MongooseSchema31(
|
|
2575
2681
|
{
|
|
2576
2682
|
active: { default: false, required: true, type: Boolean },
|
|
2577
2683
|
affiliateBonusRewards: {
|
|
@@ -2601,23 +2707,23 @@ var schema25 = new MongooseSchema29(
|
|
|
2601
2707
|
},
|
|
2602
2708
|
{ timestamps: true }
|
|
2603
2709
|
);
|
|
2604
|
-
|
|
2710
|
+
schema27.index(
|
|
2605
2711
|
{ affiliateCode: 1 },
|
|
2606
2712
|
{
|
|
2607
2713
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2608
2714
|
unique: true
|
|
2609
2715
|
}
|
|
2610
2716
|
);
|
|
2611
|
-
var AffiliateModel =
|
|
2717
|
+
var AffiliateModel = mongoose36.models.Affiliate || mongoose36.model("Affiliate", schema27);
|
|
2612
2718
|
|
|
2613
2719
|
// src/mongoose/Coupon.ts
|
|
2614
2720
|
import {
|
|
2615
2721
|
EnumCouponQualificationType,
|
|
2616
2722
|
EnumResourceType as EnumResourceType7
|
|
2617
2723
|
} from "@timardex/cluemart-shared";
|
|
2618
|
-
import
|
|
2619
|
-
var
|
|
2620
|
-
var couponOptionSchema = new
|
|
2724
|
+
import mongoose37 from "mongoose";
|
|
2725
|
+
var MongooseSchema32 = mongoose37.Schema;
|
|
2726
|
+
var couponOptionSchema = new MongooseSchema32(
|
|
2621
2727
|
{
|
|
2622
2728
|
buy: { required: false, type: Number },
|
|
2623
2729
|
get: { required: false, type: Number },
|
|
@@ -2632,29 +2738,29 @@ var couponOptionSchema = new MongooseSchema30(
|
|
|
2632
2738
|
},
|
|
2633
2739
|
{ _id: false }
|
|
2634
2740
|
);
|
|
2635
|
-
var couponVendorProductSchema = new
|
|
2741
|
+
var couponVendorProductSchema = new MongooseSchema32(
|
|
2636
2742
|
{
|
|
2637
2743
|
couponId: {
|
|
2638
2744
|
required: true,
|
|
2639
|
-
type:
|
|
2745
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2640
2746
|
},
|
|
2641
2747
|
productId: {
|
|
2642
2748
|
required: true,
|
|
2643
|
-
type:
|
|
2749
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2644
2750
|
},
|
|
2645
2751
|
vendorCouponId: {
|
|
2646
2752
|
required: false,
|
|
2647
|
-
type:
|
|
2753
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2648
2754
|
},
|
|
2649
2755
|
vendorId: {
|
|
2650
2756
|
ref: "Vendor",
|
|
2651
2757
|
required: true,
|
|
2652
|
-
type:
|
|
2758
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2653
2759
|
}
|
|
2654
2760
|
},
|
|
2655
2761
|
{ _id: false }
|
|
2656
2762
|
);
|
|
2657
|
-
var couponCodeSchema = new
|
|
2763
|
+
var couponCodeSchema = new MongooseSchema32(
|
|
2658
2764
|
{
|
|
2659
2765
|
code: { required: true, type: String },
|
|
2660
2766
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -2662,7 +2768,7 @@ var couponCodeSchema = new MongooseSchema30(
|
|
|
2662
2768
|
},
|
|
2663
2769
|
{ _id: false }
|
|
2664
2770
|
);
|
|
2665
|
-
var couponParticipantUserSchema = new
|
|
2771
|
+
var couponParticipantUserSchema = new MongooseSchema32(
|
|
2666
2772
|
{
|
|
2667
2773
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2668
2774
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -2671,12 +2777,12 @@ var couponParticipantUserSchema = new MongooseSchema30(
|
|
|
2671
2777
|
userId: {
|
|
2672
2778
|
ref: "User",
|
|
2673
2779
|
required: true,
|
|
2674
|
-
type:
|
|
2780
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2675
2781
|
}
|
|
2676
2782
|
},
|
|
2677
2783
|
{ timestamps: true }
|
|
2678
2784
|
);
|
|
2679
|
-
var couponDataSchema = new
|
|
2785
|
+
var couponDataSchema = new MongooseSchema32(
|
|
2680
2786
|
{
|
|
2681
2787
|
active: { default: true, required: true, type: Boolean },
|
|
2682
2788
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -2703,7 +2809,7 @@ var couponDataSchema = new MongooseSchema30(
|
|
|
2703
2809
|
},
|
|
2704
2810
|
{ timestamps: true }
|
|
2705
2811
|
);
|
|
2706
|
-
var
|
|
2812
|
+
var schema28 = new MongooseSchema32(
|
|
2707
2813
|
{
|
|
2708
2814
|
active: { default: true, required: true, type: Boolean },
|
|
2709
2815
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2715,62 +2821,62 @@ var schema26 = new MongooseSchema30(
|
|
|
2715
2821
|
},
|
|
2716
2822
|
{ timestamps: true }
|
|
2717
2823
|
);
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
var CouponModel =
|
|
2824
|
+
schema28.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2825
|
+
schema28.index({ "couponData.participantUsers.userId": 1 });
|
|
2826
|
+
var CouponModel = mongoose37.models.Coupon || mongoose37.model("Coupon", schema28);
|
|
2721
2827
|
|
|
2722
2828
|
// src/mongoose/Impersonation.ts
|
|
2723
2829
|
import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
|
|
2724
|
-
import
|
|
2725
|
-
var
|
|
2726
|
-
var impersonationSessionSchema = new
|
|
2830
|
+
import mongoose38 from "mongoose";
|
|
2831
|
+
var MongooseSchema33 = mongoose38.Schema;
|
|
2832
|
+
var impersonationSessionSchema = new MongooseSchema33(
|
|
2727
2833
|
{
|
|
2728
2834
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
2729
2835
|
impersonatedUserId: {
|
|
2730
2836
|
index: true,
|
|
2731
2837
|
ref: "User",
|
|
2732
2838
|
required: true,
|
|
2733
|
-
type:
|
|
2839
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2734
2840
|
},
|
|
2735
2841
|
impersonatorUserId: {
|
|
2736
2842
|
index: true,
|
|
2737
2843
|
ref: "User",
|
|
2738
2844
|
required: true,
|
|
2739
|
-
type:
|
|
2845
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2740
2846
|
},
|
|
2741
2847
|
refreshToken: { required: true, type: String }
|
|
2742
2848
|
},
|
|
2743
2849
|
{ timestamps: true }
|
|
2744
2850
|
);
|
|
2745
|
-
var ImpersonationSessionModel =
|
|
2851
|
+
var ImpersonationSessionModel = mongoose38.models.ImpersonationSession || mongoose38.model(
|
|
2746
2852
|
"ImpersonationSession",
|
|
2747
2853
|
impersonationSessionSchema
|
|
2748
2854
|
);
|
|
2749
|
-
var impersonationAuditSchema = new
|
|
2855
|
+
var impersonationAuditSchema = new MongooseSchema33(
|
|
2750
2856
|
{
|
|
2751
2857
|
action: { enum: ["start", "end"], required: true, type: String },
|
|
2752
2858
|
endReason: { type: String },
|
|
2753
2859
|
impersonatedUserId: {
|
|
2754
2860
|
ref: "User",
|
|
2755
2861
|
required: true,
|
|
2756
|
-
type:
|
|
2862
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2757
2863
|
},
|
|
2758
2864
|
impersonatorUserId: {
|
|
2759
2865
|
ref: "User",
|
|
2760
2866
|
required: true,
|
|
2761
|
-
type:
|
|
2867
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2762
2868
|
},
|
|
2763
|
-
resourceId: { type:
|
|
2869
|
+
resourceId: { type: mongoose38.Schema.Types.ObjectId },
|
|
2764
2870
|
resourceType: { enum: Object.values(EnumResourceType8), type: String },
|
|
2765
2871
|
sessionId: {
|
|
2766
2872
|
ref: "ImpersonationSession",
|
|
2767
2873
|
required: true,
|
|
2768
|
-
type:
|
|
2874
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2769
2875
|
}
|
|
2770
2876
|
},
|
|
2771
2877
|
{ timestamps: true }
|
|
2772
2878
|
);
|
|
2773
|
-
var ImpersonationAuditModel =
|
|
2879
|
+
var ImpersonationAuditModel = mongoose38.models.ImpersonationAudit || mongoose38.model(
|
|
2774
2880
|
"ImpersonationAudit",
|
|
2775
2881
|
impersonationAuditSchema
|
|
2776
2882
|
);
|
|
@@ -3214,7 +3320,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
3214
3320
|
}
|
|
3215
3321
|
|
|
3216
3322
|
// src/service/database.ts
|
|
3217
|
-
import
|
|
3323
|
+
import mongoose39 from "mongoose";
|
|
3218
3324
|
var connectToDatabase = async ({
|
|
3219
3325
|
appName,
|
|
3220
3326
|
dbName,
|
|
@@ -3227,7 +3333,7 @@ var connectToDatabase = async ({
|
|
|
3227
3333
|
// Fallback to MongoDB Atlas connection string
|
|
3228
3334
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
3229
3335
|
);
|
|
3230
|
-
await
|
|
3336
|
+
await mongoose39.connect(mongoUri);
|
|
3231
3337
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
3232
3338
|
console.log(
|
|
3233
3339
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -3240,7 +3346,7 @@ var connectToDatabase = async ({
|
|
|
3240
3346
|
|
|
3241
3347
|
// src/types/index.ts
|
|
3242
3348
|
import express from "express";
|
|
3243
|
-
import
|
|
3349
|
+
import mongoose40 from "mongoose";
|
|
3244
3350
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
3245
3351
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
3246
3352
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -3362,15 +3468,15 @@ async function updateAdStatuses() {
|
|
|
3362
3468
|
}
|
|
3363
3469
|
|
|
3364
3470
|
// src/service/objectIdToString.ts
|
|
3365
|
-
import
|
|
3471
|
+
import mongoose41 from "mongoose";
|
|
3366
3472
|
function isValidObjectId(value) {
|
|
3367
|
-
return
|
|
3473
|
+
return mongoose41.Types.ObjectId.isValid(value);
|
|
3368
3474
|
}
|
|
3369
3475
|
function convertObjectIdsToStrings(obj) {
|
|
3370
3476
|
if (obj === null || obj === void 0) {
|
|
3371
3477
|
return obj;
|
|
3372
3478
|
}
|
|
3373
|
-
if (obj instanceof
|
|
3479
|
+
if (obj instanceof mongoose41.Types.ObjectId) {
|
|
3374
3480
|
return obj.toString();
|
|
3375
3481
|
}
|
|
3376
3482
|
if (obj instanceof Date) {
|
|
@@ -5009,6 +5115,7 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
5009
5115
|
export {
|
|
5010
5116
|
ACTIVE_NOT_DELETED_FILTER,
|
|
5011
5117
|
AD_BILLING_CATALOG_COLLECTION_NAME,
|
|
5118
|
+
AI_IMPORT_RUN_LOCK_KEY,
|
|
5012
5119
|
APP_SETTINGS_ID,
|
|
5013
5120
|
AdBillingCatalogModel,
|
|
5014
5121
|
AdBookingModel,
|
|
@@ -5016,6 +5123,8 @@ export {
|
|
|
5016
5123
|
AdModel,
|
|
5017
5124
|
AdPurchaseModel,
|
|
5018
5125
|
AffiliateModel,
|
|
5126
|
+
AiImportRunLockModel,
|
|
5127
|
+
AiImportRunModel,
|
|
5019
5128
|
AiImportedMarketModel,
|
|
5020
5129
|
AppSettingModel,
|
|
5021
5130
|
AuthHandoffTokenModel,
|
|
@@ -5046,7 +5155,7 @@ export {
|
|
|
5046
5155
|
RelationTypeSchema,
|
|
5047
5156
|
ResourceActivityModel,
|
|
5048
5157
|
ResourceImageTypeSchema,
|
|
5049
|
-
|
|
5158
|
+
SCRAPE_SITES_CONFIG_ID,
|
|
5050
5159
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
5051
5160
|
SchoolModel,
|
|
5052
5161
|
ScrapeSiteConfigModel,
|
|
@@ -5104,7 +5213,7 @@ export {
|
|
|
5104
5213
|
locationGeoSchema,
|
|
5105
5214
|
locationsSchema,
|
|
5106
5215
|
mapVendorLicenceToSubscriptionRewardType,
|
|
5107
|
-
|
|
5216
|
+
mongoose40 as mongoose,
|
|
5108
5217
|
normalizeAffiliatePromoCodes,
|
|
5109
5218
|
normalizePromoCode,
|
|
5110
5219
|
notifyUsers,
|