@timardex/cluemart-server-shared 4.0.0 → 4.0.3
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-MVQMMXGY.mjs → chunk-3ICI65FJ.mjs} +363 -240
- package/dist/chunk-3ICI65FJ.mjs.map +1 -0
- package/dist/index.cjs +554 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +105 -8
- package/dist/index.d.ts +105 -8
- package/dist/index.mjs +369 -246
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +424 -300
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +101 -5
- package/dist/mongoose/index.d.ts +101 -5
- package/dist/mongoose/index.mjs +11 -3
- package/dist/service/index.cjs +541 -427
- 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-MVQMMXGY.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(schema28) {
|
|
|
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(schema28) {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
next();
|
|
1002
1002
|
};
|
|
1003
|
-
|
|
1003
|
+
schema29.pre(
|
|
1004
1004
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
1005
1005
|
syncSearchNameOnUpdate
|
|
1006
1006
|
);
|
|
@@ -1037,6 +1037,7 @@ var schema7 = new MongooseSchema6(
|
|
|
1037
1037
|
dateTime: [dateTimeSchema],
|
|
1038
1038
|
deletedAt: { default: null, required: false, type: Date },
|
|
1039
1039
|
description: { required: true, type: String },
|
|
1040
|
+
earliestStartDate: { default: null, required: false, type: Date },
|
|
1040
1041
|
eventId: {
|
|
1041
1042
|
ref: "Event",
|
|
1042
1043
|
required: false,
|
|
@@ -1079,6 +1080,7 @@ schema7.index({ name: 1 });
|
|
|
1079
1080
|
schema7.index({ region: 1 });
|
|
1080
1081
|
schema7.index({ deletedAt: 1 });
|
|
1081
1082
|
schema7.index({ "dateTime.dateStatus": 1 });
|
|
1083
|
+
schema7.index({ earliestStartDate: 1, _id: 1 });
|
|
1082
1084
|
schema7.index({ slug: 1 });
|
|
1083
1085
|
schema7.index({ description: "text", name: "text" });
|
|
1084
1086
|
schema7.plugin(searchNamePlugin);
|
|
@@ -1087,6 +1089,7 @@ var GoogleImportedMarketModel = mongoose10.models.GoogleImportedMarket || mongoo
|
|
|
1087
1089
|
// src/mongoose/AiImportedMarket.ts
|
|
1088
1090
|
import {
|
|
1089
1091
|
EnumEventType as EnumEventType2,
|
|
1092
|
+
EnumImportedMarketDeactivationReason,
|
|
1090
1093
|
EnumImportedMarketReviewStatus
|
|
1091
1094
|
} from "@timardex/cluemart-shared";
|
|
1092
1095
|
import mongoose11 from "mongoose";
|
|
@@ -1117,8 +1120,16 @@ var schema8 = new MongooseSchema7(
|
|
|
1117
1120
|
type: ResourceImageTypeSchema
|
|
1118
1121
|
},
|
|
1119
1122
|
dateTime: [dateTimeSchema],
|
|
1123
|
+
deactivatedReason: {
|
|
1124
|
+
enum: Object.values(EnumImportedMarketDeactivationReason),
|
|
1125
|
+
required: false,
|
|
1126
|
+
type: String
|
|
1127
|
+
},
|
|
1120
1128
|
deletedAt: { default: null, required: false, type: Date },
|
|
1121
1129
|
description: { required: true, type: String },
|
|
1130
|
+
descriptionSourceHash: { required: false, type: String },
|
|
1131
|
+
duplicateHint: { required: false, type: String },
|
|
1132
|
+
earliestStartDate: { default: null, required: false, type: Date },
|
|
1122
1133
|
eventId: {
|
|
1123
1134
|
ref: "Event",
|
|
1124
1135
|
required: false,
|
|
@@ -1130,11 +1141,13 @@ var schema8 = new MongooseSchema7(
|
|
|
1130
1141
|
type: String
|
|
1131
1142
|
},
|
|
1132
1143
|
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
1144
|
+
lastSeenAt: { default: null, required: false, type: Date },
|
|
1133
1145
|
location: {
|
|
1134
1146
|
required: true,
|
|
1135
1147
|
type: locationsSchema
|
|
1136
1148
|
},
|
|
1137
1149
|
logo: { required: false, type: ResourceImageTypeSchema },
|
|
1150
|
+
missedRuns: { default: 0, required: true, type: Number },
|
|
1138
1151
|
name: { required: true, type: String },
|
|
1139
1152
|
openingHours: { required: false, type: [String] },
|
|
1140
1153
|
rainOrShine: { required: true, type: Boolean },
|
|
@@ -1164,6 +1177,7 @@ var schema8 = new MongooseSchema7(
|
|
|
1164
1177
|
},
|
|
1165
1178
|
sourceName: { required: true, type: String },
|
|
1166
1179
|
sourceUrl: { required: true, type: String },
|
|
1180
|
+
tags: { required: false, type: [String] },
|
|
1167
1181
|
website: { required: false, type: String }
|
|
1168
1182
|
},
|
|
1169
1183
|
{ timestamps: true }
|
|
@@ -1173,18 +1187,109 @@ schema8.index({ name: 1 });
|
|
|
1173
1187
|
schema8.index({ region: 1 });
|
|
1174
1188
|
schema8.index({ deletedAt: 1 });
|
|
1175
1189
|
schema8.index({ "dateTime.dateStatus": 1 });
|
|
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 });
|
|
1176
1200
|
schema8.index({ slug: 1 });
|
|
1177
1201
|
schema8.index({ reviewStatus: 1 });
|
|
1178
1202
|
schema8.index({ description: "text", name: "text" });
|
|
1179
1203
|
schema8.plugin(searchNamePlugin);
|
|
1180
1204
|
var AiImportedMarketModel = mongoose11.models.AiImportedMarket || mongoose11.model("AiImportedMarket", schema8);
|
|
1181
1205
|
|
|
1182
|
-
// src/mongoose/
|
|
1206
|
+
// src/mongoose/AiImportRun.ts
|
|
1207
|
+
import {
|
|
1208
|
+
EnumAiImportRunStatus
|
|
1209
|
+
} from "@timardex/cluemart-shared";
|
|
1183
1210
|
import mongoose12 from "mongoose";
|
|
1184
1211
|
var MongooseSchema8 = mongoose12.Schema;
|
|
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
|
+
errors: { default: 0, required: true, type: Number },
|
|
1223
|
+
found: { default: 0, required: true, type: Number },
|
|
1224
|
+
imported: { default: 0, required: true, type: Number },
|
|
1225
|
+
name: { required: true, type: String },
|
|
1226
|
+
skipped: { default: 0, required: true, type: Number },
|
|
1227
|
+
status: {
|
|
1228
|
+
enum: [EnumAiImportRunStatus.SUCCESS, EnumAiImportRunStatus.ERROR],
|
|
1229
|
+
required: true,
|
|
1230
|
+
type: String
|
|
1231
|
+
},
|
|
1232
|
+
url: { required: true, type: String },
|
|
1233
|
+
usage: { required: true, type: usageSchema }
|
|
1234
|
+
},
|
|
1235
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1236
|
+
);
|
|
1237
|
+
var resultSchema = new MongooseSchema8(
|
|
1238
|
+
{
|
|
1239
|
+
errors: { default: 0, required: true, type: Number },
|
|
1240
|
+
totalFound: { default: 0, required: true, type: Number },
|
|
1241
|
+
totalImported: { default: 0, required: true, type: Number },
|
|
1242
|
+
totalSkipped: { default: 0, required: true, type: Number }
|
|
1243
|
+
},
|
|
1244
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1245
|
+
);
|
|
1185
1246
|
var schema9 = new MongooseSchema8(
|
|
1247
|
+
{
|
|
1248
|
+
error: { required: false, type: String },
|
|
1249
|
+
finishedAt: { required: false, type: Date },
|
|
1250
|
+
result: { required: false, type: resultSchema },
|
|
1251
|
+
siteResults: { default: [], required: true, type: [siteResultSchema] },
|
|
1252
|
+
startedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
|
|
1253
|
+
status: {
|
|
1254
|
+
default: EnumAiImportRunStatus.PENDING,
|
|
1255
|
+
enum: Object.values(EnumAiImportRunStatus),
|
|
1256
|
+
required: true,
|
|
1257
|
+
type: String
|
|
1258
|
+
},
|
|
1259
|
+
triggeredByUserId: {
|
|
1260
|
+
ref: "User",
|
|
1261
|
+
required: false,
|
|
1262
|
+
type: mongoose12.Schema.Types.ObjectId
|
|
1263
|
+
},
|
|
1264
|
+
usage: { required: false, type: usageSchema }
|
|
1265
|
+
},
|
|
1266
|
+
{ timestamps: true }
|
|
1267
|
+
);
|
|
1268
|
+
schema9.index({ createdAt: -1 });
|
|
1269
|
+
var AiImportRunModel = mongoose12.models.AiImportRun || mongoose12.model("AiImportRun", schema9);
|
|
1270
|
+
|
|
1271
|
+
// src/mongoose/AiImportRunLock.ts
|
|
1272
|
+
import mongoose13 from "mongoose";
|
|
1273
|
+
var AI_IMPORT_RUN_LOCK_KEY = "ai-import-run";
|
|
1274
|
+
var MongooseSchema9 = mongoose13.Schema;
|
|
1275
|
+
var schema10 = new MongooseSchema9(
|
|
1276
|
+
{
|
|
1277
|
+
_id: { required: true, type: String },
|
|
1278
|
+
lockedAt: { required: false, type: Date },
|
|
1279
|
+
token: { required: false, type: String }
|
|
1280
|
+
},
|
|
1281
|
+
{ timestamps: true }
|
|
1282
|
+
);
|
|
1283
|
+
var AiImportRunLockModel = mongoose13.models.AiImportRunLock || mongoose13.model("AiImportRunLock", schema10);
|
|
1284
|
+
|
|
1285
|
+
// src/mongoose/ScrapeSite.ts
|
|
1286
|
+
import mongoose14 from "mongoose";
|
|
1287
|
+
var SCRAPE_SITES_CONFIG_ID = "scrapeSites";
|
|
1288
|
+
var MongooseSchema10 = mongoose14.Schema;
|
|
1289
|
+
var scrapeSiteItemSchema = new MongooseSchema10(
|
|
1186
1290
|
{
|
|
1187
1291
|
enabled: { default: true, required: true, type: Boolean },
|
|
1292
|
+
lastCount: { required: false, type: Number },
|
|
1188
1293
|
lastError: { required: false, type: String },
|
|
1189
1294
|
lastScrapedAt: { required: false, type: Date },
|
|
1190
1295
|
lastScrapeStatus: { required: false, type: String },
|
|
@@ -1194,18 +1299,32 @@ var schema9 = new MongooseSchema8(
|
|
|
1194
1299
|
},
|
|
1195
1300
|
{ timestamps: true }
|
|
1196
1301
|
);
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1302
|
+
var configSchema = new MongooseSchema10(
|
|
1303
|
+
{
|
|
1304
|
+
_id: { required: true, type: String },
|
|
1305
|
+
sites: {
|
|
1306
|
+
default: [],
|
|
1307
|
+
required: true,
|
|
1308
|
+
type: [scrapeSiteItemSchema]
|
|
1309
|
+
},
|
|
1310
|
+
updatedByUserId: {
|
|
1311
|
+
ref: "User",
|
|
1312
|
+
required: false,
|
|
1313
|
+
type: mongoose14.Schema.Types.ObjectId
|
|
1314
|
+
}
|
|
1315
|
+
},
|
|
1316
|
+
{ timestamps: true }
|
|
1317
|
+
);
|
|
1318
|
+
var ScrapeSiteConfigModel = mongoose14.models.ScrapeSiteConfig || mongoose14.model("ScrapeSiteConfig", configSchema);
|
|
1200
1319
|
|
|
1201
1320
|
// src/mongoose/Notification.ts
|
|
1202
1321
|
import {
|
|
1203
1322
|
EnumNotificationResourceType,
|
|
1204
1323
|
EnumNotificationType
|
|
1205
1324
|
} from "@timardex/cluemart-shared";
|
|
1206
|
-
import
|
|
1207
|
-
var
|
|
1208
|
-
var notificationDataSchema = new
|
|
1325
|
+
import mongoose15 from "mongoose";
|
|
1326
|
+
var MongooseSchema11 = mongoose15.Schema;
|
|
1327
|
+
var notificationDataSchema = new MongooseSchema11(
|
|
1209
1328
|
{
|
|
1210
1329
|
resourceId: { required: true, type: String },
|
|
1211
1330
|
resourceName: { required: true, type: String },
|
|
@@ -1217,7 +1336,7 @@ var notificationDataSchema = new MongooseSchema9(
|
|
|
1217
1336
|
},
|
|
1218
1337
|
{ _id: false }
|
|
1219
1338
|
);
|
|
1220
|
-
var
|
|
1339
|
+
var schema11 = new MongooseSchema11(
|
|
1221
1340
|
{
|
|
1222
1341
|
data: {
|
|
1223
1342
|
default: null,
|
|
@@ -1236,20 +1355,20 @@ var schema10 = new MongooseSchema9(
|
|
|
1236
1355
|
userId: {
|
|
1237
1356
|
ref: "User",
|
|
1238
1357
|
required: true,
|
|
1239
|
-
type:
|
|
1358
|
+
type: mongoose15.Schema.Types.ObjectId
|
|
1240
1359
|
}
|
|
1241
1360
|
},
|
|
1242
1361
|
{ timestamps: true }
|
|
1243
1362
|
);
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
var NotificationModel =
|
|
1363
|
+
schema11.index({ isRead: 1, userId: 1 });
|
|
1364
|
+
schema11.index({ createdAt: -1, userId: 1 });
|
|
1365
|
+
var NotificationModel = mongoose15.models.Notification || mongoose15.model("Notification", schema11);
|
|
1247
1366
|
|
|
1248
1367
|
// src/mongoose/PushToken.ts
|
|
1249
1368
|
import { EnumOSPlatform } from "@timardex/cluemart-shared/enums";
|
|
1250
|
-
import
|
|
1251
|
-
var
|
|
1252
|
-
var
|
|
1369
|
+
import mongoose16 from "mongoose";
|
|
1370
|
+
var MongooseSchema12 = mongoose16.Schema;
|
|
1371
|
+
var schema12 = new MongooseSchema12(
|
|
1253
1372
|
{
|
|
1254
1373
|
platform: {
|
|
1255
1374
|
enum: Object.values(EnumOSPlatform),
|
|
@@ -1260,12 +1379,12 @@ var schema11 = new MongooseSchema10(
|
|
|
1260
1379
|
userId: {
|
|
1261
1380
|
ref: "User",
|
|
1262
1381
|
required: true,
|
|
1263
|
-
type:
|
|
1382
|
+
type: mongoose16.Schema.Types.ObjectId
|
|
1264
1383
|
}
|
|
1265
1384
|
},
|
|
1266
1385
|
{ timestamps: true }
|
|
1267
1386
|
);
|
|
1268
|
-
var PushTokenModel =
|
|
1387
|
+
var PushTokenModel = mongoose16.models.PushToken || mongoose16.model("PushToken", schema12);
|
|
1269
1388
|
|
|
1270
1389
|
// src/mongoose/Relation.ts
|
|
1271
1390
|
import {
|
|
@@ -1274,16 +1393,16 @@ import {
|
|
|
1274
1393
|
EnumRelationResource,
|
|
1275
1394
|
EnumResourceType as EnumResourceType2
|
|
1276
1395
|
} from "@timardex/cluemart-shared";
|
|
1277
|
-
import
|
|
1396
|
+
import mongoose18 from "mongoose";
|
|
1278
1397
|
|
|
1279
1398
|
// src/mongoose/event/EventInfo.ts
|
|
1280
1399
|
import {
|
|
1281
1400
|
EnumEventDateStatus as EnumEventDateStatus2,
|
|
1282
1401
|
EnumPaymentMethod
|
|
1283
1402
|
} from "@timardex/cluemart-shared";
|
|
1284
|
-
import
|
|
1285
|
-
var
|
|
1286
|
-
var StallTypeSchema = new
|
|
1403
|
+
import mongoose17 from "mongoose";
|
|
1404
|
+
var MongooseSchema13 = mongoose17.Schema;
|
|
1405
|
+
var StallTypeSchema = new MongooseSchema13(
|
|
1287
1406
|
{
|
|
1288
1407
|
label: { required: false, type: String },
|
|
1289
1408
|
price: { required: false, type: Number },
|
|
@@ -1294,7 +1413,7 @@ var StallTypeSchema = new MongooseSchema11(
|
|
|
1294
1413
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1295
1414
|
}
|
|
1296
1415
|
);
|
|
1297
|
-
var dateTimeSchema2 = new
|
|
1416
|
+
var dateTimeSchema2 = new MongooseSchema13(
|
|
1298
1417
|
{
|
|
1299
1418
|
dateStatus: {
|
|
1300
1419
|
enum: Object.values(EnumEventDateStatus2),
|
|
@@ -1310,7 +1429,7 @@ var dateTimeSchema2 = new MongooseSchema11(
|
|
|
1310
1429
|
{ _id: false }
|
|
1311
1430
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1312
1431
|
);
|
|
1313
|
-
var paymentInfoSchema = new
|
|
1432
|
+
var paymentInfoSchema = new MongooseSchema13(
|
|
1314
1433
|
{
|
|
1315
1434
|
accountHolderName: { required: false, type: String },
|
|
1316
1435
|
accountNumber: { required: false, type: String },
|
|
@@ -1324,7 +1443,7 @@ var paymentInfoSchema = new MongooseSchema11(
|
|
|
1324
1443
|
{ _id: false }
|
|
1325
1444
|
// Prevents Mongoose from creating an additional _id field
|
|
1326
1445
|
);
|
|
1327
|
-
var requirementsSchema = new
|
|
1446
|
+
var requirementsSchema = new MongooseSchema13(
|
|
1328
1447
|
{
|
|
1329
1448
|
category: { required: true, type: String },
|
|
1330
1449
|
label: { required: true, type: String },
|
|
@@ -1335,7 +1454,7 @@ var requirementsSchema = new MongooseSchema11(
|
|
|
1335
1454
|
// Prevents Mongoose from creating an additional _id field for
|
|
1336
1455
|
}
|
|
1337
1456
|
);
|
|
1338
|
-
var refundPolicySchema = new
|
|
1457
|
+
var refundPolicySchema = new MongooseSchema13(
|
|
1339
1458
|
{
|
|
1340
1459
|
category: { required: true, type: String },
|
|
1341
1460
|
label: { required: true, type: String },
|
|
@@ -1343,7 +1462,7 @@ var refundPolicySchema = new MongooseSchema11(
|
|
|
1343
1462
|
},
|
|
1344
1463
|
{ _id: false }
|
|
1345
1464
|
);
|
|
1346
|
-
var
|
|
1465
|
+
var schema13 = new MongooseSchema13(
|
|
1347
1466
|
{
|
|
1348
1467
|
active: { default: true, type: Boolean },
|
|
1349
1468
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -1351,7 +1470,7 @@ var schema12 = new MongooseSchema11(
|
|
|
1351
1470
|
eventId: {
|
|
1352
1471
|
ref: "Event",
|
|
1353
1472
|
required: true,
|
|
1354
|
-
type:
|
|
1473
|
+
type: mongoose17.Schema.Types.ObjectId
|
|
1355
1474
|
},
|
|
1356
1475
|
packInTime: { required: true, type: Number },
|
|
1357
1476
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -1361,12 +1480,12 @@ var schema12 = new MongooseSchema11(
|
|
|
1361
1480
|
},
|
|
1362
1481
|
{ timestamps: true }
|
|
1363
1482
|
);
|
|
1364
|
-
|
|
1365
|
-
var EventInfoModel =
|
|
1483
|
+
schema13.index({ eventId: 1 });
|
|
1484
|
+
var EventInfoModel = mongoose17.models.EventInfo || mongoose17.model("EventInfo", schema13);
|
|
1366
1485
|
|
|
1367
1486
|
// src/mongoose/Relation.ts
|
|
1368
|
-
var
|
|
1369
|
-
var relationDateTimeSchema = new
|
|
1487
|
+
var MongooseSchema14 = mongoose18.Schema;
|
|
1488
|
+
var relationDateTimeSchema = new MongooseSchema14(
|
|
1370
1489
|
{
|
|
1371
1490
|
dateStatus: {
|
|
1372
1491
|
enum: Object.values(EnumEventDateStatus3),
|
|
@@ -1381,7 +1500,7 @@ var relationDateTimeSchema = new MongooseSchema12(
|
|
|
1381
1500
|
},
|
|
1382
1501
|
{ _id: false }
|
|
1383
1502
|
);
|
|
1384
|
-
var relationDatesSchema = new
|
|
1503
|
+
var relationDatesSchema = new MongooseSchema14(
|
|
1385
1504
|
{
|
|
1386
1505
|
dateTime: {
|
|
1387
1506
|
required: true,
|
|
@@ -1400,19 +1519,19 @@ var relationDatesSchema = new MongooseSchema12(
|
|
|
1400
1519
|
},
|
|
1401
1520
|
{ _id: false }
|
|
1402
1521
|
);
|
|
1403
|
-
var RelationTypeSchema = new
|
|
1522
|
+
var RelationTypeSchema = new MongooseSchema14(
|
|
1404
1523
|
{
|
|
1405
1524
|
active: { default: true, required: true, type: Boolean },
|
|
1406
1525
|
chatId: {
|
|
1407
1526
|
ref: "Chat",
|
|
1408
1527
|
required: true,
|
|
1409
|
-
type:
|
|
1528
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1410
1529
|
},
|
|
1411
1530
|
deletedAt: { default: null, required: false, type: Date },
|
|
1412
1531
|
eventId: {
|
|
1413
1532
|
ref: "Event",
|
|
1414
1533
|
required: true,
|
|
1415
|
-
type:
|
|
1534
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1416
1535
|
},
|
|
1417
1536
|
lastUpdateBy: {
|
|
1418
1537
|
enum: Object.values(EnumResourceType2),
|
|
@@ -1428,7 +1547,7 @@ var RelationTypeSchema = new MongooseSchema12(
|
|
|
1428
1547
|
vendorId: {
|
|
1429
1548
|
ref: "Vendor",
|
|
1430
1549
|
required: true,
|
|
1431
|
-
type:
|
|
1550
|
+
type: mongoose18.Schema.Types.ObjectId
|
|
1432
1551
|
}
|
|
1433
1552
|
},
|
|
1434
1553
|
{ timestamps: true }
|
|
@@ -1440,7 +1559,7 @@ RelationTypeSchema.index({
|
|
|
1440
1559
|
"relationDates.status": 1,
|
|
1441
1560
|
vendorId: 1
|
|
1442
1561
|
});
|
|
1443
|
-
var RelationModel =
|
|
1562
|
+
var RelationModel = mongoose18.models.Relation || mongoose18.model("Relation", RelationTypeSchema);
|
|
1444
1563
|
|
|
1445
1564
|
// src/mongoose/ResourceActivity.ts
|
|
1446
1565
|
import {
|
|
@@ -1449,9 +1568,9 @@ import {
|
|
|
1449
1568
|
EnumOSPlatform as EnumOSPlatform2,
|
|
1450
1569
|
EnumResourceType as EnumResourceType3
|
|
1451
1570
|
} from "@timardex/cluemart-shared";
|
|
1452
|
-
import
|
|
1453
|
-
var
|
|
1454
|
-
var ActivitySchema = new
|
|
1571
|
+
import mongoose19 from "mongoose";
|
|
1572
|
+
var MongooseSchema15 = mongoose19.Schema;
|
|
1573
|
+
var ActivitySchema = new MongooseSchema15(
|
|
1455
1574
|
{
|
|
1456
1575
|
activityType: {
|
|
1457
1576
|
enum: Object.values(EnumActivity),
|
|
@@ -1479,7 +1598,7 @@ var ActivitySchema = new MongooseSchema13(
|
|
|
1479
1598
|
},
|
|
1480
1599
|
{ _id: false }
|
|
1481
1600
|
);
|
|
1482
|
-
var
|
|
1601
|
+
var schema14 = new MongooseSchema15(
|
|
1483
1602
|
{
|
|
1484
1603
|
activity: { default: [], type: [ActivitySchema] },
|
|
1485
1604
|
resourceId: { required: true, type: String },
|
|
@@ -1491,9 +1610,9 @@ var schema13 = new MongooseSchema13(
|
|
|
1491
1610
|
},
|
|
1492
1611
|
{ timestamps: true }
|
|
1493
1612
|
);
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
var ResourceActivityModel =
|
|
1613
|
+
schema14.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
1614
|
+
schema14.index({ "views.location": "2dsphere" });
|
|
1615
|
+
var ResourceActivityModel = mongoose19.models.ResourceActivity || mongoose19.model("ResourceActivity", schema14);
|
|
1497
1616
|
|
|
1498
1617
|
// src/mongoose/User.ts
|
|
1499
1618
|
import {
|
|
@@ -1507,40 +1626,40 @@ import {
|
|
|
1507
1626
|
EnumUserLicence as EnumUserLicence3,
|
|
1508
1627
|
EnumUserRole
|
|
1509
1628
|
} from "@timardex/cluemart-shared";
|
|
1510
|
-
import
|
|
1511
|
-
var
|
|
1512
|
-
var userActivityEventSchema = new
|
|
1629
|
+
import mongoose20 from "mongoose";
|
|
1630
|
+
var MongooseSchema16 = mongoose20.Schema;
|
|
1631
|
+
var userActivityEventSchema = new MongooseSchema16(
|
|
1513
1632
|
{
|
|
1514
1633
|
dateTime: dateTimeSchema,
|
|
1515
1634
|
resourceId: {
|
|
1516
1635
|
ref: "Event",
|
|
1517
1636
|
required: false,
|
|
1518
|
-
type:
|
|
1637
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1519
1638
|
}
|
|
1520
1639
|
},
|
|
1521
1640
|
{ _id: false }
|
|
1522
1641
|
);
|
|
1523
|
-
var userActivityFavouritesSchema = new
|
|
1642
|
+
var userActivityFavouritesSchema = new MongooseSchema16(
|
|
1524
1643
|
{
|
|
1525
1644
|
events: {
|
|
1526
1645
|
ref: "Event",
|
|
1527
1646
|
required: false,
|
|
1528
|
-
type: [
|
|
1647
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1529
1648
|
},
|
|
1530
1649
|
partners: {
|
|
1531
1650
|
ref: "Partner",
|
|
1532
1651
|
required: false,
|
|
1533
|
-
type: [
|
|
1652
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1534
1653
|
},
|
|
1535
1654
|
vendors: {
|
|
1536
1655
|
ref: "Vendor",
|
|
1537
1656
|
required: false,
|
|
1538
|
-
type: [
|
|
1657
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1539
1658
|
}
|
|
1540
1659
|
},
|
|
1541
1660
|
{ _id: false }
|
|
1542
1661
|
);
|
|
1543
|
-
var stripeSchema = new
|
|
1662
|
+
var stripeSchema = new MongooseSchema16(
|
|
1544
1663
|
{
|
|
1545
1664
|
billingPeriod: {
|
|
1546
1665
|
enum: Object.values(EnumBillingPeriod2),
|
|
@@ -1622,7 +1741,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1622
1741
|
},
|
|
1623
1742
|
{ _id: false }
|
|
1624
1743
|
);
|
|
1625
|
-
var redeemedRewardSchema = new
|
|
1744
|
+
var redeemedRewardSchema = new MongooseSchema16(
|
|
1626
1745
|
{
|
|
1627
1746
|
name: {
|
|
1628
1747
|
enum: Object.values(EnumReward),
|
|
@@ -1634,7 +1753,7 @@ var redeemedRewardSchema = new MongooseSchema14(
|
|
|
1634
1753
|
},
|
|
1635
1754
|
{ _id: false }
|
|
1636
1755
|
);
|
|
1637
|
-
var userOverallPointsSchema = new
|
|
1756
|
+
var userOverallPointsSchema = new MongooseSchema16(
|
|
1638
1757
|
{
|
|
1639
1758
|
createdAt: { required: true, type: Date },
|
|
1640
1759
|
points: { default: 0, required: true, type: Number },
|
|
@@ -1647,13 +1766,13 @@ var userOverallPointsSchema = new MongooseSchema14(
|
|
|
1647
1766
|
},
|
|
1648
1767
|
{ _id: false }
|
|
1649
1768
|
);
|
|
1650
|
-
var
|
|
1769
|
+
var schema15 = new MongooseSchema16(
|
|
1651
1770
|
{
|
|
1652
1771
|
active: { default: false, required: true, type: Boolean },
|
|
1653
1772
|
affiliate: {
|
|
1654
1773
|
ref: "Affiliate",
|
|
1655
1774
|
required: false,
|
|
1656
|
-
type:
|
|
1775
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1657
1776
|
},
|
|
1658
1777
|
avatar: {
|
|
1659
1778
|
required: false,
|
|
@@ -1662,7 +1781,7 @@ var schema14 = new MongooseSchema14(
|
|
|
1662
1781
|
coupon: {
|
|
1663
1782
|
ref: "Coupon",
|
|
1664
1783
|
required: false,
|
|
1665
|
-
type:
|
|
1784
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1666
1785
|
},
|
|
1667
1786
|
deletedAt: { default: null, required: false, type: Date },
|
|
1668
1787
|
email: { required: true, type: String },
|
|
@@ -1674,13 +1793,13 @@ var schema14 = new MongooseSchema14(
|
|
|
1674
1793
|
events: {
|
|
1675
1794
|
ref: "Event",
|
|
1676
1795
|
required: false,
|
|
1677
|
-
type: [
|
|
1796
|
+
type: [mongoose20.Schema.Types.ObjectId]
|
|
1678
1797
|
},
|
|
1679
1798
|
firstName: { required: true, type: String },
|
|
1680
1799
|
game: {
|
|
1681
1800
|
ref: "Game",
|
|
1682
1801
|
required: false,
|
|
1683
|
-
type:
|
|
1802
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1684
1803
|
},
|
|
1685
1804
|
interests: {
|
|
1686
1805
|
enum: Object.values(EnumResourceType4),
|
|
@@ -1706,7 +1825,7 @@ var schema14 = new MongooseSchema14(
|
|
|
1706
1825
|
partner: {
|
|
1707
1826
|
ref: "Partner",
|
|
1708
1827
|
required: false,
|
|
1709
|
-
type:
|
|
1828
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1710
1829
|
},
|
|
1711
1830
|
password: { required: true, type: String },
|
|
1712
1831
|
platform: {
|
|
@@ -1747,7 +1866,7 @@ var schema14 = new MongooseSchema14(
|
|
|
1747
1866
|
school: {
|
|
1748
1867
|
ref: "School",
|
|
1749
1868
|
required: false,
|
|
1750
|
-
type:
|
|
1869
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1751
1870
|
},
|
|
1752
1871
|
stripe: {
|
|
1753
1872
|
required: false,
|
|
@@ -1772,21 +1891,21 @@ var schema14 = new MongooseSchema14(
|
|
|
1772
1891
|
vendor: {
|
|
1773
1892
|
ref: "Vendor",
|
|
1774
1893
|
required: false,
|
|
1775
|
-
type:
|
|
1894
|
+
type: mongoose20.Schema.Types.ObjectId
|
|
1776
1895
|
}
|
|
1777
1896
|
},
|
|
1778
1897
|
{ strict: false, timestamps: true }
|
|
1779
1898
|
);
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
var UserModel =
|
|
1899
|
+
schema15.index({ "licences.expiryDate": 1 });
|
|
1900
|
+
schema15.index({ "licences.licenceType": 1 });
|
|
1901
|
+
schema15.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
1902
|
+
schema15.index({ email: "text", firstName: "text", lastName: "text" });
|
|
1903
|
+
var UserModel = mongoose20.models.User || mongoose20.model("User", schema15);
|
|
1785
1904
|
|
|
1786
1905
|
// src/mongoose/VerificationToken.ts
|
|
1787
|
-
import
|
|
1788
|
-
var
|
|
1789
|
-
var
|
|
1906
|
+
import mongoose21 from "mongoose";
|
|
1907
|
+
var MongooseSchema17 = mongoose21.Schema;
|
|
1908
|
+
var schema16 = new MongooseSchema17(
|
|
1790
1909
|
{
|
|
1791
1910
|
createdAt: {
|
|
1792
1911
|
default: Date.now,
|
|
@@ -1801,16 +1920,16 @@ var schema15 = new MongooseSchema15(
|
|
|
1801
1920
|
},
|
|
1802
1921
|
{ timestamps: true }
|
|
1803
1922
|
);
|
|
1804
|
-
var VerificationTokenModel =
|
|
1923
|
+
var VerificationTokenModel = mongoose21.models.VerificationToken || mongoose21.model("VerificationToken", schema16);
|
|
1805
1924
|
|
|
1806
1925
|
// src/mongoose/vendor/Vendor.ts
|
|
1807
1926
|
import {
|
|
1808
1927
|
EnumEventDateStatus as EnumEventDateStatus5,
|
|
1809
1928
|
EnumVendorType
|
|
1810
1929
|
} from "@timardex/cluemart-shared";
|
|
1811
|
-
import
|
|
1812
|
-
var
|
|
1813
|
-
var vendorProductTypeSchema = new
|
|
1930
|
+
import mongoose22 from "mongoose";
|
|
1931
|
+
var MongooseSchema18 = mongoose22.Schema;
|
|
1932
|
+
var vendorProductTypeSchema = new MongooseSchema18(
|
|
1814
1933
|
{
|
|
1815
1934
|
description: { required: false, type: String },
|
|
1816
1935
|
name: { required: true, type: String },
|
|
@@ -1821,14 +1940,14 @@ var vendorProductTypeSchema = new MongooseSchema16(
|
|
|
1821
1940
|
},
|
|
1822
1941
|
{ timestamps: true }
|
|
1823
1942
|
);
|
|
1824
|
-
var productWrapperSchema = new
|
|
1943
|
+
var productWrapperSchema = new MongooseSchema18(
|
|
1825
1944
|
{
|
|
1826
1945
|
active: { default: false, required: false, type: Boolean },
|
|
1827
1946
|
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
1828
1947
|
},
|
|
1829
1948
|
{ _id: false }
|
|
1830
1949
|
);
|
|
1831
|
-
var calendarSchema = new
|
|
1950
|
+
var calendarSchema = new MongooseSchema18(
|
|
1832
1951
|
{
|
|
1833
1952
|
dateTime: {
|
|
1834
1953
|
dateStatus: {
|
|
@@ -1849,14 +1968,14 @@ var calendarSchema = new MongooseSchema16(
|
|
|
1849
1968
|
},
|
|
1850
1969
|
{ _id: false }
|
|
1851
1970
|
);
|
|
1852
|
-
var calendarWrapperSchema = new
|
|
1971
|
+
var calendarWrapperSchema = new MongooseSchema18(
|
|
1853
1972
|
{
|
|
1854
1973
|
active: { default: false, required: true, type: Boolean },
|
|
1855
1974
|
calendarData: { required: false, type: [calendarSchema] }
|
|
1856
1975
|
},
|
|
1857
1976
|
{ _id: false }
|
|
1858
1977
|
);
|
|
1859
|
-
var vendorAvailabilitySchema = new
|
|
1978
|
+
var vendorAvailabilitySchema = new MongooseSchema18(
|
|
1860
1979
|
{
|
|
1861
1980
|
corporate: { default: false, required: false, type: Boolean },
|
|
1862
1981
|
private: { default: false, required: false, type: Boolean },
|
|
@@ -1864,7 +1983,7 @@ var vendorAvailabilitySchema = new MongooseSchema16(
|
|
|
1864
1983
|
},
|
|
1865
1984
|
{ _id: false }
|
|
1866
1985
|
);
|
|
1867
|
-
var downgradeSnapshotSchema = new
|
|
1986
|
+
var downgradeSnapshotSchema = new MongooseSchema18(
|
|
1868
1987
|
{
|
|
1869
1988
|
availability: { required: false, type: vendorAvailabilitySchema },
|
|
1870
1989
|
calendarActive: { required: false, type: Boolean },
|
|
@@ -1872,7 +1991,7 @@ var downgradeSnapshotSchema = new MongooseSchema16(
|
|
|
1872
1991
|
},
|
|
1873
1992
|
{ _id: false }
|
|
1874
1993
|
);
|
|
1875
|
-
var
|
|
1994
|
+
var schema17 = new MongooseSchema18(
|
|
1876
1995
|
{
|
|
1877
1996
|
...baseResourceFields,
|
|
1878
1997
|
// Importing base resource fields from global.ts
|
|
@@ -1891,12 +2010,12 @@ var schema16 = new MongooseSchema16(
|
|
|
1891
2010
|
unregisteredVendorId: {
|
|
1892
2011
|
ref: "UnregisteredVendor",
|
|
1893
2012
|
required: false,
|
|
1894
|
-
type:
|
|
2013
|
+
type: mongoose22.Schema.Types.ObjectId
|
|
1895
2014
|
},
|
|
1896
2015
|
vendorInfoId: {
|
|
1897
2016
|
ref: "VendorInfo",
|
|
1898
2017
|
required: false,
|
|
1899
|
-
type:
|
|
2018
|
+
type: mongoose22.Schema.Types.ObjectId
|
|
1900
2019
|
},
|
|
1901
2020
|
vendorType: {
|
|
1902
2021
|
enum: Object.values(EnumVendorType),
|
|
@@ -1906,34 +2025,34 @@ var schema16 = new MongooseSchema16(
|
|
|
1906
2025
|
},
|
|
1907
2026
|
{ timestamps: true }
|
|
1908
2027
|
);
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
2028
|
+
schema17.index({ name: 1 });
|
|
2029
|
+
schema17.index({ description: 1 });
|
|
2030
|
+
schema17.index({ region: 1 });
|
|
2031
|
+
schema17.index({ "categories.name": 1 });
|
|
2032
|
+
schema17.index({ slug: 1 });
|
|
2033
|
+
schema17.index({
|
|
1915
2034
|
categoriesNames: "text",
|
|
1916
2035
|
description: "text",
|
|
1917
2036
|
name: "text"
|
|
1918
2037
|
});
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
var VendorModel =
|
|
2038
|
+
schema17.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2039
|
+
schema17.plugin(searchNamePlugin);
|
|
2040
|
+
var VendorModel = mongoose22.models.Vendor || mongoose22.model("Vendor", schema17);
|
|
1922
2041
|
|
|
1923
2042
|
// src/mongoose/vendor/VendorInfo.ts
|
|
1924
2043
|
import {
|
|
1925
2044
|
EnumFoodFlavor
|
|
1926
2045
|
} from "@timardex/cluemart-shared";
|
|
1927
|
-
import
|
|
1928
|
-
var
|
|
1929
|
-
var AttributesSchema = new
|
|
2046
|
+
import mongoose23 from "mongoose";
|
|
2047
|
+
var MongooseSchema19 = mongoose23.Schema;
|
|
2048
|
+
var AttributesSchema = new MongooseSchema19(
|
|
1930
2049
|
{
|
|
1931
2050
|
details: { required: false, type: String },
|
|
1932
2051
|
isRequired: { default: false, required: true, type: Boolean }
|
|
1933
2052
|
},
|
|
1934
2053
|
{ _id: false }
|
|
1935
2054
|
);
|
|
1936
|
-
var
|
|
2055
|
+
var schema18 = new MongooseSchema19(
|
|
1937
2056
|
{
|
|
1938
2057
|
active: { default: true, type: Boolean },
|
|
1939
2058
|
compliance: {
|
|
@@ -1968,29 +2087,29 @@ var schema17 = new MongooseSchema17(
|
|
|
1968
2087
|
vendorId: {
|
|
1969
2088
|
ref: "Vendor",
|
|
1970
2089
|
required: true,
|
|
1971
|
-
type:
|
|
2090
|
+
type: mongoose23.Schema.Types.ObjectId
|
|
1972
2091
|
}
|
|
1973
2092
|
},
|
|
1974
2093
|
{ timestamps: true }
|
|
1975
2094
|
);
|
|
1976
|
-
|
|
1977
|
-
var VendorInfoModel =
|
|
2095
|
+
schema18.index({ vendorId: 1 });
|
|
2096
|
+
var VendorInfoModel = mongoose23.models.VendorInfo || mongoose23.model("VendorInfo", schema18);
|
|
1978
2097
|
|
|
1979
2098
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
1980
|
-
import
|
|
1981
|
-
var
|
|
1982
|
-
var invitationSchema = new
|
|
2099
|
+
import mongoose24 from "mongoose";
|
|
2100
|
+
var MongooseSchema20 = mongoose24.Schema;
|
|
2101
|
+
var invitationSchema = new MongooseSchema20(
|
|
1983
2102
|
{
|
|
1984
2103
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
1985
2104
|
inviterId: {
|
|
1986
2105
|
ref: "Event",
|
|
1987
2106
|
required: true,
|
|
1988
|
-
type:
|
|
2107
|
+
type: mongoose24.Schema.Types.ObjectId
|
|
1989
2108
|
}
|
|
1990
2109
|
},
|
|
1991
2110
|
{ _id: false }
|
|
1992
2111
|
);
|
|
1993
|
-
var
|
|
2112
|
+
var schema19 = new MongooseSchema20(
|
|
1994
2113
|
{
|
|
1995
2114
|
active: { default: true, required: true, type: Boolean },
|
|
1996
2115
|
categoryIds: { required: true, type: [String] },
|
|
@@ -1999,7 +2118,7 @@ var schema18 = new MongooseSchema18(
|
|
|
1999
2118
|
claimedByUserId: {
|
|
2000
2119
|
ref: "User",
|
|
2001
2120
|
required: false,
|
|
2002
|
-
type:
|
|
2121
|
+
type: mongoose24.Schema.Types.ObjectId
|
|
2003
2122
|
},
|
|
2004
2123
|
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
2005
2124
|
claimToken: { default: null, required: false, type: String },
|
|
@@ -2012,15 +2131,15 @@ var schema18 = new MongooseSchema18(
|
|
|
2012
2131
|
},
|
|
2013
2132
|
{ timestamps: true }
|
|
2014
2133
|
);
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
var UnregisteredVendorModel =
|
|
2134
|
+
schema19.index({ name: 1 });
|
|
2135
|
+
schema19.index({ email: 1 });
|
|
2136
|
+
var UnregisteredVendorModel = mongoose24.models.UnregisteredVendor || mongoose24.model("UnregisteredVendor", schema19);
|
|
2018
2137
|
|
|
2019
2138
|
// src/mongoose/event/Event.ts
|
|
2020
2139
|
import { EnumEventType as EnumEventType3 } from "@timardex/cluemart-shared";
|
|
2021
|
-
import
|
|
2022
|
-
var
|
|
2023
|
-
var
|
|
2140
|
+
import mongoose25 from "mongoose";
|
|
2141
|
+
var MongooseSchema21 = mongoose25.Schema;
|
|
2142
|
+
var schema20 = new MongooseSchema21(
|
|
2024
2143
|
{
|
|
2025
2144
|
...baseResourceFields,
|
|
2026
2145
|
// Importing base resource fields from global.ts
|
|
@@ -2029,7 +2148,7 @@ var schema19 = new MongooseSchema19(
|
|
|
2029
2148
|
eventInfoId: {
|
|
2030
2149
|
ref: "EventInfo",
|
|
2031
2150
|
required: false,
|
|
2032
|
-
type:
|
|
2151
|
+
type: mongoose25.Schema.Types.ObjectId
|
|
2033
2152
|
},
|
|
2034
2153
|
eventType: {
|
|
2035
2154
|
enum: Object.values(EnumEventType3),
|
|
@@ -2053,40 +2172,40 @@ var schema19 = new MongooseSchema19(
|
|
|
2053
2172
|
},
|
|
2054
2173
|
{ timestamps: true }
|
|
2055
2174
|
);
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
var EventModel =
|
|
2175
|
+
schema20.index({ name: 1 });
|
|
2176
|
+
schema20.index({ description: 1 });
|
|
2177
|
+
schema20.index({ region: 1 });
|
|
2178
|
+
schema20.index({ "location.geo": "2dsphere" });
|
|
2179
|
+
schema20.index({ tags: 1 });
|
|
2180
|
+
schema20.index({ deletedAt: 1 });
|
|
2181
|
+
schema20.index({ "dateTime.dateStatus": 1 });
|
|
2182
|
+
schema20.index({ slug: 1 });
|
|
2183
|
+
schema20.index({ description: "text", name: "text", tags: "text" });
|
|
2184
|
+
schema20.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2185
|
+
schema20.plugin(searchNamePlugin);
|
|
2186
|
+
var EventModel = mongoose25.models.Event || mongoose25.model("Event", schema20);
|
|
2068
2187
|
|
|
2069
2188
|
// src/mongoose/event/EventDateArchive.ts
|
|
2070
|
-
import
|
|
2071
|
-
var
|
|
2189
|
+
import mongoose26 from "mongoose";
|
|
2190
|
+
var schema21 = new mongoose26.Schema(
|
|
2072
2191
|
{
|
|
2073
2192
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
2074
2193
|
eventId: {
|
|
2075
2194
|
ref: "Event",
|
|
2076
2195
|
required: true,
|
|
2077
|
-
type:
|
|
2196
|
+
type: mongoose26.Schema.Types.ObjectId
|
|
2078
2197
|
}
|
|
2079
2198
|
},
|
|
2080
2199
|
{ timestamps: true }
|
|
2081
2200
|
);
|
|
2082
|
-
|
|
2083
|
-
var EventDateArchiveModel =
|
|
2201
|
+
schema21.index({ eventId: 1 }, { unique: true });
|
|
2202
|
+
var EventDateArchiveModel = mongoose26.models.EventDateArchive || mongoose26.model("EventDateArchive", schema21);
|
|
2084
2203
|
|
|
2085
2204
|
// src/mongoose/Partner.ts
|
|
2086
2205
|
import { EnumPartnerType } from "@timardex/cluemart-shared";
|
|
2087
|
-
import
|
|
2088
|
-
var
|
|
2089
|
-
var
|
|
2206
|
+
import mongoose27 from "mongoose";
|
|
2207
|
+
var MongooseSchema22 = mongoose27.Schema;
|
|
2208
|
+
var schema22 = new MongooseSchema22(
|
|
2090
2209
|
{
|
|
2091
2210
|
...baseResourceFields,
|
|
2092
2211
|
location: {
|
|
@@ -2102,15 +2221,15 @@ var schema21 = new MongooseSchema20(
|
|
|
2102
2221
|
},
|
|
2103
2222
|
{ timestamps: true }
|
|
2104
2223
|
);
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
var PartnerModel =
|
|
2224
|
+
schema22.index({ name: 1 });
|
|
2225
|
+
schema22.index({ description: 1 });
|
|
2226
|
+
schema22.index({ region: 1 });
|
|
2227
|
+
schema22.index({ "location.geo": "2dsphere" });
|
|
2228
|
+
schema22.index({ slug: 1 });
|
|
2229
|
+
schema22.index({ name: "text", description: "text" });
|
|
2230
|
+
schema22.index({ "owner.userId": 1, deletedAt: 1 });
|
|
2231
|
+
schema22.plugin(searchNamePlugin);
|
|
2232
|
+
var PartnerModel = mongoose27.models.Partner || mongoose27.model("Partner", schema22);
|
|
2114
2233
|
|
|
2115
2234
|
// src/mongoose/Post.ts
|
|
2116
2235
|
import {
|
|
@@ -2118,9 +2237,9 @@ import {
|
|
|
2118
2237
|
EnumPostType as EnumPostType2,
|
|
2119
2238
|
EnumResourceType as EnumResourceType5
|
|
2120
2239
|
} from "@timardex/cluemart-shared";
|
|
2121
|
-
import
|
|
2122
|
-
var
|
|
2123
|
-
var contentSchema = new
|
|
2240
|
+
import mongoose28, { Schema } from "mongoose";
|
|
2241
|
+
var MongooseSchema23 = mongoose28.Schema;
|
|
2242
|
+
var contentSchema = new MongooseSchema23(
|
|
2124
2243
|
{
|
|
2125
2244
|
contentData: Schema.Types.Mixed,
|
|
2126
2245
|
contentOrder: { required: true, type: Number },
|
|
@@ -2132,7 +2251,7 @@ var contentSchema = new MongooseSchema21(
|
|
|
2132
2251
|
},
|
|
2133
2252
|
{ _id: false }
|
|
2134
2253
|
);
|
|
2135
|
-
var resourceSchema = new
|
|
2254
|
+
var resourceSchema = new MongooseSchema23(
|
|
2136
2255
|
{
|
|
2137
2256
|
resourceId: { required: true, type: String },
|
|
2138
2257
|
resourceRegion: { required: true, type: String },
|
|
@@ -2145,7 +2264,7 @@ var resourceSchema = new MongooseSchema21(
|
|
|
2145
2264
|
},
|
|
2146
2265
|
{ _id: false }
|
|
2147
2266
|
);
|
|
2148
|
-
var
|
|
2267
|
+
var schema23 = new MongooseSchema23(
|
|
2149
2268
|
{
|
|
2150
2269
|
active: { default: false, required: true, type: Boolean },
|
|
2151
2270
|
approvedAt: { default: null, required: false, type: Date },
|
|
@@ -2176,16 +2295,16 @@ var schema22 = new MongooseSchema21(
|
|
|
2176
2295
|
},
|
|
2177
2296
|
{ timestamps: true }
|
|
2178
2297
|
);
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
var PostModel =
|
|
2298
|
+
schema23.index({ title: 1 });
|
|
2299
|
+
schema23.index({ tags: 1 });
|
|
2300
|
+
schema23.index({ postType: 1, slug: 1 }, { unique: true });
|
|
2301
|
+
var PostModel = mongoose28.models.Post || mongoose28.model("Post", schema23);
|
|
2183
2302
|
|
|
2184
2303
|
// src/mongoose/AppSetting.ts
|
|
2185
|
-
import
|
|
2186
|
-
var
|
|
2304
|
+
import mongoose29 from "mongoose";
|
|
2305
|
+
var MongooseSchema24 = mongoose29.Schema;
|
|
2187
2306
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
2188
|
-
var AppSettingSchema = new
|
|
2307
|
+
var AppSettingSchema = new MongooseSchema24(
|
|
2189
2308
|
{
|
|
2190
2309
|
activeSchoolsStudentCountTotal: {
|
|
2191
2310
|
default: 0,
|
|
@@ -2207,8 +2326,8 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2207
2326
|
validate: Number.isInteger
|
|
2208
2327
|
},
|
|
2209
2328
|
mobileDisplayEnabled: { default: false, required: true, type: Boolean },
|
|
2210
|
-
purchasePricing: { type:
|
|
2211
|
-
regionPricing: { type:
|
|
2329
|
+
purchasePricing: { type: MongooseSchema24.Types.Mixed },
|
|
2330
|
+
regionPricing: { type: MongooseSchema24.Types.Mixed },
|
|
2212
2331
|
paidSlotsPerPlacement: { enum: [30], type: Number },
|
|
2213
2332
|
reservedSlotsPerPlacement: { enum: [7], type: Number },
|
|
2214
2333
|
rotationSeconds: { enum: [8], type: Number },
|
|
@@ -2233,12 +2352,12 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2233
2352
|
},
|
|
2234
2353
|
{ timestamps: true }
|
|
2235
2354
|
);
|
|
2236
|
-
var AppSettingModel =
|
|
2355
|
+
var AppSettingModel = mongoose29.models.AppSetting || mongoose29.model("AppSetting", AppSettingSchema);
|
|
2237
2356
|
|
|
2238
2357
|
// src/mongoose/AuthHandoffToken.ts
|
|
2239
|
-
import
|
|
2240
|
-
var
|
|
2241
|
-
var
|
|
2358
|
+
import mongoose30 from "mongoose";
|
|
2359
|
+
var MongooseSchema25 = mongoose30.Schema;
|
|
2360
|
+
var schema24 = new MongooseSchema25(
|
|
2242
2361
|
{
|
|
2243
2362
|
expiresAt: { required: true, type: Date },
|
|
2244
2363
|
jti: { index: true, required: true, type: String, unique: true },
|
|
@@ -2247,28 +2366,28 @@ var schema23 = new MongooseSchema23(
|
|
|
2247
2366
|
index: true,
|
|
2248
2367
|
ref: "User",
|
|
2249
2368
|
required: true,
|
|
2250
|
-
type:
|
|
2369
|
+
type: mongoose30.Schema.Types.ObjectId
|
|
2251
2370
|
}
|
|
2252
2371
|
},
|
|
2253
2372
|
{ timestamps: true }
|
|
2254
2373
|
);
|
|
2255
|
-
|
|
2256
|
-
var AuthHandoffTokenModel =
|
|
2374
|
+
schema24.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2375
|
+
var AuthHandoffTokenModel = mongoose30.models.AuthHandoffToken || mongoose30.model("AuthHandoffToken", schema24);
|
|
2257
2376
|
|
|
2258
2377
|
// src/mongoose/game/Game.ts
|
|
2259
2378
|
import {
|
|
2260
2379
|
EnumGameStatus,
|
|
2261
2380
|
EnumGameType
|
|
2262
2381
|
} from "@timardex/cluemart-shared";
|
|
2263
|
-
import
|
|
2382
|
+
import mongoose34 from "mongoose";
|
|
2264
2383
|
|
|
2265
2384
|
// src/mongoose/game/DailyClue.ts
|
|
2266
|
-
import
|
|
2385
|
+
import mongoose32 from "mongoose";
|
|
2267
2386
|
|
|
2268
2387
|
// src/mongoose/game/utils.ts
|
|
2269
|
-
import
|
|
2270
|
-
var
|
|
2271
|
-
var schemaGameDate = new
|
|
2388
|
+
import mongoose31 from "mongoose";
|
|
2389
|
+
var MongooseSchema26 = mongoose31.Schema;
|
|
2390
|
+
var schemaGameDate = new MongooseSchema26(
|
|
2272
2391
|
{
|
|
2273
2392
|
endDate: { required: true, type: Date },
|
|
2274
2393
|
startDate: { required: true, type: Date }
|
|
@@ -2277,8 +2396,8 @@ var schemaGameDate = new MongooseSchema24(
|
|
|
2277
2396
|
);
|
|
2278
2397
|
|
|
2279
2398
|
// src/mongoose/game/DailyClue.ts
|
|
2280
|
-
var
|
|
2281
|
-
var schemaLetters = new
|
|
2399
|
+
var MongooseSchema27 = mongoose32.Schema;
|
|
2400
|
+
var schemaLetters = new MongooseSchema27(
|
|
2282
2401
|
{
|
|
2283
2402
|
collected: { required: false, type: [String] },
|
|
2284
2403
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -2286,14 +2405,14 @@ var schemaLetters = new MongooseSchema25(
|
|
|
2286
2405
|
},
|
|
2287
2406
|
{ _id: false }
|
|
2288
2407
|
);
|
|
2289
|
-
var schemaDailyClueBaseGame = new
|
|
2408
|
+
var schemaDailyClueBaseGame = new MongooseSchema27(
|
|
2290
2409
|
{
|
|
2291
2410
|
gameDate: { required: true, type: schemaGameDate },
|
|
2292
2411
|
gameSolution: { required: true, type: String }
|
|
2293
2412
|
},
|
|
2294
2413
|
{ _id: false }
|
|
2295
2414
|
);
|
|
2296
|
-
var schemaDailyClueGameData = new
|
|
2415
|
+
var schemaDailyClueGameData = new MongooseSchema27(
|
|
2297
2416
|
{
|
|
2298
2417
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
2299
2418
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -2308,9 +2427,9 @@ var schemaDailyClueGameData = new MongooseSchema25(
|
|
|
2308
2427
|
);
|
|
2309
2428
|
|
|
2310
2429
|
// src/mongoose/game/PuzzleGame.ts
|
|
2311
|
-
import
|
|
2312
|
-
var
|
|
2313
|
-
var schemaPuzzleAnswer = new
|
|
2430
|
+
import mongoose33 from "mongoose";
|
|
2431
|
+
var MongooseSchema28 = mongoose33.Schema;
|
|
2432
|
+
var schemaPuzzleAnswer = new MongooseSchema28(
|
|
2314
2433
|
{
|
|
2315
2434
|
answer: { required: true, type: String },
|
|
2316
2435
|
answerId: { required: true, type: String },
|
|
@@ -2318,7 +2437,7 @@ var schemaPuzzleAnswer = new MongooseSchema26(
|
|
|
2318
2437
|
},
|
|
2319
2438
|
{ _id: false }
|
|
2320
2439
|
);
|
|
2321
|
-
var schemaPuzzleQuestion = new
|
|
2440
|
+
var schemaPuzzleQuestion = new MongooseSchema28(
|
|
2322
2441
|
{
|
|
2323
2442
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
2324
2443
|
question: { required: true, type: String },
|
|
@@ -2326,20 +2445,20 @@ var schemaPuzzleQuestion = new MongooseSchema26(
|
|
|
2326
2445
|
},
|
|
2327
2446
|
{ _id: false }
|
|
2328
2447
|
);
|
|
2329
|
-
var schemaPuzzleBaseGame = new
|
|
2448
|
+
var schemaPuzzleBaseGame = new MongooseSchema28(
|
|
2330
2449
|
{
|
|
2331
2450
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
2332
2451
|
},
|
|
2333
2452
|
{ _id: false }
|
|
2334
2453
|
);
|
|
2335
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
2454
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema28(
|
|
2336
2455
|
{
|
|
2337
2456
|
questionId: { required: true, type: String },
|
|
2338
2457
|
selectedAnswerId: { required: true, type: String }
|
|
2339
2458
|
},
|
|
2340
2459
|
{ _id: false }
|
|
2341
2460
|
);
|
|
2342
|
-
var schemaPuzzleGameData = new
|
|
2461
|
+
var schemaPuzzleGameData = new MongooseSchema28(
|
|
2343
2462
|
{
|
|
2344
2463
|
answeredQuestions: {
|
|
2345
2464
|
default: null,
|
|
@@ -2354,19 +2473,19 @@ var schemaPuzzleGameData = new MongooseSchema26(
|
|
|
2354
2473
|
);
|
|
2355
2474
|
|
|
2356
2475
|
// src/mongoose/game/Game.ts
|
|
2357
|
-
var
|
|
2476
|
+
var MongooseSchema29 = mongoose34.Schema;
|
|
2358
2477
|
var gameDataSchemas = {
|
|
2359
2478
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2360
2479
|
[EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2361
2480
|
[EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2362
2481
|
};
|
|
2363
2482
|
var gameDataDefinition = Object.fromEntries(
|
|
2364
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2483
|
+
Object.entries(gameDataSchemas).map(([key, schema29]) => [
|
|
2365
2484
|
key,
|
|
2366
|
-
{ default: null, required: false, type:
|
|
2485
|
+
{ default: null, required: false, type: schema29 }
|
|
2367
2486
|
])
|
|
2368
2487
|
);
|
|
2369
|
-
var gameHistorySchema = new
|
|
2488
|
+
var gameHistorySchema = new MongooseSchema29(
|
|
2370
2489
|
{
|
|
2371
2490
|
createdAt: { required: true, type: Date },
|
|
2372
2491
|
gameDate: { required: true, type: schemaGameDate },
|
|
@@ -2386,7 +2505,7 @@ var gameHistorySchema = new MongooseSchema27(
|
|
|
2386
2505
|
},
|
|
2387
2506
|
{ _id: false }
|
|
2388
2507
|
);
|
|
2389
|
-
var gameTypeSchema = new
|
|
2508
|
+
var gameTypeSchema = new MongooseSchema29(
|
|
2390
2509
|
{
|
|
2391
2510
|
active: { default: true, required: true, type: Boolean },
|
|
2392
2511
|
gameData: gameDataDefinition,
|
|
@@ -2404,7 +2523,7 @@ var gameTypeSchema = new MongooseSchema27(
|
|
|
2404
2523
|
},
|
|
2405
2524
|
{ timestamps: true }
|
|
2406
2525
|
);
|
|
2407
|
-
var
|
|
2526
|
+
var schema25 = new MongooseSchema29(
|
|
2408
2527
|
{
|
|
2409
2528
|
active: { default: false, required: true, type: Boolean },
|
|
2410
2529
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2417,12 +2536,12 @@ var schema24 = new MongooseSchema27(
|
|
|
2417
2536
|
},
|
|
2418
2537
|
{ timestamps: true }
|
|
2419
2538
|
);
|
|
2420
|
-
var GameModel =
|
|
2539
|
+
var GameModel = mongoose34.models.Game || mongoose34.model("Game", schema25);
|
|
2421
2540
|
|
|
2422
2541
|
// src/mongoose/School.ts
|
|
2423
|
-
import
|
|
2424
|
-
var
|
|
2425
|
-
var campaignsSchema = new
|
|
2542
|
+
import mongoose35 from "mongoose";
|
|
2543
|
+
var MongooseSchema30 = mongoose35.Schema;
|
|
2544
|
+
var campaignsSchema = new MongooseSchema30(
|
|
2426
2545
|
{
|
|
2427
2546
|
endDate: { required: true, type: Date },
|
|
2428
2547
|
name: { required: true, type: String },
|
|
@@ -2430,7 +2549,7 @@ var campaignsSchema = new MongooseSchema28(
|
|
|
2430
2549
|
},
|
|
2431
2550
|
{ _id: false }
|
|
2432
2551
|
);
|
|
2433
|
-
var
|
|
2552
|
+
var schema26 = new MongooseSchema30(
|
|
2434
2553
|
{
|
|
2435
2554
|
// New schools are active by default
|
|
2436
2555
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2457,14 +2576,14 @@ var schema25 = new MongooseSchema28(
|
|
|
2457
2576
|
},
|
|
2458
2577
|
{ timestamps: true }
|
|
2459
2578
|
);
|
|
2460
|
-
|
|
2579
|
+
schema26.index(
|
|
2461
2580
|
{ schoolCode: 1 },
|
|
2462
2581
|
{
|
|
2463
2582
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2464
2583
|
unique: true
|
|
2465
2584
|
}
|
|
2466
2585
|
);
|
|
2467
|
-
var SchoolModel =
|
|
2586
|
+
var SchoolModel = mongoose35.models.School || mongoose35.model("School", schema26);
|
|
2468
2587
|
|
|
2469
2588
|
// src/mongoose/Affiliate.ts
|
|
2470
2589
|
import {
|
|
@@ -2472,9 +2591,9 @@ import {
|
|
|
2472
2591
|
EnumAffiliateRewardType,
|
|
2473
2592
|
EnumResourceType as EnumResourceType6
|
|
2474
2593
|
} from "@timardex/cluemart-shared";
|
|
2475
|
-
import
|
|
2476
|
-
var
|
|
2477
|
-
var affiliateRewardSchema = new
|
|
2594
|
+
import mongoose36 from "mongoose";
|
|
2595
|
+
var MongooseSchema31 = mongoose36.Schema;
|
|
2596
|
+
var affiliateRewardSchema = new MongooseSchema31(
|
|
2478
2597
|
{
|
|
2479
2598
|
createdAt: { required: true, type: Date },
|
|
2480
2599
|
redeemedAt: { default: null, required: false, type: Date },
|
|
@@ -2488,13 +2607,13 @@ var affiliateRewardSchema = new MongooseSchema29(
|
|
|
2488
2607
|
},
|
|
2489
2608
|
{ _id: false }
|
|
2490
2609
|
);
|
|
2491
|
-
var affiliateResourceSchema = new
|
|
2610
|
+
var affiliateResourceSchema = new MongooseSchema31(
|
|
2492
2611
|
{
|
|
2493
2612
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
2494
2613
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2495
2614
|
resourceId: {
|
|
2496
2615
|
required: true,
|
|
2497
|
-
type:
|
|
2616
|
+
type: mongoose36.Schema.Types.ObjectId
|
|
2498
2617
|
},
|
|
2499
2618
|
resourceName: { required: true, type: String },
|
|
2500
2619
|
resourceOwner: {
|
|
@@ -2514,20 +2633,20 @@ var affiliateResourceSchema = new MongooseSchema29(
|
|
|
2514
2633
|
},
|
|
2515
2634
|
{ _id: false }
|
|
2516
2635
|
);
|
|
2517
|
-
var affiliateContactDetailsSchema = new
|
|
2636
|
+
var affiliateContactDetailsSchema = new MongooseSchema31(
|
|
2518
2637
|
{
|
|
2519
2638
|
mobilePhone: { required: true, type: String }
|
|
2520
2639
|
},
|
|
2521
2640
|
{ _id: false }
|
|
2522
2641
|
);
|
|
2523
|
-
var affiliateBankAccountDetailsSchema = new
|
|
2642
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema31(
|
|
2524
2643
|
{
|
|
2525
2644
|
accountHolderName: { required: true, type: String },
|
|
2526
2645
|
accountNumber: { required: true, type: String }
|
|
2527
2646
|
},
|
|
2528
2647
|
{ _id: false }
|
|
2529
2648
|
);
|
|
2530
|
-
var affiliateDetailsSchema = new
|
|
2649
|
+
var affiliateDetailsSchema = new MongooseSchema31(
|
|
2531
2650
|
{
|
|
2532
2651
|
bankAccountDetails: {
|
|
2533
2652
|
required: true,
|
|
@@ -2549,7 +2668,7 @@ var affiliateDetailsSchema = new MongooseSchema29(
|
|
|
2549
2668
|
},
|
|
2550
2669
|
{ _id: false }
|
|
2551
2670
|
);
|
|
2552
|
-
var redeemHistorySchema = new
|
|
2671
|
+
var redeemHistorySchema = new MongooseSchema31(
|
|
2553
2672
|
{
|
|
2554
2673
|
paidAt: { default: null, required: false, type: Date },
|
|
2555
2674
|
redeemedAt: { required: true, type: Date },
|
|
@@ -2557,7 +2676,7 @@ var redeemHistorySchema = new MongooseSchema29(
|
|
|
2557
2676
|
},
|
|
2558
2677
|
{ _id: false }
|
|
2559
2678
|
);
|
|
2560
|
-
var
|
|
2679
|
+
var schema27 = new MongooseSchema31(
|
|
2561
2680
|
{
|
|
2562
2681
|
active: { default: false, required: true, type: Boolean },
|
|
2563
2682
|
affiliateBonusRewards: {
|
|
@@ -2587,23 +2706,23 @@ var schema26 = new MongooseSchema29(
|
|
|
2587
2706
|
},
|
|
2588
2707
|
{ timestamps: true }
|
|
2589
2708
|
);
|
|
2590
|
-
|
|
2709
|
+
schema27.index(
|
|
2591
2710
|
{ affiliateCode: 1 },
|
|
2592
2711
|
{
|
|
2593
2712
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2594
2713
|
unique: true
|
|
2595
2714
|
}
|
|
2596
2715
|
);
|
|
2597
|
-
var AffiliateModel =
|
|
2716
|
+
var AffiliateModel = mongoose36.models.Affiliate || mongoose36.model("Affiliate", schema27);
|
|
2598
2717
|
|
|
2599
2718
|
// src/mongoose/Coupon.ts
|
|
2600
2719
|
import {
|
|
2601
2720
|
EnumCouponQualificationType,
|
|
2602
2721
|
EnumResourceType as EnumResourceType7
|
|
2603
2722
|
} from "@timardex/cluemart-shared";
|
|
2604
|
-
import
|
|
2605
|
-
var
|
|
2606
|
-
var couponOptionSchema = new
|
|
2723
|
+
import mongoose37 from "mongoose";
|
|
2724
|
+
var MongooseSchema32 = mongoose37.Schema;
|
|
2725
|
+
var couponOptionSchema = new MongooseSchema32(
|
|
2607
2726
|
{
|
|
2608
2727
|
buy: { required: false, type: Number },
|
|
2609
2728
|
get: { required: false, type: Number },
|
|
@@ -2618,29 +2737,29 @@ var couponOptionSchema = new MongooseSchema30(
|
|
|
2618
2737
|
},
|
|
2619
2738
|
{ _id: false }
|
|
2620
2739
|
);
|
|
2621
|
-
var couponVendorProductSchema = new
|
|
2740
|
+
var couponVendorProductSchema = new MongooseSchema32(
|
|
2622
2741
|
{
|
|
2623
2742
|
couponId: {
|
|
2624
2743
|
required: true,
|
|
2625
|
-
type:
|
|
2744
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2626
2745
|
},
|
|
2627
2746
|
productId: {
|
|
2628
2747
|
required: true,
|
|
2629
|
-
type:
|
|
2748
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2630
2749
|
},
|
|
2631
2750
|
vendorCouponId: {
|
|
2632
2751
|
required: false,
|
|
2633
|
-
type:
|
|
2752
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2634
2753
|
},
|
|
2635
2754
|
vendorId: {
|
|
2636
2755
|
ref: "Vendor",
|
|
2637
2756
|
required: true,
|
|
2638
|
-
type:
|
|
2757
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2639
2758
|
}
|
|
2640
2759
|
},
|
|
2641
2760
|
{ _id: false }
|
|
2642
2761
|
);
|
|
2643
|
-
var couponCodeSchema = new
|
|
2762
|
+
var couponCodeSchema = new MongooseSchema32(
|
|
2644
2763
|
{
|
|
2645
2764
|
code: { required: true, type: String },
|
|
2646
2765
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -2648,7 +2767,7 @@ var couponCodeSchema = new MongooseSchema30(
|
|
|
2648
2767
|
},
|
|
2649
2768
|
{ _id: false }
|
|
2650
2769
|
);
|
|
2651
|
-
var couponParticipantUserSchema = new
|
|
2770
|
+
var couponParticipantUserSchema = new MongooseSchema32(
|
|
2652
2771
|
{
|
|
2653
2772
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2654
2773
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -2657,12 +2776,12 @@ var couponParticipantUserSchema = new MongooseSchema30(
|
|
|
2657
2776
|
userId: {
|
|
2658
2777
|
ref: "User",
|
|
2659
2778
|
required: true,
|
|
2660
|
-
type:
|
|
2779
|
+
type: mongoose37.Schema.Types.ObjectId
|
|
2661
2780
|
}
|
|
2662
2781
|
},
|
|
2663
2782
|
{ timestamps: true }
|
|
2664
2783
|
);
|
|
2665
|
-
var couponDataSchema = new
|
|
2784
|
+
var couponDataSchema = new MongooseSchema32(
|
|
2666
2785
|
{
|
|
2667
2786
|
active: { default: true, required: true, type: Boolean },
|
|
2668
2787
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -2689,7 +2808,7 @@ var couponDataSchema = new MongooseSchema30(
|
|
|
2689
2808
|
},
|
|
2690
2809
|
{ timestamps: true }
|
|
2691
2810
|
);
|
|
2692
|
-
var
|
|
2811
|
+
var schema28 = new MongooseSchema32(
|
|
2693
2812
|
{
|
|
2694
2813
|
active: { default: true, required: true, type: Boolean },
|
|
2695
2814
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2701,62 +2820,62 @@ var schema27 = new MongooseSchema30(
|
|
|
2701
2820
|
},
|
|
2702
2821
|
{ timestamps: true }
|
|
2703
2822
|
);
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
var CouponModel =
|
|
2823
|
+
schema28.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2824
|
+
schema28.index({ "couponData.participantUsers.userId": 1 });
|
|
2825
|
+
var CouponModel = mongoose37.models.Coupon || mongoose37.model("Coupon", schema28);
|
|
2707
2826
|
|
|
2708
2827
|
// src/mongoose/Impersonation.ts
|
|
2709
2828
|
import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
|
|
2710
|
-
import
|
|
2711
|
-
var
|
|
2712
|
-
var impersonationSessionSchema = new
|
|
2829
|
+
import mongoose38 from "mongoose";
|
|
2830
|
+
var MongooseSchema33 = mongoose38.Schema;
|
|
2831
|
+
var impersonationSessionSchema = new MongooseSchema33(
|
|
2713
2832
|
{
|
|
2714
2833
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
2715
2834
|
impersonatedUserId: {
|
|
2716
2835
|
index: true,
|
|
2717
2836
|
ref: "User",
|
|
2718
2837
|
required: true,
|
|
2719
|
-
type:
|
|
2838
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2720
2839
|
},
|
|
2721
2840
|
impersonatorUserId: {
|
|
2722
2841
|
index: true,
|
|
2723
2842
|
ref: "User",
|
|
2724
2843
|
required: true,
|
|
2725
|
-
type:
|
|
2844
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2726
2845
|
},
|
|
2727
2846
|
refreshToken: { required: true, type: String }
|
|
2728
2847
|
},
|
|
2729
2848
|
{ timestamps: true }
|
|
2730
2849
|
);
|
|
2731
|
-
var ImpersonationSessionModel =
|
|
2850
|
+
var ImpersonationSessionModel = mongoose38.models.ImpersonationSession || mongoose38.model(
|
|
2732
2851
|
"ImpersonationSession",
|
|
2733
2852
|
impersonationSessionSchema
|
|
2734
2853
|
);
|
|
2735
|
-
var impersonationAuditSchema = new
|
|
2854
|
+
var impersonationAuditSchema = new MongooseSchema33(
|
|
2736
2855
|
{
|
|
2737
2856
|
action: { enum: ["start", "end"], required: true, type: String },
|
|
2738
2857
|
endReason: { type: String },
|
|
2739
2858
|
impersonatedUserId: {
|
|
2740
2859
|
ref: "User",
|
|
2741
2860
|
required: true,
|
|
2742
|
-
type:
|
|
2861
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2743
2862
|
},
|
|
2744
2863
|
impersonatorUserId: {
|
|
2745
2864
|
ref: "User",
|
|
2746
2865
|
required: true,
|
|
2747
|
-
type:
|
|
2866
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2748
2867
|
},
|
|
2749
|
-
resourceId: { type:
|
|
2868
|
+
resourceId: { type: mongoose38.Schema.Types.ObjectId },
|
|
2750
2869
|
resourceType: { enum: Object.values(EnumResourceType8), type: String },
|
|
2751
2870
|
sessionId: {
|
|
2752
2871
|
ref: "ImpersonationSession",
|
|
2753
2872
|
required: true,
|
|
2754
|
-
type:
|
|
2873
|
+
type: mongoose38.Schema.Types.ObjectId
|
|
2755
2874
|
}
|
|
2756
2875
|
},
|
|
2757
2876
|
{ timestamps: true }
|
|
2758
2877
|
);
|
|
2759
|
-
var ImpersonationAuditModel =
|
|
2878
|
+
var ImpersonationAuditModel = mongoose38.models.ImpersonationAudit || mongoose38.model(
|
|
2760
2879
|
"ImpersonationAudit",
|
|
2761
2880
|
impersonationAuditSchema
|
|
2762
2881
|
);
|
|
@@ -3200,7 +3319,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
3200
3319
|
}
|
|
3201
3320
|
|
|
3202
3321
|
// src/service/database.ts
|
|
3203
|
-
import
|
|
3322
|
+
import mongoose39 from "mongoose";
|
|
3204
3323
|
var connectToDatabase = async ({
|
|
3205
3324
|
appName,
|
|
3206
3325
|
dbName,
|
|
@@ -3213,7 +3332,7 @@ var connectToDatabase = async ({
|
|
|
3213
3332
|
// Fallback to MongoDB Atlas connection string
|
|
3214
3333
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
3215
3334
|
);
|
|
3216
|
-
await
|
|
3335
|
+
await mongoose39.connect(mongoUri);
|
|
3217
3336
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
3218
3337
|
console.log(
|
|
3219
3338
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -3226,7 +3345,7 @@ var connectToDatabase = async ({
|
|
|
3226
3345
|
|
|
3227
3346
|
// src/types/index.ts
|
|
3228
3347
|
import express from "express";
|
|
3229
|
-
import
|
|
3348
|
+
import mongoose40 from "mongoose";
|
|
3230
3349
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
3231
3350
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
3232
3351
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -3348,15 +3467,15 @@ async function updateAdStatuses() {
|
|
|
3348
3467
|
}
|
|
3349
3468
|
|
|
3350
3469
|
// src/service/objectIdToString.ts
|
|
3351
|
-
import
|
|
3470
|
+
import mongoose41 from "mongoose";
|
|
3352
3471
|
function isValidObjectId(value) {
|
|
3353
|
-
return
|
|
3472
|
+
return mongoose41.Types.ObjectId.isValid(value);
|
|
3354
3473
|
}
|
|
3355
3474
|
function convertObjectIdsToStrings(obj) {
|
|
3356
3475
|
if (obj === null || obj === void 0) {
|
|
3357
3476
|
return obj;
|
|
3358
3477
|
}
|
|
3359
|
-
if (obj instanceof
|
|
3478
|
+
if (obj instanceof mongoose41.Types.ObjectId) {
|
|
3360
3479
|
return obj.toString();
|
|
3361
3480
|
}
|
|
3362
3481
|
if (obj instanceof Date) {
|
|
@@ -4995,6 +5114,7 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4995
5114
|
export {
|
|
4996
5115
|
ACTIVE_NOT_DELETED_FILTER,
|
|
4997
5116
|
AD_BILLING_CATALOG_COLLECTION_NAME,
|
|
5117
|
+
AI_IMPORT_RUN_LOCK_KEY,
|
|
4998
5118
|
APP_SETTINGS_ID,
|
|
4999
5119
|
AdBillingCatalogModel,
|
|
5000
5120
|
AdBookingModel,
|
|
@@ -5002,6 +5122,8 @@ export {
|
|
|
5002
5122
|
AdModel,
|
|
5003
5123
|
AdPurchaseModel,
|
|
5004
5124
|
AffiliateModel,
|
|
5125
|
+
AiImportRunLockModel,
|
|
5126
|
+
AiImportRunModel,
|
|
5005
5127
|
AiImportedMarketModel,
|
|
5006
5128
|
AppSettingModel,
|
|
5007
5129
|
AuthHandoffTokenModel,
|
|
@@ -5032,9 +5154,10 @@ export {
|
|
|
5032
5154
|
RelationTypeSchema,
|
|
5033
5155
|
ResourceActivityModel,
|
|
5034
5156
|
ResourceImageTypeSchema,
|
|
5157
|
+
SCRAPE_SITES_CONFIG_ID,
|
|
5035
5158
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
5036
5159
|
SchoolModel,
|
|
5037
|
-
|
|
5160
|
+
ScrapeSiteConfigModel,
|
|
5038
5161
|
SocialMediaTypeSchema,
|
|
5039
5162
|
StallTypeSchema,
|
|
5040
5163
|
UnregisteredVendorModel,
|
|
@@ -5089,7 +5212,7 @@ export {
|
|
|
5089
5212
|
locationGeoSchema,
|
|
5090
5213
|
locationsSchema,
|
|
5091
5214
|
mapVendorLicenceToSubscriptionRewardType,
|
|
5092
|
-
|
|
5215
|
+
mongoose40 as mongoose,
|
|
5093
5216
|
normalizeAffiliatePromoCodes,
|
|
5094
5217
|
normalizePromoCode,
|
|
5095
5218
|
notifyUsers,
|