@timardex/cluemart-server-shared 4.0.1 → 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-J7ZINA3I.mjs → chunk-3ICI65FJ.mjs} +350 -242
- package/dist/chunk-3ICI65FJ.mjs.map +1 -0
- package/dist/index.cjs +540 -432
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +92 -10
- package/dist/index.d.ts +92 -10
- package/dist/index.mjs +356 -248
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +410 -302
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +88 -7
- package/dist/mongoose/index.d.ts +88 -7
- package/dist/mongoose/index.mjs +9 -3
- package/dist/service/index.cjs +529 -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/service/index.cjs
CHANGED
|
@@ -97,7 +97,7 @@ __export(service_exports, {
|
|
|
97
97
|
updateAdStatuses: () => updateAdStatuses,
|
|
98
98
|
updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
|
|
99
99
|
updateRelationDatesToCanceled: () => updateRelationDatesToCanceled,
|
|
100
|
-
updateSingleDateTimeStatus: () =>
|
|
100
|
+
updateSingleDateTimeStatus: () => import_cluemart_shared38.updateSingleDateTimeStatus,
|
|
101
101
|
upgradeUserToLicence: () => upgradeUserToLicence,
|
|
102
102
|
vendorOwnerHasProLicence: () => vendorOwnerHasProLicence
|
|
103
103
|
});
|
|
@@ -1004,15 +1004,15 @@ function syncSearchNameInUpdate(update) {
|
|
|
1004
1004
|
}
|
|
1005
1005
|
return null;
|
|
1006
1006
|
}
|
|
1007
|
-
function searchNamePlugin(
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1007
|
+
function searchNamePlugin(schema29) {
|
|
1008
|
+
schema29.add({ searchName: { default: "", required: false, type: String } });
|
|
1009
|
+
schema29.index({ searchName: 1 });
|
|
1010
|
+
schema29.pre("save", function syncSearchNameOnSave(next) {
|
|
1011
1011
|
const doc = this;
|
|
1012
1012
|
doc.searchName = deriveSearchName(doc.name);
|
|
1013
1013
|
next();
|
|
1014
1014
|
});
|
|
1015
|
-
|
|
1015
|
+
schema29.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
1016
1016
|
const list = Array.isArray(docs) ? docs : [docs];
|
|
1017
1017
|
for (const doc of list) {
|
|
1018
1018
|
if (doc && typeof doc.name === "string") {
|
|
@@ -1021,7 +1021,7 @@ function searchNamePlugin(schema27) {
|
|
|
1021
1021
|
}
|
|
1022
1022
|
next();
|
|
1023
1023
|
});
|
|
1024
|
-
|
|
1024
|
+
schema29.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
1025
1025
|
for (const op of ops) {
|
|
1026
1026
|
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
1027
1027
|
if (doc && typeof doc.name === "string") {
|
|
@@ -1047,7 +1047,7 @@ function searchNamePlugin(schema27) {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
next();
|
|
1049
1049
|
};
|
|
1050
|
-
|
|
1050
|
+
schema29.pre(
|
|
1051
1051
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
1052
1052
|
syncSearchNameOnUpdate
|
|
1053
1053
|
);
|
|
@@ -1163,8 +1163,15 @@ var schema8 = new MongooseSchema7(
|
|
|
1163
1163
|
type: ResourceImageTypeSchema
|
|
1164
1164
|
},
|
|
1165
1165
|
dateTime: [dateTimeSchema],
|
|
1166
|
+
deactivatedReason: {
|
|
1167
|
+
enum: Object.values(import_cluemart_shared10.EnumImportedMarketDeactivationReason),
|
|
1168
|
+
required: false,
|
|
1169
|
+
type: String
|
|
1170
|
+
},
|
|
1166
1171
|
deletedAt: { default: null, required: false, type: Date },
|
|
1167
1172
|
description: { required: true, type: String },
|
|
1173
|
+
descriptionSourceHash: { required: false, type: String },
|
|
1174
|
+
duplicateHint: { required: false, type: String },
|
|
1168
1175
|
earliestStartDate: { default: null, required: false, type: Date },
|
|
1169
1176
|
eventId: {
|
|
1170
1177
|
ref: "Event",
|
|
@@ -1177,11 +1184,13 @@ var schema8 = new MongooseSchema7(
|
|
|
1177
1184
|
type: String
|
|
1178
1185
|
},
|
|
1179
1186
|
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
1187
|
+
lastSeenAt: { default: null, required: false, type: Date },
|
|
1180
1188
|
location: {
|
|
1181
1189
|
required: true,
|
|
1182
1190
|
type: locationsSchema
|
|
1183
1191
|
},
|
|
1184
1192
|
logo: { required: false, type: ResourceImageTypeSchema },
|
|
1193
|
+
missedRuns: { default: 0, required: true, type: Number },
|
|
1185
1194
|
name: { required: true, type: String },
|
|
1186
1195
|
openingHours: { required: false, type: [String] },
|
|
1187
1196
|
rainOrShine: { required: true, type: Boolean },
|
|
@@ -1211,6 +1220,7 @@ var schema8 = new MongooseSchema7(
|
|
|
1211
1220
|
},
|
|
1212
1221
|
sourceName: { required: true, type: String },
|
|
1213
1222
|
sourceUrl: { required: true, type: String },
|
|
1223
|
+
tags: { required: false, type: [String] },
|
|
1214
1224
|
website: { required: false, type: String }
|
|
1215
1225
|
},
|
|
1216
1226
|
{ timestamps: true }
|
|
@@ -1221,18 +1231,104 @@ schema8.index({ region: 1 });
|
|
|
1221
1231
|
schema8.index({ deletedAt: 1 });
|
|
1222
1232
|
schema8.index({ "dateTime.dateStatus": 1 });
|
|
1223
1233
|
schema8.index({ earliestStartDate: 1, _id: 1 });
|
|
1234
|
+
schema8.index({ reviewStatus: 1, active: 1, earliestStartDate: 1, _id: 1 });
|
|
1235
|
+
schema8.index({
|
|
1236
|
+
region: 1,
|
|
1237
|
+
reviewStatus: 1,
|
|
1238
|
+
active: 1,
|
|
1239
|
+
earliestStartDate: 1,
|
|
1240
|
+
_id: 1
|
|
1241
|
+
});
|
|
1242
|
+
schema8.index({ region: 1, searchName: 1 });
|
|
1224
1243
|
schema8.index({ slug: 1 });
|
|
1225
1244
|
schema8.index({ reviewStatus: 1 });
|
|
1226
1245
|
schema8.index({ description: "text", name: "text" });
|
|
1227
1246
|
schema8.plugin(searchNamePlugin);
|
|
1228
1247
|
var AiImportedMarketModel = import_mongoose11.default.models.AiImportedMarket || import_mongoose11.default.model("AiImportedMarket", schema8);
|
|
1229
1248
|
|
|
1230
|
-
// src/mongoose/
|
|
1249
|
+
// src/mongoose/AiImportRun.ts
|
|
1250
|
+
var import_cluemart_shared11 = require("@timardex/cluemart-shared");
|
|
1231
1251
|
var import_mongoose12 = __toESM(require("mongoose"));
|
|
1232
1252
|
var MongooseSchema8 = import_mongoose12.default.Schema;
|
|
1233
|
-
var
|
|
1253
|
+
var usageSchema = new MongooseSchema8(
|
|
1254
|
+
{
|
|
1255
|
+
completionTokens: { default: 0, required: true, type: Number },
|
|
1256
|
+
promptTokens: { default: 0, required: true, type: Number },
|
|
1257
|
+
totalTokens: { default: 0, required: true, type: Number }
|
|
1258
|
+
},
|
|
1259
|
+
{ _id: false }
|
|
1260
|
+
);
|
|
1261
|
+
var siteResultSchema = new MongooseSchema8(
|
|
1262
|
+
{
|
|
1263
|
+
errors: { default: 0, required: true, type: Number },
|
|
1264
|
+
found: { default: 0, required: true, type: Number },
|
|
1265
|
+
imported: { default: 0, required: true, type: Number },
|
|
1266
|
+
name: { required: true, type: String },
|
|
1267
|
+
skipped: { default: 0, required: true, type: Number },
|
|
1268
|
+
status: {
|
|
1269
|
+
enum: [import_cluemart_shared11.EnumAiImportRunStatus.SUCCESS, import_cluemart_shared11.EnumAiImportRunStatus.ERROR],
|
|
1270
|
+
required: true,
|
|
1271
|
+
type: String
|
|
1272
|
+
},
|
|
1273
|
+
url: { required: true, type: String },
|
|
1274
|
+
usage: { required: true, type: usageSchema }
|
|
1275
|
+
},
|
|
1276
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1277
|
+
);
|
|
1278
|
+
var resultSchema = new MongooseSchema8(
|
|
1279
|
+
{
|
|
1280
|
+
errors: { default: 0, required: true, type: Number },
|
|
1281
|
+
totalFound: { default: 0, required: true, type: Number },
|
|
1282
|
+
totalImported: { default: 0, required: true, type: Number },
|
|
1283
|
+
totalSkipped: { default: 0, required: true, type: Number }
|
|
1284
|
+
},
|
|
1285
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1286
|
+
);
|
|
1287
|
+
var schema9 = new MongooseSchema8(
|
|
1288
|
+
{
|
|
1289
|
+
error: { required: false, type: String },
|
|
1290
|
+
finishedAt: { required: false, type: Date },
|
|
1291
|
+
result: { required: false, type: resultSchema },
|
|
1292
|
+
siteResults: { default: [], required: true, type: [siteResultSchema] },
|
|
1293
|
+
startedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
|
|
1294
|
+
status: {
|
|
1295
|
+
default: import_cluemart_shared11.EnumAiImportRunStatus.PENDING,
|
|
1296
|
+
enum: Object.values(import_cluemart_shared11.EnumAiImportRunStatus),
|
|
1297
|
+
required: true,
|
|
1298
|
+
type: String
|
|
1299
|
+
},
|
|
1300
|
+
triggeredByUserId: {
|
|
1301
|
+
ref: "User",
|
|
1302
|
+
required: false,
|
|
1303
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
1304
|
+
},
|
|
1305
|
+
usage: { required: false, type: usageSchema }
|
|
1306
|
+
},
|
|
1307
|
+
{ timestamps: true }
|
|
1308
|
+
);
|
|
1309
|
+
schema9.index({ createdAt: -1 });
|
|
1310
|
+
var AiImportRunModel = import_mongoose12.default.models.AiImportRun || import_mongoose12.default.model("AiImportRun", schema9);
|
|
1311
|
+
|
|
1312
|
+
// src/mongoose/AiImportRunLock.ts
|
|
1313
|
+
var import_mongoose13 = __toESM(require("mongoose"));
|
|
1314
|
+
var MongooseSchema9 = import_mongoose13.default.Schema;
|
|
1315
|
+
var schema10 = new MongooseSchema9(
|
|
1316
|
+
{
|
|
1317
|
+
_id: { required: true, type: String },
|
|
1318
|
+
lockedAt: { required: false, type: Date },
|
|
1319
|
+
token: { required: false, type: String }
|
|
1320
|
+
},
|
|
1321
|
+
{ timestamps: true }
|
|
1322
|
+
);
|
|
1323
|
+
var AiImportRunLockModel = import_mongoose13.default.models.AiImportRunLock || import_mongoose13.default.model("AiImportRunLock", schema10);
|
|
1324
|
+
|
|
1325
|
+
// src/mongoose/ScrapeSite.ts
|
|
1326
|
+
var import_mongoose14 = __toESM(require("mongoose"));
|
|
1327
|
+
var MongooseSchema10 = import_mongoose14.default.Schema;
|
|
1328
|
+
var scrapeSiteItemSchema = new MongooseSchema10(
|
|
1234
1329
|
{
|
|
1235
1330
|
enabled: { default: true, required: true, type: Boolean },
|
|
1331
|
+
lastCount: { required: false, type: Number },
|
|
1236
1332
|
lastError: { required: false, type: String },
|
|
1237
1333
|
lastScrapedAt: { required: false, type: Date },
|
|
1238
1334
|
lastScrapeStatus: { required: false, type: String },
|
|
@@ -1242,36 +1338,41 @@ var scrapeSiteItemSchema = new MongooseSchema8(
|
|
|
1242
1338
|
},
|
|
1243
1339
|
{ timestamps: true }
|
|
1244
1340
|
);
|
|
1245
|
-
var configSchema = new
|
|
1341
|
+
var configSchema = new MongooseSchema10(
|
|
1246
1342
|
{
|
|
1247
|
-
|
|
1343
|
+
_id: { required: true, type: String },
|
|
1248
1344
|
sites: {
|
|
1249
1345
|
default: [],
|
|
1250
1346
|
required: true,
|
|
1251
1347
|
type: [scrapeSiteItemSchema]
|
|
1348
|
+
},
|
|
1349
|
+
updatedByUserId: {
|
|
1350
|
+
ref: "User",
|
|
1351
|
+
required: false,
|
|
1352
|
+
type: import_mongoose14.default.Schema.Types.ObjectId
|
|
1252
1353
|
}
|
|
1253
1354
|
},
|
|
1254
1355
|
{ timestamps: true }
|
|
1255
1356
|
);
|
|
1256
|
-
var ScrapeSiteConfigModel =
|
|
1357
|
+
var ScrapeSiteConfigModel = import_mongoose14.default.models.ScrapeSiteConfig || import_mongoose14.default.model("ScrapeSiteConfig", configSchema);
|
|
1257
1358
|
|
|
1258
1359
|
// src/mongoose/Notification.ts
|
|
1259
|
-
var
|
|
1260
|
-
var
|
|
1261
|
-
var
|
|
1262
|
-
var notificationDataSchema = new
|
|
1360
|
+
var import_cluemart_shared12 = require("@timardex/cluemart-shared");
|
|
1361
|
+
var import_mongoose15 = __toESM(require("mongoose"));
|
|
1362
|
+
var MongooseSchema11 = import_mongoose15.default.Schema;
|
|
1363
|
+
var notificationDataSchema = new MongooseSchema11(
|
|
1263
1364
|
{
|
|
1264
1365
|
resourceId: { required: true, type: String },
|
|
1265
1366
|
resourceName: { required: true, type: String },
|
|
1266
1367
|
resourceType: {
|
|
1267
|
-
enum: Object.values(
|
|
1368
|
+
enum: Object.values(import_cluemart_shared12.EnumNotificationResourceType),
|
|
1268
1369
|
required: true,
|
|
1269
1370
|
type: String
|
|
1270
1371
|
}
|
|
1271
1372
|
},
|
|
1272
1373
|
{ _id: false }
|
|
1273
1374
|
);
|
|
1274
|
-
var
|
|
1375
|
+
var schema11 = new MongooseSchema11(
|
|
1275
1376
|
{
|
|
1276
1377
|
data: {
|
|
1277
1378
|
default: null,
|
|
@@ -1282,28 +1383,28 @@ var schema9 = new MongooseSchema9(
|
|
|
1282
1383
|
message: { required: true, type: String },
|
|
1283
1384
|
title: { required: true, type: String },
|
|
1284
1385
|
type: {
|
|
1285
|
-
default:
|
|
1286
|
-
enum: Object.values(
|
|
1386
|
+
default: import_cluemart_shared12.EnumNotificationType.SYSTEM,
|
|
1387
|
+
enum: Object.values(import_cluemart_shared12.EnumNotificationType),
|
|
1287
1388
|
required: true,
|
|
1288
1389
|
type: String
|
|
1289
1390
|
},
|
|
1290
1391
|
userId: {
|
|
1291
1392
|
ref: "User",
|
|
1292
1393
|
required: true,
|
|
1293
|
-
type:
|
|
1394
|
+
type: import_mongoose15.default.Schema.Types.ObjectId
|
|
1294
1395
|
}
|
|
1295
1396
|
},
|
|
1296
1397
|
{ timestamps: true }
|
|
1297
1398
|
);
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
var NotificationModel =
|
|
1399
|
+
schema11.index({ isRead: 1, userId: 1 });
|
|
1400
|
+
schema11.index({ createdAt: -1, userId: 1 });
|
|
1401
|
+
var NotificationModel = import_mongoose15.default.models.Notification || import_mongoose15.default.model("Notification", schema11);
|
|
1301
1402
|
|
|
1302
1403
|
// src/mongoose/PushToken.ts
|
|
1303
1404
|
var import_enums = require("@timardex/cluemart-shared/enums");
|
|
1304
|
-
var
|
|
1305
|
-
var
|
|
1306
|
-
var
|
|
1405
|
+
var import_mongoose16 = __toESM(require("mongoose"));
|
|
1406
|
+
var MongooseSchema12 = import_mongoose16.default.Schema;
|
|
1407
|
+
var schema12 = new MongooseSchema12(
|
|
1307
1408
|
{
|
|
1308
1409
|
platform: {
|
|
1309
1410
|
enum: Object.values(import_enums.EnumOSPlatform),
|
|
@@ -1314,22 +1415,22 @@ var schema10 = new MongooseSchema10(
|
|
|
1314
1415
|
userId: {
|
|
1315
1416
|
ref: "User",
|
|
1316
1417
|
required: true,
|
|
1317
|
-
type:
|
|
1418
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
1318
1419
|
}
|
|
1319
1420
|
},
|
|
1320
1421
|
{ timestamps: true }
|
|
1321
1422
|
);
|
|
1322
|
-
var PushTokenModel =
|
|
1423
|
+
var PushTokenModel = import_mongoose16.default.models.PushToken || import_mongoose16.default.model("PushToken", schema12);
|
|
1323
1424
|
|
|
1324
1425
|
// src/mongoose/Relation.ts
|
|
1325
|
-
var
|
|
1326
|
-
var
|
|
1426
|
+
var import_cluemart_shared14 = require("@timardex/cluemart-shared");
|
|
1427
|
+
var import_mongoose18 = __toESM(require("mongoose"));
|
|
1327
1428
|
|
|
1328
1429
|
// src/mongoose/event/EventInfo.ts
|
|
1329
|
-
var
|
|
1330
|
-
var
|
|
1331
|
-
var
|
|
1332
|
-
var StallTypeSchema = new
|
|
1430
|
+
var import_cluemart_shared13 = require("@timardex/cluemart-shared");
|
|
1431
|
+
var import_mongoose17 = __toESM(require("mongoose"));
|
|
1432
|
+
var MongooseSchema13 = import_mongoose17.default.Schema;
|
|
1433
|
+
var StallTypeSchema = new MongooseSchema13(
|
|
1333
1434
|
{
|
|
1334
1435
|
label: { required: false, type: String },
|
|
1335
1436
|
price: { required: false, type: Number },
|
|
@@ -1340,10 +1441,10 @@ var StallTypeSchema = new MongooseSchema11(
|
|
|
1340
1441
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1341
1442
|
}
|
|
1342
1443
|
);
|
|
1343
|
-
var dateTimeSchema2 = new
|
|
1444
|
+
var dateTimeSchema2 = new MongooseSchema13(
|
|
1344
1445
|
{
|
|
1345
1446
|
dateStatus: {
|
|
1346
|
-
enum: Object.values(
|
|
1447
|
+
enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
|
|
1347
1448
|
required: false,
|
|
1348
1449
|
type: String
|
|
1349
1450
|
},
|
|
@@ -1356,13 +1457,13 @@ var dateTimeSchema2 = new MongooseSchema11(
|
|
|
1356
1457
|
{ _id: false }
|
|
1357
1458
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1358
1459
|
);
|
|
1359
|
-
var paymentInfoSchema = new
|
|
1460
|
+
var paymentInfoSchema = new MongooseSchema13(
|
|
1360
1461
|
{
|
|
1361
1462
|
accountHolderName: { required: false, type: String },
|
|
1362
1463
|
accountNumber: { required: false, type: String },
|
|
1363
1464
|
link: { required: false, type: String },
|
|
1364
1465
|
paymentMethod: {
|
|
1365
|
-
enum: Object.values(
|
|
1466
|
+
enum: Object.values(import_cluemart_shared13.EnumPaymentMethod),
|
|
1366
1467
|
required: true,
|
|
1367
1468
|
type: String
|
|
1368
1469
|
}
|
|
@@ -1370,7 +1471,7 @@ var paymentInfoSchema = new MongooseSchema11(
|
|
|
1370
1471
|
{ _id: false }
|
|
1371
1472
|
// Prevents Mongoose from creating an additional _id field
|
|
1372
1473
|
);
|
|
1373
|
-
var requirementsSchema = new
|
|
1474
|
+
var requirementsSchema = new MongooseSchema13(
|
|
1374
1475
|
{
|
|
1375
1476
|
category: { required: true, type: String },
|
|
1376
1477
|
label: { required: true, type: String },
|
|
@@ -1381,7 +1482,7 @@ var requirementsSchema = new MongooseSchema11(
|
|
|
1381
1482
|
// Prevents Mongoose from creating an additional _id field for
|
|
1382
1483
|
}
|
|
1383
1484
|
);
|
|
1384
|
-
var refundPolicySchema = new
|
|
1485
|
+
var refundPolicySchema = new MongooseSchema13(
|
|
1385
1486
|
{
|
|
1386
1487
|
category: { required: true, type: String },
|
|
1387
1488
|
label: { required: true, type: String },
|
|
@@ -1389,7 +1490,7 @@ var refundPolicySchema = new MongooseSchema11(
|
|
|
1389
1490
|
},
|
|
1390
1491
|
{ _id: false }
|
|
1391
1492
|
);
|
|
1392
|
-
var
|
|
1493
|
+
var schema13 = new MongooseSchema13(
|
|
1393
1494
|
{
|
|
1394
1495
|
active: { default: true, type: Boolean },
|
|
1395
1496
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -1397,7 +1498,7 @@ var schema11 = new MongooseSchema11(
|
|
|
1397
1498
|
eventId: {
|
|
1398
1499
|
ref: "Event",
|
|
1399
1500
|
required: true,
|
|
1400
|
-
type:
|
|
1501
|
+
type: import_mongoose17.default.Schema.Types.ObjectId
|
|
1401
1502
|
},
|
|
1402
1503
|
packInTime: { required: true, type: Number },
|
|
1403
1504
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -1407,15 +1508,15 @@ var schema11 = new MongooseSchema11(
|
|
|
1407
1508
|
},
|
|
1408
1509
|
{ timestamps: true }
|
|
1409
1510
|
);
|
|
1410
|
-
|
|
1411
|
-
var EventInfoModel =
|
|
1511
|
+
schema13.index({ eventId: 1 });
|
|
1512
|
+
var EventInfoModel = import_mongoose17.default.models.EventInfo || import_mongoose17.default.model("EventInfo", schema13);
|
|
1412
1513
|
|
|
1413
1514
|
// src/mongoose/Relation.ts
|
|
1414
|
-
var
|
|
1415
|
-
var relationDateTimeSchema = new
|
|
1515
|
+
var MongooseSchema14 = import_mongoose18.default.Schema;
|
|
1516
|
+
var relationDateTimeSchema = new MongooseSchema14(
|
|
1416
1517
|
{
|
|
1417
1518
|
dateStatus: {
|
|
1418
|
-
enum: Object.values(
|
|
1519
|
+
enum: Object.values(import_cluemart_shared14.EnumEventDateStatus),
|
|
1419
1520
|
required: true,
|
|
1420
1521
|
type: String
|
|
1421
1522
|
},
|
|
@@ -1427,7 +1528,7 @@ var relationDateTimeSchema = new MongooseSchema12(
|
|
|
1427
1528
|
},
|
|
1428
1529
|
{ _id: false }
|
|
1429
1530
|
);
|
|
1430
|
-
var relationDatesSchema = new
|
|
1531
|
+
var relationDatesSchema = new MongooseSchema14(
|
|
1431
1532
|
{
|
|
1432
1533
|
dateTime: {
|
|
1433
1534
|
required: true,
|
|
@@ -1439,42 +1540,42 @@ var relationDatesSchema = new MongooseSchema12(
|
|
|
1439
1540
|
},
|
|
1440
1541
|
paymentReference: { required: false, type: String },
|
|
1441
1542
|
status: {
|
|
1442
|
-
enum: Object.values(
|
|
1543
|
+
enum: Object.values(import_cluemart_shared14.EnumInviteStatus),
|
|
1443
1544
|
required: false,
|
|
1444
1545
|
type: String
|
|
1445
1546
|
}
|
|
1446
1547
|
},
|
|
1447
1548
|
{ _id: false }
|
|
1448
1549
|
);
|
|
1449
|
-
var RelationTypeSchema = new
|
|
1550
|
+
var RelationTypeSchema = new MongooseSchema14(
|
|
1450
1551
|
{
|
|
1451
1552
|
active: { default: true, required: true, type: Boolean },
|
|
1452
1553
|
chatId: {
|
|
1453
1554
|
ref: "Chat",
|
|
1454
1555
|
required: true,
|
|
1455
|
-
type:
|
|
1556
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1456
1557
|
},
|
|
1457
1558
|
deletedAt: { default: null, required: false, type: Date },
|
|
1458
1559
|
eventId: {
|
|
1459
1560
|
ref: "Event",
|
|
1460
1561
|
required: true,
|
|
1461
|
-
type:
|
|
1562
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1462
1563
|
},
|
|
1463
1564
|
lastUpdateBy: {
|
|
1464
|
-
enum: Object.values(
|
|
1565
|
+
enum: Object.values(import_cluemart_shared14.EnumResourceType),
|
|
1465
1566
|
required: true,
|
|
1466
1567
|
type: String
|
|
1467
1568
|
},
|
|
1468
1569
|
relationDates: [relationDatesSchema],
|
|
1469
1570
|
relationType: {
|
|
1470
|
-
enum: Object.values(
|
|
1571
|
+
enum: Object.values(import_cluemart_shared14.EnumRelationResource),
|
|
1471
1572
|
required: true,
|
|
1472
1573
|
type: String
|
|
1473
1574
|
},
|
|
1474
1575
|
vendorId: {
|
|
1475
1576
|
ref: "Vendor",
|
|
1476
1577
|
required: true,
|
|
1477
|
-
type:
|
|
1578
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1478
1579
|
}
|
|
1479
1580
|
},
|
|
1480
1581
|
{ timestamps: true }
|
|
@@ -1486,21 +1587,21 @@ RelationTypeSchema.index({
|
|
|
1486
1587
|
"relationDates.status": 1,
|
|
1487
1588
|
vendorId: 1
|
|
1488
1589
|
});
|
|
1489
|
-
var RelationModel =
|
|
1590
|
+
var RelationModel = import_mongoose18.default.models.Relation || import_mongoose18.default.model("Relation", RelationTypeSchema);
|
|
1490
1591
|
|
|
1491
1592
|
// src/mongoose/ResourceActivity.ts
|
|
1492
|
-
var
|
|
1493
|
-
var
|
|
1494
|
-
var
|
|
1495
|
-
var ActivitySchema = new
|
|
1593
|
+
var import_cluemart_shared15 = require("@timardex/cluemart-shared");
|
|
1594
|
+
var import_mongoose19 = __toESM(require("mongoose"));
|
|
1595
|
+
var MongooseSchema15 = import_mongoose19.default.Schema;
|
|
1596
|
+
var ActivitySchema = new MongooseSchema15(
|
|
1496
1597
|
{
|
|
1497
1598
|
activityType: {
|
|
1498
|
-
enum: Object.values(
|
|
1599
|
+
enum: Object.values(import_cluemart_shared15.EnumActivity),
|
|
1499
1600
|
required: true,
|
|
1500
1601
|
type: String
|
|
1501
1602
|
},
|
|
1502
1603
|
dateStatus: {
|
|
1503
|
-
enum: Object.values(
|
|
1604
|
+
enum: Object.values(import_cluemart_shared15.EnumEventDateStatus),
|
|
1504
1605
|
required: false,
|
|
1505
1606
|
type: String
|
|
1506
1607
|
},
|
|
@@ -1512,7 +1613,7 @@ var ActivitySchema = new MongooseSchema13(
|
|
|
1512
1613
|
startTime: { required: false, type: String },
|
|
1513
1614
|
timestamp: { default: Date.now, type: Date },
|
|
1514
1615
|
userAgent: {
|
|
1515
|
-
enum: Object.values(
|
|
1616
|
+
enum: Object.values(import_cluemart_shared15.EnumOSPlatform),
|
|
1516
1617
|
required: true,
|
|
1517
1618
|
type: String
|
|
1518
1619
|
},
|
|
@@ -1520,61 +1621,61 @@ var ActivitySchema = new MongooseSchema13(
|
|
|
1520
1621
|
},
|
|
1521
1622
|
{ _id: false }
|
|
1522
1623
|
);
|
|
1523
|
-
var
|
|
1624
|
+
var schema14 = new MongooseSchema15(
|
|
1524
1625
|
{
|
|
1525
1626
|
activity: { default: [], type: [ActivitySchema] },
|
|
1526
1627
|
resourceId: { required: true, type: String },
|
|
1527
1628
|
resourceType: {
|
|
1528
|
-
enum: Object.values(
|
|
1629
|
+
enum: Object.values(import_cluemart_shared15.EnumResourceType),
|
|
1529
1630
|
required: true,
|
|
1530
1631
|
type: String
|
|
1531
1632
|
}
|
|
1532
1633
|
},
|
|
1533
1634
|
{ timestamps: true }
|
|
1534
1635
|
);
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
var ResourceActivityModel =
|
|
1636
|
+
schema14.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
1637
|
+
schema14.index({ "views.location": "2dsphere" });
|
|
1638
|
+
var ResourceActivityModel = import_mongoose19.default.models.ResourceActivity || import_mongoose19.default.model("ResourceActivity", schema14);
|
|
1538
1639
|
|
|
1539
1640
|
// src/mongoose/User.ts
|
|
1540
|
-
var
|
|
1541
|
-
var
|
|
1542
|
-
var
|
|
1543
|
-
var userActivityEventSchema = new
|
|
1641
|
+
var import_cluemart_shared16 = require("@timardex/cluemart-shared");
|
|
1642
|
+
var import_mongoose20 = __toESM(require("mongoose"));
|
|
1643
|
+
var MongooseSchema16 = import_mongoose20.default.Schema;
|
|
1644
|
+
var userActivityEventSchema = new MongooseSchema16(
|
|
1544
1645
|
{
|
|
1545
1646
|
dateTime: dateTimeSchema,
|
|
1546
1647
|
resourceId: {
|
|
1547
1648
|
ref: "Event",
|
|
1548
1649
|
required: false,
|
|
1549
|
-
type:
|
|
1650
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1550
1651
|
}
|
|
1551
1652
|
},
|
|
1552
1653
|
{ _id: false }
|
|
1553
1654
|
);
|
|
1554
|
-
var userActivityFavouritesSchema = new
|
|
1655
|
+
var userActivityFavouritesSchema = new MongooseSchema16(
|
|
1555
1656
|
{
|
|
1556
1657
|
events: {
|
|
1557
1658
|
ref: "Event",
|
|
1558
1659
|
required: false,
|
|
1559
|
-
type: [
|
|
1660
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1560
1661
|
},
|
|
1561
1662
|
partners: {
|
|
1562
1663
|
ref: "Partner",
|
|
1563
1664
|
required: false,
|
|
1564
|
-
type: [
|
|
1665
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1565
1666
|
},
|
|
1566
1667
|
vendors: {
|
|
1567
1668
|
ref: "Vendor",
|
|
1568
1669
|
required: false,
|
|
1569
|
-
type: [
|
|
1670
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1570
1671
|
}
|
|
1571
1672
|
},
|
|
1572
1673
|
{ _id: false }
|
|
1573
1674
|
);
|
|
1574
|
-
var stripeSchema = new
|
|
1675
|
+
var stripeSchema = new MongooseSchema16(
|
|
1575
1676
|
{
|
|
1576
1677
|
billingPeriod: {
|
|
1577
|
-
enum: Object.values(
|
|
1678
|
+
enum: Object.values(import_cluemart_shared16.EnumBillingPeriod),
|
|
1578
1679
|
required: false,
|
|
1579
1680
|
type: String
|
|
1580
1681
|
},
|
|
@@ -1583,7 +1684,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1583
1684
|
type: Boolean
|
|
1584
1685
|
},
|
|
1585
1686
|
currentPlan: {
|
|
1586
|
-
enum: Object.values(
|
|
1687
|
+
enum: Object.values(import_cluemart_shared16.EnumUserLicence),
|
|
1587
1688
|
required: false,
|
|
1588
1689
|
type: String
|
|
1589
1690
|
},
|
|
@@ -1608,7 +1709,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1608
1709
|
type: String
|
|
1609
1710
|
},
|
|
1610
1711
|
pendingBillingPeriod: {
|
|
1611
|
-
enum: Object.values(
|
|
1712
|
+
enum: Object.values(import_cluemart_shared16.EnumBillingPeriod),
|
|
1612
1713
|
required: false,
|
|
1613
1714
|
type: String
|
|
1614
1715
|
},
|
|
@@ -1617,7 +1718,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1617
1718
|
type: Date
|
|
1618
1719
|
},
|
|
1619
1720
|
pendingPlan: {
|
|
1620
|
-
enum: Object.values(
|
|
1721
|
+
enum: Object.values(import_cluemart_shared16.EnumUserLicence),
|
|
1621
1722
|
required: false,
|
|
1622
1723
|
type: String
|
|
1623
1724
|
},
|
|
@@ -1634,7 +1735,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1634
1735
|
type: Date
|
|
1635
1736
|
},
|
|
1636
1737
|
status: {
|
|
1637
|
-
enum: Object.values(
|
|
1738
|
+
enum: Object.values(import_cluemart_shared16.EnumSubscriptionStatus),
|
|
1638
1739
|
required: false,
|
|
1639
1740
|
type: String
|
|
1640
1741
|
},
|
|
@@ -1653,10 +1754,10 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1653
1754
|
},
|
|
1654
1755
|
{ _id: false }
|
|
1655
1756
|
);
|
|
1656
|
-
var redeemedRewardSchema = new
|
|
1757
|
+
var redeemedRewardSchema = new MongooseSchema16(
|
|
1657
1758
|
{
|
|
1658
1759
|
name: {
|
|
1659
|
-
enum: Object.values(
|
|
1760
|
+
enum: Object.values(import_cluemart_shared16.EnumReward),
|
|
1660
1761
|
required: true,
|
|
1661
1762
|
type: String
|
|
1662
1763
|
},
|
|
@@ -1665,12 +1766,12 @@ var redeemedRewardSchema = new MongooseSchema14(
|
|
|
1665
1766
|
},
|
|
1666
1767
|
{ _id: false }
|
|
1667
1768
|
);
|
|
1668
|
-
var userOverallPointsSchema = new
|
|
1769
|
+
var userOverallPointsSchema = new MongooseSchema16(
|
|
1669
1770
|
{
|
|
1670
1771
|
createdAt: { required: true, type: Date },
|
|
1671
1772
|
points: { default: 0, required: true, type: Number },
|
|
1672
1773
|
pointType: {
|
|
1673
|
-
enum: Object.values(
|
|
1774
|
+
enum: Object.values(import_cluemart_shared16.EnumPointType),
|
|
1674
1775
|
required: true,
|
|
1675
1776
|
type: String
|
|
1676
1777
|
},
|
|
@@ -1678,13 +1779,13 @@ var userOverallPointsSchema = new MongooseSchema14(
|
|
|
1678
1779
|
},
|
|
1679
1780
|
{ _id: false }
|
|
1680
1781
|
);
|
|
1681
|
-
var
|
|
1782
|
+
var schema15 = new MongooseSchema16(
|
|
1682
1783
|
{
|
|
1683
1784
|
active: { default: false, required: true, type: Boolean },
|
|
1684
1785
|
affiliate: {
|
|
1685
1786
|
ref: "Affiliate",
|
|
1686
1787
|
required: false,
|
|
1687
|
-
type:
|
|
1788
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1688
1789
|
},
|
|
1689
1790
|
avatar: {
|
|
1690
1791
|
required: false,
|
|
@@ -1693,28 +1794,28 @@ var schema13 = new MongooseSchema14(
|
|
|
1693
1794
|
coupon: {
|
|
1694
1795
|
ref: "Coupon",
|
|
1695
1796
|
required: false,
|
|
1696
|
-
type:
|
|
1797
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1697
1798
|
},
|
|
1698
1799
|
deletedAt: { default: null, required: false, type: Date },
|
|
1699
1800
|
email: { required: true, type: String },
|
|
1700
1801
|
emailSentFor: {
|
|
1701
|
-
enum: Object.values(
|
|
1802
|
+
enum: Object.values(import_cluemart_shared16.EnumNotificationResourceType),
|
|
1702
1803
|
required: false,
|
|
1703
1804
|
type: [String]
|
|
1704
1805
|
},
|
|
1705
1806
|
events: {
|
|
1706
1807
|
ref: "Event",
|
|
1707
1808
|
required: false,
|
|
1708
|
-
type: [
|
|
1809
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1709
1810
|
},
|
|
1710
1811
|
firstName: { required: true, type: String },
|
|
1711
1812
|
game: {
|
|
1712
1813
|
ref: "Game",
|
|
1713
1814
|
required: false,
|
|
1714
|
-
type:
|
|
1815
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1715
1816
|
},
|
|
1716
1817
|
interests: {
|
|
1717
|
-
enum: Object.values(
|
|
1818
|
+
enum: Object.values(import_cluemart_shared16.EnumResourceType),
|
|
1718
1819
|
required: false,
|
|
1719
1820
|
type: [String]
|
|
1720
1821
|
},
|
|
@@ -1737,11 +1838,11 @@ var schema13 = new MongooseSchema14(
|
|
|
1737
1838
|
partner: {
|
|
1738
1839
|
ref: "Partner",
|
|
1739
1840
|
required: false,
|
|
1740
|
-
type:
|
|
1841
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1741
1842
|
},
|
|
1742
1843
|
password: { required: true, type: String },
|
|
1743
1844
|
platform: {
|
|
1744
|
-
enum: Object.values(
|
|
1845
|
+
enum: Object.values(import_cluemart_shared16.EnumOSPlatform),
|
|
1745
1846
|
required: false,
|
|
1746
1847
|
type: String
|
|
1747
1848
|
},
|
|
@@ -1770,15 +1871,15 @@ var schema13 = new MongooseSchema14(
|
|
|
1770
1871
|
type: String
|
|
1771
1872
|
},
|
|
1772
1873
|
roles: {
|
|
1773
|
-
default: [
|
|
1774
|
-
enum: Object.values(
|
|
1874
|
+
default: [import_cluemart_shared16.EnumUserRole.CUSTOMER],
|
|
1875
|
+
enum: Object.values(import_cluemart_shared16.EnumUserRole),
|
|
1775
1876
|
required: true,
|
|
1776
1877
|
type: [String]
|
|
1777
1878
|
},
|
|
1778
1879
|
school: {
|
|
1779
1880
|
ref: "School",
|
|
1780
1881
|
required: false,
|
|
1781
|
-
type:
|
|
1882
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1782
1883
|
},
|
|
1783
1884
|
stripe: {
|
|
1784
1885
|
required: false,
|
|
@@ -1803,21 +1904,21 @@ var schema13 = new MongooseSchema14(
|
|
|
1803
1904
|
vendor: {
|
|
1804
1905
|
ref: "Vendor",
|
|
1805
1906
|
required: false,
|
|
1806
|
-
type:
|
|
1907
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1807
1908
|
}
|
|
1808
1909
|
},
|
|
1809
1910
|
{ strict: false, timestamps: true }
|
|
1810
1911
|
);
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
var UserModel =
|
|
1912
|
+
schema15.index({ "licences.expiryDate": 1 });
|
|
1913
|
+
schema15.index({ "licences.licenceType": 1 });
|
|
1914
|
+
schema15.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
1915
|
+
schema15.index({ email: "text", firstName: "text", lastName: "text" });
|
|
1916
|
+
var UserModel = import_mongoose20.default.models.User || import_mongoose20.default.model("User", schema15);
|
|
1816
1917
|
|
|
1817
1918
|
// src/mongoose/VerificationToken.ts
|
|
1818
|
-
var
|
|
1819
|
-
var
|
|
1820
|
-
var
|
|
1919
|
+
var import_mongoose21 = __toESM(require("mongoose"));
|
|
1920
|
+
var MongooseSchema17 = import_mongoose21.default.Schema;
|
|
1921
|
+
var schema16 = new MongooseSchema17(
|
|
1821
1922
|
{
|
|
1822
1923
|
createdAt: {
|
|
1823
1924
|
default: Date.now,
|
|
@@ -1832,13 +1933,13 @@ var schema14 = new MongooseSchema15(
|
|
|
1832
1933
|
},
|
|
1833
1934
|
{ timestamps: true }
|
|
1834
1935
|
);
|
|
1835
|
-
var VerificationTokenModel =
|
|
1936
|
+
var VerificationTokenModel = import_mongoose21.default.models.VerificationToken || import_mongoose21.default.model("VerificationToken", schema16);
|
|
1836
1937
|
|
|
1837
1938
|
// src/mongoose/vendor/Vendor.ts
|
|
1838
|
-
var
|
|
1839
|
-
var
|
|
1840
|
-
var
|
|
1841
|
-
var vendorProductTypeSchema = new
|
|
1939
|
+
var import_cluemart_shared17 = require("@timardex/cluemart-shared");
|
|
1940
|
+
var import_mongoose22 = __toESM(require("mongoose"));
|
|
1941
|
+
var MongooseSchema18 = import_mongoose22.default.Schema;
|
|
1942
|
+
var vendorProductTypeSchema = new MongooseSchema18(
|
|
1842
1943
|
{
|
|
1843
1944
|
description: { required: false, type: String },
|
|
1844
1945
|
name: { required: true, type: String },
|
|
@@ -1849,18 +1950,18 @@ var vendorProductTypeSchema = new MongooseSchema16(
|
|
|
1849
1950
|
},
|
|
1850
1951
|
{ timestamps: true }
|
|
1851
1952
|
);
|
|
1852
|
-
var productWrapperSchema = new
|
|
1953
|
+
var productWrapperSchema = new MongooseSchema18(
|
|
1853
1954
|
{
|
|
1854
1955
|
active: { default: false, required: false, type: Boolean },
|
|
1855
1956
|
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
1856
1957
|
},
|
|
1857
1958
|
{ _id: false }
|
|
1858
1959
|
);
|
|
1859
|
-
var calendarSchema = new
|
|
1960
|
+
var calendarSchema = new MongooseSchema18(
|
|
1860
1961
|
{
|
|
1861
1962
|
dateTime: {
|
|
1862
1963
|
dateStatus: {
|
|
1863
|
-
enum: Object.values(
|
|
1964
|
+
enum: Object.values(import_cluemart_shared17.EnumEventDateStatus),
|
|
1864
1965
|
required: false,
|
|
1865
1966
|
type: String
|
|
1866
1967
|
},
|
|
@@ -1877,14 +1978,14 @@ var calendarSchema = new MongooseSchema16(
|
|
|
1877
1978
|
},
|
|
1878
1979
|
{ _id: false }
|
|
1879
1980
|
);
|
|
1880
|
-
var calendarWrapperSchema = new
|
|
1981
|
+
var calendarWrapperSchema = new MongooseSchema18(
|
|
1881
1982
|
{
|
|
1882
1983
|
active: { default: false, required: true, type: Boolean },
|
|
1883
1984
|
calendarData: { required: false, type: [calendarSchema] }
|
|
1884
1985
|
},
|
|
1885
1986
|
{ _id: false }
|
|
1886
1987
|
);
|
|
1887
|
-
var vendorAvailabilitySchema = new
|
|
1988
|
+
var vendorAvailabilitySchema = new MongooseSchema18(
|
|
1888
1989
|
{
|
|
1889
1990
|
corporate: { default: false, required: false, type: Boolean },
|
|
1890
1991
|
private: { default: false, required: false, type: Boolean },
|
|
@@ -1892,7 +1993,7 @@ var vendorAvailabilitySchema = new MongooseSchema16(
|
|
|
1892
1993
|
},
|
|
1893
1994
|
{ _id: false }
|
|
1894
1995
|
);
|
|
1895
|
-
var downgradeSnapshotSchema = new
|
|
1996
|
+
var downgradeSnapshotSchema = new MongooseSchema18(
|
|
1896
1997
|
{
|
|
1897
1998
|
availability: { required: false, type: vendorAvailabilitySchema },
|
|
1898
1999
|
calendarActive: { required: false, type: Boolean },
|
|
@@ -1900,7 +2001,7 @@ var downgradeSnapshotSchema = new MongooseSchema16(
|
|
|
1900
2001
|
},
|
|
1901
2002
|
{ _id: false }
|
|
1902
2003
|
);
|
|
1903
|
-
var
|
|
2004
|
+
var schema17 = new MongooseSchema18(
|
|
1904
2005
|
{
|
|
1905
2006
|
...baseResourceFields,
|
|
1906
2007
|
// Importing base resource fields from global.ts
|
|
@@ -1919,47 +2020,47 @@ var schema15 = new MongooseSchema16(
|
|
|
1919
2020
|
unregisteredVendorId: {
|
|
1920
2021
|
ref: "UnregisteredVendor",
|
|
1921
2022
|
required: false,
|
|
1922
|
-
type:
|
|
2023
|
+
type: import_mongoose22.default.Schema.Types.ObjectId
|
|
1923
2024
|
},
|
|
1924
2025
|
vendorInfoId: {
|
|
1925
2026
|
ref: "VendorInfo",
|
|
1926
2027
|
required: false,
|
|
1927
|
-
type:
|
|
2028
|
+
type: import_mongoose22.default.Schema.Types.ObjectId
|
|
1928
2029
|
},
|
|
1929
2030
|
vendorType: {
|
|
1930
|
-
enum: Object.values(
|
|
2031
|
+
enum: Object.values(import_cluemart_shared17.EnumVendorType),
|
|
1931
2032
|
required: true,
|
|
1932
2033
|
type: String
|
|
1933
2034
|
}
|
|
1934
2035
|
},
|
|
1935
2036
|
{ timestamps: true }
|
|
1936
2037
|
);
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
2038
|
+
schema17.index({ name: 1 });
|
|
2039
|
+
schema17.index({ description: 1 });
|
|
2040
|
+
schema17.index({ region: 1 });
|
|
2041
|
+
schema17.index({ "categories.name": 1 });
|
|
2042
|
+
schema17.index({ slug: 1 });
|
|
2043
|
+
schema17.index({
|
|
1943
2044
|
categoriesNames: "text",
|
|
1944
2045
|
description: "text",
|
|
1945
2046
|
name: "text"
|
|
1946
2047
|
});
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
var VendorModel =
|
|
2048
|
+
schema17.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2049
|
+
schema17.plugin(searchNamePlugin);
|
|
2050
|
+
var VendorModel = import_mongoose22.default.models.Vendor || import_mongoose22.default.model("Vendor", schema17);
|
|
1950
2051
|
|
|
1951
2052
|
// src/mongoose/vendor/VendorInfo.ts
|
|
1952
|
-
var
|
|
1953
|
-
var
|
|
1954
|
-
var
|
|
1955
|
-
var AttributesSchema = new
|
|
2053
|
+
var import_cluemart_shared18 = require("@timardex/cluemart-shared");
|
|
2054
|
+
var import_mongoose23 = __toESM(require("mongoose"));
|
|
2055
|
+
var MongooseSchema19 = import_mongoose23.default.Schema;
|
|
2056
|
+
var AttributesSchema = new MongooseSchema19(
|
|
1956
2057
|
{
|
|
1957
2058
|
details: { required: false, type: String },
|
|
1958
2059
|
isRequired: { default: false, required: true, type: Boolean }
|
|
1959
2060
|
},
|
|
1960
2061
|
{ _id: false }
|
|
1961
2062
|
);
|
|
1962
|
-
var
|
|
2063
|
+
var schema18 = new MongooseSchema19(
|
|
1963
2064
|
{
|
|
1964
2065
|
active: { default: true, type: Boolean },
|
|
1965
2066
|
compliance: {
|
|
@@ -1969,7 +2070,7 @@ var schema16 = new MongooseSchema17(
|
|
|
1969
2070
|
documents: [ResourceImageTypeSchema],
|
|
1970
2071
|
product: {
|
|
1971
2072
|
foodFlavors: {
|
|
1972
|
-
enum: Object.values(
|
|
2073
|
+
enum: Object.values(import_cluemart_shared18.EnumFoodFlavor),
|
|
1973
2074
|
required: true,
|
|
1974
2075
|
type: [String]
|
|
1975
2076
|
},
|
|
@@ -1994,29 +2095,29 @@ var schema16 = new MongooseSchema17(
|
|
|
1994
2095
|
vendorId: {
|
|
1995
2096
|
ref: "Vendor",
|
|
1996
2097
|
required: true,
|
|
1997
|
-
type:
|
|
2098
|
+
type: import_mongoose23.default.Schema.Types.ObjectId
|
|
1998
2099
|
}
|
|
1999
2100
|
},
|
|
2000
2101
|
{ timestamps: true }
|
|
2001
2102
|
);
|
|
2002
|
-
|
|
2003
|
-
var VendorInfoModel =
|
|
2103
|
+
schema18.index({ vendorId: 1 });
|
|
2104
|
+
var VendorInfoModel = import_mongoose23.default.models.VendorInfo || import_mongoose23.default.model("VendorInfo", schema18);
|
|
2004
2105
|
|
|
2005
2106
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
2006
|
-
var
|
|
2007
|
-
var
|
|
2008
|
-
var invitationSchema = new
|
|
2107
|
+
var import_mongoose24 = __toESM(require("mongoose"));
|
|
2108
|
+
var MongooseSchema20 = import_mongoose24.default.Schema;
|
|
2109
|
+
var invitationSchema = new MongooseSchema20(
|
|
2009
2110
|
{
|
|
2010
2111
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
2011
2112
|
inviterId: {
|
|
2012
2113
|
ref: "Event",
|
|
2013
2114
|
required: true,
|
|
2014
|
-
type:
|
|
2115
|
+
type: import_mongoose24.default.Schema.Types.ObjectId
|
|
2015
2116
|
}
|
|
2016
2117
|
},
|
|
2017
2118
|
{ _id: false }
|
|
2018
2119
|
);
|
|
2019
|
-
var
|
|
2120
|
+
var schema19 = new MongooseSchema20(
|
|
2020
2121
|
{
|
|
2021
2122
|
active: { default: true, required: true, type: Boolean },
|
|
2022
2123
|
categoryIds: { required: true, type: [String] },
|
|
@@ -2025,7 +2126,7 @@ var schema17 = new MongooseSchema18(
|
|
|
2025
2126
|
claimedByUserId: {
|
|
2026
2127
|
ref: "User",
|
|
2027
2128
|
required: false,
|
|
2028
|
-
type:
|
|
2129
|
+
type: import_mongoose24.default.Schema.Types.ObjectId
|
|
2029
2130
|
},
|
|
2030
2131
|
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
2031
2132
|
claimToken: { default: null, required: false, type: String },
|
|
@@ -2038,15 +2139,15 @@ var schema17 = new MongooseSchema18(
|
|
|
2038
2139
|
},
|
|
2039
2140
|
{ timestamps: true }
|
|
2040
2141
|
);
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
var UnregisteredVendorModel =
|
|
2142
|
+
schema19.index({ name: 1 });
|
|
2143
|
+
schema19.index({ email: 1 });
|
|
2144
|
+
var UnregisteredVendorModel = import_mongoose24.default.models.UnregisteredVendor || import_mongoose24.default.model("UnregisteredVendor", schema19);
|
|
2044
2145
|
|
|
2045
2146
|
// src/mongoose/event/Event.ts
|
|
2046
|
-
var
|
|
2047
|
-
var
|
|
2048
|
-
var
|
|
2049
|
-
var
|
|
2147
|
+
var import_cluemart_shared19 = require("@timardex/cluemart-shared");
|
|
2148
|
+
var import_mongoose25 = __toESM(require("mongoose"));
|
|
2149
|
+
var MongooseSchema21 = import_mongoose25.default.Schema;
|
|
2150
|
+
var schema20 = new MongooseSchema21(
|
|
2050
2151
|
{
|
|
2051
2152
|
...baseResourceFields,
|
|
2052
2153
|
// Importing base resource fields from global.ts
|
|
@@ -2055,10 +2156,10 @@ var schema18 = new MongooseSchema19(
|
|
|
2055
2156
|
eventInfoId: {
|
|
2056
2157
|
ref: "EventInfo",
|
|
2057
2158
|
required: false,
|
|
2058
|
-
type:
|
|
2159
|
+
type: import_mongoose25.default.Schema.Types.ObjectId
|
|
2059
2160
|
},
|
|
2060
2161
|
eventType: {
|
|
2061
|
-
enum: Object.values(
|
|
2162
|
+
enum: Object.values(import_cluemart_shared19.EnumEventType),
|
|
2062
2163
|
required: true,
|
|
2063
2164
|
type: String
|
|
2064
2165
|
},
|
|
@@ -2079,40 +2180,40 @@ var schema18 = new MongooseSchema19(
|
|
|
2079
2180
|
},
|
|
2080
2181
|
{ timestamps: true }
|
|
2081
2182
|
);
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
var EventModel =
|
|
2183
|
+
schema20.index({ name: 1 });
|
|
2184
|
+
schema20.index({ description: 1 });
|
|
2185
|
+
schema20.index({ region: 1 });
|
|
2186
|
+
schema20.index({ "location.geo": "2dsphere" });
|
|
2187
|
+
schema20.index({ tags: 1 });
|
|
2188
|
+
schema20.index({ deletedAt: 1 });
|
|
2189
|
+
schema20.index({ "dateTime.dateStatus": 1 });
|
|
2190
|
+
schema20.index({ slug: 1 });
|
|
2191
|
+
schema20.index({ description: "text", name: "text", tags: "text" });
|
|
2192
|
+
schema20.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2193
|
+
schema20.plugin(searchNamePlugin);
|
|
2194
|
+
var EventModel = import_mongoose25.default.models.Event || import_mongoose25.default.model("Event", schema20);
|
|
2094
2195
|
|
|
2095
2196
|
// src/mongoose/event/EventDateArchive.ts
|
|
2096
|
-
var
|
|
2097
|
-
var
|
|
2197
|
+
var import_mongoose26 = __toESM(require("mongoose"));
|
|
2198
|
+
var schema21 = new import_mongoose26.default.Schema(
|
|
2098
2199
|
{
|
|
2099
2200
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
2100
2201
|
eventId: {
|
|
2101
2202
|
ref: "Event",
|
|
2102
2203
|
required: true,
|
|
2103
|
-
type:
|
|
2204
|
+
type: import_mongoose26.default.Schema.Types.ObjectId
|
|
2104
2205
|
}
|
|
2105
2206
|
},
|
|
2106
2207
|
{ timestamps: true }
|
|
2107
2208
|
);
|
|
2108
|
-
|
|
2109
|
-
var EventDateArchiveModel =
|
|
2209
|
+
schema21.index({ eventId: 1 }, { unique: true });
|
|
2210
|
+
var EventDateArchiveModel = import_mongoose26.default.models.EventDateArchive || import_mongoose26.default.model("EventDateArchive", schema21);
|
|
2110
2211
|
|
|
2111
2212
|
// src/mongoose/Partner.ts
|
|
2112
|
-
var
|
|
2113
|
-
var
|
|
2114
|
-
var
|
|
2115
|
-
var
|
|
2213
|
+
var import_cluemart_shared20 = require("@timardex/cluemart-shared");
|
|
2214
|
+
var import_mongoose27 = __toESM(require("mongoose"));
|
|
2215
|
+
var MongooseSchema22 = import_mongoose27.default.Schema;
|
|
2216
|
+
var schema22 = new MongooseSchema22(
|
|
2116
2217
|
{
|
|
2117
2218
|
...baseResourceFields,
|
|
2118
2219
|
location: {
|
|
@@ -2121,53 +2222,53 @@ var schema20 = new MongooseSchema20(
|
|
|
2121
2222
|
},
|
|
2122
2223
|
nzbn: { required: true, type: String },
|
|
2123
2224
|
partnerType: {
|
|
2124
|
-
enum: Object.values(
|
|
2225
|
+
enum: Object.values(import_cluemart_shared20.EnumPartnerType),
|
|
2125
2226
|
required: true,
|
|
2126
2227
|
type: String
|
|
2127
2228
|
}
|
|
2128
2229
|
},
|
|
2129
2230
|
{ timestamps: true }
|
|
2130
2231
|
);
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
var PartnerModel =
|
|
2232
|
+
schema22.index({ name: 1 });
|
|
2233
|
+
schema22.index({ description: 1 });
|
|
2234
|
+
schema22.index({ region: 1 });
|
|
2235
|
+
schema22.index({ "location.geo": "2dsphere" });
|
|
2236
|
+
schema22.index({ slug: 1 });
|
|
2237
|
+
schema22.index({ name: "text", description: "text" });
|
|
2238
|
+
schema22.index({ "owner.userId": 1, deletedAt: 1 });
|
|
2239
|
+
schema22.plugin(searchNamePlugin);
|
|
2240
|
+
var PartnerModel = import_mongoose27.default.models.Partner || import_mongoose27.default.model("Partner", schema22);
|
|
2140
2241
|
|
|
2141
2242
|
// src/mongoose/Post.ts
|
|
2142
|
-
var
|
|
2143
|
-
var
|
|
2144
|
-
var
|
|
2145
|
-
var contentSchema = new
|
|
2243
|
+
var import_cluemart_shared21 = require("@timardex/cluemart-shared");
|
|
2244
|
+
var import_mongoose28 = __toESM(require("mongoose"));
|
|
2245
|
+
var MongooseSchema23 = import_mongoose28.default.Schema;
|
|
2246
|
+
var contentSchema = new MongooseSchema23(
|
|
2146
2247
|
{
|
|
2147
|
-
contentData:
|
|
2248
|
+
contentData: import_mongoose28.Schema.Types.Mixed,
|
|
2148
2249
|
contentOrder: { required: true, type: Number },
|
|
2149
2250
|
contentType: {
|
|
2150
|
-
enum: Object.values(
|
|
2251
|
+
enum: Object.values(import_cluemart_shared21.EnumPostContentType),
|
|
2151
2252
|
required: true,
|
|
2152
2253
|
type: String
|
|
2153
2254
|
}
|
|
2154
2255
|
},
|
|
2155
2256
|
{ _id: false }
|
|
2156
2257
|
);
|
|
2157
|
-
var resourceSchema = new
|
|
2258
|
+
var resourceSchema = new MongooseSchema23(
|
|
2158
2259
|
{
|
|
2159
2260
|
resourceId: { required: true, type: String },
|
|
2160
2261
|
resourceRegion: { required: true, type: String },
|
|
2161
2262
|
resourceSlug: { required: true, type: String },
|
|
2162
2263
|
resourceType: {
|
|
2163
|
-
enum: Object.values(
|
|
2264
|
+
enum: Object.values(import_cluemart_shared21.EnumResourceType),
|
|
2164
2265
|
required: true,
|
|
2165
2266
|
type: String
|
|
2166
2267
|
}
|
|
2167
2268
|
},
|
|
2168
2269
|
{ _id: false }
|
|
2169
2270
|
);
|
|
2170
|
-
var
|
|
2271
|
+
var schema23 = new MongooseSchema23(
|
|
2171
2272
|
{
|
|
2172
2273
|
active: { default: false, required: true, type: Boolean },
|
|
2173
2274
|
approvedAt: { default: null, required: false, type: Date },
|
|
@@ -2183,7 +2284,7 @@ var schema21 = new MongooseSchema21(
|
|
|
2183
2284
|
},
|
|
2184
2285
|
deletedAt: { default: null, required: false, type: Date },
|
|
2185
2286
|
postType: {
|
|
2186
|
-
enum: Object.values(
|
|
2287
|
+
enum: Object.values(import_cluemart_shared21.EnumPostType),
|
|
2187
2288
|
required: true,
|
|
2188
2289
|
type: String
|
|
2189
2290
|
},
|
|
@@ -2198,16 +2299,16 @@ var schema21 = new MongooseSchema21(
|
|
|
2198
2299
|
},
|
|
2199
2300
|
{ timestamps: true }
|
|
2200
2301
|
);
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
var PostModel =
|
|
2302
|
+
schema23.index({ title: 1 });
|
|
2303
|
+
schema23.index({ tags: 1 });
|
|
2304
|
+
schema23.index({ postType: 1, slug: 1 }, { unique: true });
|
|
2305
|
+
var PostModel = import_mongoose28.default.models.Post || import_mongoose28.default.model("Post", schema23);
|
|
2205
2306
|
|
|
2206
2307
|
// src/mongoose/AppSetting.ts
|
|
2207
|
-
var
|
|
2208
|
-
var
|
|
2308
|
+
var import_mongoose29 = __toESM(require("mongoose"));
|
|
2309
|
+
var MongooseSchema24 = import_mongoose29.default.Schema;
|
|
2209
2310
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
2210
|
-
var AppSettingSchema = new
|
|
2311
|
+
var AppSettingSchema = new MongooseSchema24(
|
|
2211
2312
|
{
|
|
2212
2313
|
activeSchoolsStudentCountTotal: {
|
|
2213
2314
|
default: 0,
|
|
@@ -2229,8 +2330,8 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2229
2330
|
validate: Number.isInteger
|
|
2230
2331
|
},
|
|
2231
2332
|
mobileDisplayEnabled: { default: false, required: true, type: Boolean },
|
|
2232
|
-
purchasePricing: { type:
|
|
2233
|
-
regionPricing: { type:
|
|
2333
|
+
purchasePricing: { type: MongooseSchema24.Types.Mixed },
|
|
2334
|
+
regionPricing: { type: MongooseSchema24.Types.Mixed },
|
|
2234
2335
|
paidSlotsPerPlacement: { enum: [30], type: Number },
|
|
2235
2336
|
reservedSlotsPerPlacement: { enum: [7], type: Number },
|
|
2236
2337
|
rotationSeconds: { enum: [8], type: Number },
|
|
@@ -2255,12 +2356,12 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2255
2356
|
},
|
|
2256
2357
|
{ timestamps: true }
|
|
2257
2358
|
);
|
|
2258
|
-
var AppSettingModel =
|
|
2359
|
+
var AppSettingModel = import_mongoose29.default.models.AppSetting || import_mongoose29.default.model("AppSetting", AppSettingSchema);
|
|
2259
2360
|
|
|
2260
2361
|
// src/mongoose/AuthHandoffToken.ts
|
|
2261
|
-
var
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2362
|
+
var import_mongoose30 = __toESM(require("mongoose"));
|
|
2363
|
+
var MongooseSchema25 = import_mongoose30.default.Schema;
|
|
2364
|
+
var schema24 = new MongooseSchema25(
|
|
2264
2365
|
{
|
|
2265
2366
|
expiresAt: { required: true, type: Date },
|
|
2266
2367
|
jti: { index: true, required: true, type: String, unique: true },
|
|
@@ -2269,25 +2370,25 @@ var schema22 = new MongooseSchema23(
|
|
|
2269
2370
|
index: true,
|
|
2270
2371
|
ref: "User",
|
|
2271
2372
|
required: true,
|
|
2272
|
-
type:
|
|
2373
|
+
type: import_mongoose30.default.Schema.Types.ObjectId
|
|
2273
2374
|
}
|
|
2274
2375
|
},
|
|
2275
2376
|
{ timestamps: true }
|
|
2276
2377
|
);
|
|
2277
|
-
|
|
2278
|
-
var AuthHandoffTokenModel =
|
|
2378
|
+
schema24.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2379
|
+
var AuthHandoffTokenModel = import_mongoose30.default.models.AuthHandoffToken || import_mongoose30.default.model("AuthHandoffToken", schema24);
|
|
2279
2380
|
|
|
2280
2381
|
// src/mongoose/game/Game.ts
|
|
2281
|
-
var
|
|
2282
|
-
var
|
|
2382
|
+
var import_cluemart_shared22 = require("@timardex/cluemart-shared");
|
|
2383
|
+
var import_mongoose34 = __toESM(require("mongoose"));
|
|
2283
2384
|
|
|
2284
2385
|
// src/mongoose/game/DailyClue.ts
|
|
2285
|
-
var
|
|
2386
|
+
var import_mongoose32 = __toESM(require("mongoose"));
|
|
2286
2387
|
|
|
2287
2388
|
// src/mongoose/game/utils.ts
|
|
2288
|
-
var
|
|
2289
|
-
var
|
|
2290
|
-
var schemaGameDate = new
|
|
2389
|
+
var import_mongoose31 = __toESM(require("mongoose"));
|
|
2390
|
+
var MongooseSchema26 = import_mongoose31.default.Schema;
|
|
2391
|
+
var schemaGameDate = new MongooseSchema26(
|
|
2291
2392
|
{
|
|
2292
2393
|
endDate: { required: true, type: Date },
|
|
2293
2394
|
startDate: { required: true, type: Date }
|
|
@@ -2296,8 +2397,8 @@ var schemaGameDate = new MongooseSchema24(
|
|
|
2296
2397
|
);
|
|
2297
2398
|
|
|
2298
2399
|
// src/mongoose/game/DailyClue.ts
|
|
2299
|
-
var
|
|
2300
|
-
var schemaLetters = new
|
|
2400
|
+
var MongooseSchema27 = import_mongoose32.default.Schema;
|
|
2401
|
+
var schemaLetters = new MongooseSchema27(
|
|
2301
2402
|
{
|
|
2302
2403
|
collected: { required: false, type: [String] },
|
|
2303
2404
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -2305,14 +2406,14 @@ var schemaLetters = new MongooseSchema25(
|
|
|
2305
2406
|
},
|
|
2306
2407
|
{ _id: false }
|
|
2307
2408
|
);
|
|
2308
|
-
var schemaDailyClueBaseGame = new
|
|
2409
|
+
var schemaDailyClueBaseGame = new MongooseSchema27(
|
|
2309
2410
|
{
|
|
2310
2411
|
gameDate: { required: true, type: schemaGameDate },
|
|
2311
2412
|
gameSolution: { required: true, type: String }
|
|
2312
2413
|
},
|
|
2313
2414
|
{ _id: false }
|
|
2314
2415
|
);
|
|
2315
|
-
var schemaDailyClueGameData = new
|
|
2416
|
+
var schemaDailyClueGameData = new MongooseSchema27(
|
|
2316
2417
|
{
|
|
2317
2418
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
2318
2419
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -2327,9 +2428,9 @@ var schemaDailyClueGameData = new MongooseSchema25(
|
|
|
2327
2428
|
);
|
|
2328
2429
|
|
|
2329
2430
|
// src/mongoose/game/PuzzleGame.ts
|
|
2330
|
-
var
|
|
2331
|
-
var
|
|
2332
|
-
var schemaPuzzleAnswer = new
|
|
2431
|
+
var import_mongoose33 = __toESM(require("mongoose"));
|
|
2432
|
+
var MongooseSchema28 = import_mongoose33.default.Schema;
|
|
2433
|
+
var schemaPuzzleAnswer = new MongooseSchema28(
|
|
2333
2434
|
{
|
|
2334
2435
|
answer: { required: true, type: String },
|
|
2335
2436
|
answerId: { required: true, type: String },
|
|
@@ -2337,7 +2438,7 @@ var schemaPuzzleAnswer = new MongooseSchema26(
|
|
|
2337
2438
|
},
|
|
2338
2439
|
{ _id: false }
|
|
2339
2440
|
);
|
|
2340
|
-
var schemaPuzzleQuestion = new
|
|
2441
|
+
var schemaPuzzleQuestion = new MongooseSchema28(
|
|
2341
2442
|
{
|
|
2342
2443
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
2343
2444
|
question: { required: true, type: String },
|
|
@@ -2345,20 +2446,20 @@ var schemaPuzzleQuestion = new MongooseSchema26(
|
|
|
2345
2446
|
},
|
|
2346
2447
|
{ _id: false }
|
|
2347
2448
|
);
|
|
2348
|
-
var schemaPuzzleBaseGame = new
|
|
2449
|
+
var schemaPuzzleBaseGame = new MongooseSchema28(
|
|
2349
2450
|
{
|
|
2350
2451
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
2351
2452
|
},
|
|
2352
2453
|
{ _id: false }
|
|
2353
2454
|
);
|
|
2354
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
2455
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema28(
|
|
2355
2456
|
{
|
|
2356
2457
|
questionId: { required: true, type: String },
|
|
2357
2458
|
selectedAnswerId: { required: true, type: String }
|
|
2358
2459
|
},
|
|
2359
2460
|
{ _id: false }
|
|
2360
2461
|
);
|
|
2361
|
-
var schemaPuzzleGameData = new
|
|
2462
|
+
var schemaPuzzleGameData = new MongooseSchema28(
|
|
2362
2463
|
{
|
|
2363
2464
|
answeredQuestions: {
|
|
2364
2465
|
default: null,
|
|
@@ -2373,30 +2474,30 @@ var schemaPuzzleGameData = new MongooseSchema26(
|
|
|
2373
2474
|
);
|
|
2374
2475
|
|
|
2375
2476
|
// src/mongoose/game/Game.ts
|
|
2376
|
-
var
|
|
2477
|
+
var MongooseSchema29 = import_mongoose34.default.Schema;
|
|
2377
2478
|
var gameDataSchemas = {
|
|
2378
|
-
[
|
|
2379
|
-
[
|
|
2380
|
-
[
|
|
2479
|
+
[import_cluemart_shared22.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2480
|
+
[import_cluemart_shared22.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2481
|
+
[import_cluemart_shared22.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2381
2482
|
};
|
|
2382
2483
|
var gameDataDefinition = Object.fromEntries(
|
|
2383
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2484
|
+
Object.entries(gameDataSchemas).map(([key, schema29]) => [
|
|
2384
2485
|
key,
|
|
2385
|
-
{ default: null, required: false, type:
|
|
2486
|
+
{ default: null, required: false, type: schema29 }
|
|
2386
2487
|
])
|
|
2387
2488
|
);
|
|
2388
|
-
var gameHistorySchema = new
|
|
2489
|
+
var gameHistorySchema = new MongooseSchema29(
|
|
2389
2490
|
{
|
|
2390
2491
|
createdAt: { required: true, type: Date },
|
|
2391
2492
|
gameDate: { required: true, type: schemaGameDate },
|
|
2392
2493
|
gameStatus: {
|
|
2393
|
-
enum: Object.values(
|
|
2494
|
+
enum: Object.values(import_cluemart_shared22.EnumGameStatus),
|
|
2394
2495
|
required: true,
|
|
2395
2496
|
type: String
|
|
2396
2497
|
},
|
|
2397
2498
|
gameTitle: { required: true, type: String },
|
|
2398
2499
|
gameType: {
|
|
2399
|
-
enum: Object.values(
|
|
2500
|
+
enum: Object.values(import_cluemart_shared22.EnumGameType),
|
|
2400
2501
|
required: true,
|
|
2401
2502
|
type: String
|
|
2402
2503
|
},
|
|
@@ -2405,14 +2506,14 @@ var gameHistorySchema = new MongooseSchema27(
|
|
|
2405
2506
|
},
|
|
2406
2507
|
{ _id: false }
|
|
2407
2508
|
);
|
|
2408
|
-
var gameTypeSchema = new
|
|
2509
|
+
var gameTypeSchema = new MongooseSchema29(
|
|
2409
2510
|
{
|
|
2410
2511
|
active: { default: true, required: true, type: Boolean },
|
|
2411
2512
|
gameData: gameDataDefinition,
|
|
2412
2513
|
gameHistory: { default: [], required: true, type: [gameHistorySchema] },
|
|
2413
2514
|
gameTitle: { required: true, type: String },
|
|
2414
2515
|
gameType: {
|
|
2415
|
-
enum: Object.values(
|
|
2516
|
+
enum: Object.values(import_cluemart_shared22.EnumGameType),
|
|
2416
2517
|
required: true,
|
|
2417
2518
|
type: String
|
|
2418
2519
|
},
|
|
@@ -2423,7 +2524,7 @@ var gameTypeSchema = new MongooseSchema27(
|
|
|
2423
2524
|
},
|
|
2424
2525
|
{ timestamps: true }
|
|
2425
2526
|
);
|
|
2426
|
-
var
|
|
2527
|
+
var schema25 = new MongooseSchema29(
|
|
2427
2528
|
{
|
|
2428
2529
|
active: { default: false, required: true, type: Boolean },
|
|
2429
2530
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2436,12 +2537,12 @@ var schema23 = new MongooseSchema27(
|
|
|
2436
2537
|
},
|
|
2437
2538
|
{ timestamps: true }
|
|
2438
2539
|
);
|
|
2439
|
-
var GameModel =
|
|
2540
|
+
var GameModel = import_mongoose34.default.models.Game || import_mongoose34.default.model("Game", schema25);
|
|
2440
2541
|
|
|
2441
2542
|
// src/mongoose/School.ts
|
|
2442
|
-
var
|
|
2443
|
-
var
|
|
2444
|
-
var campaignsSchema = new
|
|
2543
|
+
var import_mongoose35 = __toESM(require("mongoose"));
|
|
2544
|
+
var MongooseSchema30 = import_mongoose35.default.Schema;
|
|
2545
|
+
var campaignsSchema = new MongooseSchema30(
|
|
2445
2546
|
{
|
|
2446
2547
|
endDate: { required: true, type: Date },
|
|
2447
2548
|
name: { required: true, type: String },
|
|
@@ -2449,7 +2550,7 @@ var campaignsSchema = new MongooseSchema28(
|
|
|
2449
2550
|
},
|
|
2450
2551
|
{ _id: false }
|
|
2451
2552
|
);
|
|
2452
|
-
var
|
|
2553
|
+
var schema26 = new MongooseSchema30(
|
|
2453
2554
|
{
|
|
2454
2555
|
// New schools are active by default
|
|
2455
2556
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2476,26 +2577,26 @@ var schema24 = new MongooseSchema28(
|
|
|
2476
2577
|
},
|
|
2477
2578
|
{ timestamps: true }
|
|
2478
2579
|
);
|
|
2479
|
-
|
|
2580
|
+
schema26.index(
|
|
2480
2581
|
{ schoolCode: 1 },
|
|
2481
2582
|
{
|
|
2482
2583
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2483
2584
|
unique: true
|
|
2484
2585
|
}
|
|
2485
2586
|
);
|
|
2486
|
-
var SchoolModel =
|
|
2587
|
+
var SchoolModel = import_mongoose35.default.models.School || import_mongoose35.default.model("School", schema26);
|
|
2487
2588
|
|
|
2488
2589
|
// src/mongoose/Affiliate.ts
|
|
2489
|
-
var
|
|
2490
|
-
var
|
|
2491
|
-
var
|
|
2492
|
-
var affiliateRewardSchema = new
|
|
2590
|
+
var import_cluemart_shared23 = require("@timardex/cluemart-shared");
|
|
2591
|
+
var import_mongoose36 = __toESM(require("mongoose"));
|
|
2592
|
+
var MongooseSchema31 = import_mongoose36.default.Schema;
|
|
2593
|
+
var affiliateRewardSchema = new MongooseSchema31(
|
|
2493
2594
|
{
|
|
2494
2595
|
createdAt: { required: true, type: Date },
|
|
2495
2596
|
redeemedAt: { default: null, required: false, type: Date },
|
|
2496
2597
|
rewardDescription: { required: true, type: String },
|
|
2497
2598
|
rewardType: {
|
|
2498
|
-
enum: Object.values(
|
|
2599
|
+
enum: Object.values(import_cluemart_shared23.EnumAffiliateRewardType),
|
|
2499
2600
|
required: true,
|
|
2500
2601
|
type: String
|
|
2501
2602
|
},
|
|
@@ -2503,13 +2604,13 @@ var affiliateRewardSchema = new MongooseSchema29(
|
|
|
2503
2604
|
},
|
|
2504
2605
|
{ _id: false }
|
|
2505
2606
|
);
|
|
2506
|
-
var affiliateResourceSchema = new
|
|
2607
|
+
var affiliateResourceSchema = new MongooseSchema31(
|
|
2507
2608
|
{
|
|
2508
2609
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
2509
2610
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2510
2611
|
resourceId: {
|
|
2511
2612
|
required: true,
|
|
2512
|
-
type:
|
|
2613
|
+
type: import_mongoose36.default.Schema.Types.ObjectId
|
|
2513
2614
|
},
|
|
2514
2615
|
resourceName: { required: true, type: String },
|
|
2515
2616
|
resourceOwner: {
|
|
@@ -2517,7 +2618,7 @@ var affiliateResourceSchema = new MongooseSchema29(
|
|
|
2517
2618
|
type: OwnerTypeSchema
|
|
2518
2619
|
},
|
|
2519
2620
|
resourceType: {
|
|
2520
|
-
enum: Object.values(
|
|
2621
|
+
enum: Object.values(import_cluemart_shared23.EnumResourceType),
|
|
2521
2622
|
required: true,
|
|
2522
2623
|
type: String
|
|
2523
2624
|
},
|
|
@@ -2529,20 +2630,20 @@ var affiliateResourceSchema = new MongooseSchema29(
|
|
|
2529
2630
|
},
|
|
2530
2631
|
{ _id: false }
|
|
2531
2632
|
);
|
|
2532
|
-
var affiliateContactDetailsSchema = new
|
|
2633
|
+
var affiliateContactDetailsSchema = new MongooseSchema31(
|
|
2533
2634
|
{
|
|
2534
2635
|
mobilePhone: { required: true, type: String }
|
|
2535
2636
|
},
|
|
2536
2637
|
{ _id: false }
|
|
2537
2638
|
);
|
|
2538
|
-
var affiliateBankAccountDetailsSchema = new
|
|
2639
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema31(
|
|
2539
2640
|
{
|
|
2540
2641
|
accountHolderName: { required: true, type: String },
|
|
2541
2642
|
accountNumber: { required: true, type: String }
|
|
2542
2643
|
},
|
|
2543
2644
|
{ _id: false }
|
|
2544
2645
|
);
|
|
2545
|
-
var affiliateDetailsSchema = new
|
|
2646
|
+
var affiliateDetailsSchema = new MongooseSchema31(
|
|
2546
2647
|
{
|
|
2547
2648
|
bankAccountDetails: {
|
|
2548
2649
|
required: true,
|
|
@@ -2555,7 +2656,7 @@ var affiliateDetailsSchema = new MongooseSchema29(
|
|
|
2555
2656
|
lastName: { required: true, type: String },
|
|
2556
2657
|
location: { required: true, type: locationsSchema },
|
|
2557
2658
|
participantType: {
|
|
2558
|
-
enum: Object.values(
|
|
2659
|
+
enum: Object.values(import_cluemart_shared23.EnumAffiliateParticipantType),
|
|
2559
2660
|
required: true,
|
|
2560
2661
|
type: String
|
|
2561
2662
|
},
|
|
@@ -2564,7 +2665,7 @@ var affiliateDetailsSchema = new MongooseSchema29(
|
|
|
2564
2665
|
},
|
|
2565
2666
|
{ _id: false }
|
|
2566
2667
|
);
|
|
2567
|
-
var redeemHistorySchema = new
|
|
2668
|
+
var redeemHistorySchema = new MongooseSchema31(
|
|
2568
2669
|
{
|
|
2569
2670
|
paidAt: { default: null, required: false, type: Date },
|
|
2570
2671
|
redeemedAt: { required: true, type: Date },
|
|
@@ -2572,7 +2673,7 @@ var redeemHistorySchema = new MongooseSchema29(
|
|
|
2572
2673
|
},
|
|
2573
2674
|
{ _id: false }
|
|
2574
2675
|
);
|
|
2575
|
-
var
|
|
2676
|
+
var schema27 = new MongooseSchema31(
|
|
2576
2677
|
{
|
|
2577
2678
|
active: { default: false, required: true, type: Boolean },
|
|
2578
2679
|
affiliateBonusRewards: {
|
|
@@ -2602,26 +2703,26 @@ var schema25 = new MongooseSchema29(
|
|
|
2602
2703
|
},
|
|
2603
2704
|
{ timestamps: true }
|
|
2604
2705
|
);
|
|
2605
|
-
|
|
2706
|
+
schema27.index(
|
|
2606
2707
|
{ affiliateCode: 1 },
|
|
2607
2708
|
{
|
|
2608
2709
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2609
2710
|
unique: true
|
|
2610
2711
|
}
|
|
2611
2712
|
);
|
|
2612
|
-
var AffiliateModel =
|
|
2713
|
+
var AffiliateModel = import_mongoose36.default.models.Affiliate || import_mongoose36.default.model("Affiliate", schema27);
|
|
2613
2714
|
|
|
2614
2715
|
// src/mongoose/Coupon.ts
|
|
2615
|
-
var
|
|
2616
|
-
var
|
|
2617
|
-
var
|
|
2618
|
-
var couponOptionSchema = new
|
|
2716
|
+
var import_cluemart_shared24 = require("@timardex/cluemart-shared");
|
|
2717
|
+
var import_mongoose37 = __toESM(require("mongoose"));
|
|
2718
|
+
var MongooseSchema32 = import_mongoose37.default.Schema;
|
|
2719
|
+
var couponOptionSchema = new MongooseSchema32(
|
|
2619
2720
|
{
|
|
2620
2721
|
buy: { required: false, type: Number },
|
|
2621
2722
|
get: { required: false, type: Number },
|
|
2622
2723
|
maxRewardCount: { required: false, type: Number },
|
|
2623
2724
|
type: {
|
|
2624
|
-
enum: Object.values(
|
|
2725
|
+
enum: Object.values(import_cluemart_shared24.EnumCouponQualificationType),
|
|
2625
2726
|
required: true,
|
|
2626
2727
|
type: String
|
|
2627
2728
|
},
|
|
@@ -2630,29 +2731,29 @@ var couponOptionSchema = new MongooseSchema30(
|
|
|
2630
2731
|
},
|
|
2631
2732
|
{ _id: false }
|
|
2632
2733
|
);
|
|
2633
|
-
var couponVendorProductSchema = new
|
|
2734
|
+
var couponVendorProductSchema = new MongooseSchema32(
|
|
2634
2735
|
{
|
|
2635
2736
|
couponId: {
|
|
2636
2737
|
required: true,
|
|
2637
|
-
type:
|
|
2738
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2638
2739
|
},
|
|
2639
2740
|
productId: {
|
|
2640
2741
|
required: true,
|
|
2641
|
-
type:
|
|
2742
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2642
2743
|
},
|
|
2643
2744
|
vendorCouponId: {
|
|
2644
2745
|
required: false,
|
|
2645
|
-
type:
|
|
2746
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2646
2747
|
},
|
|
2647
2748
|
vendorId: {
|
|
2648
2749
|
ref: "Vendor",
|
|
2649
2750
|
required: true,
|
|
2650
|
-
type:
|
|
2751
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2651
2752
|
}
|
|
2652
2753
|
},
|
|
2653
2754
|
{ _id: false }
|
|
2654
2755
|
);
|
|
2655
|
-
var couponCodeSchema = new
|
|
2756
|
+
var couponCodeSchema = new MongooseSchema32(
|
|
2656
2757
|
{
|
|
2657
2758
|
code: { required: true, type: String },
|
|
2658
2759
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -2660,7 +2761,7 @@ var couponCodeSchema = new MongooseSchema30(
|
|
|
2660
2761
|
},
|
|
2661
2762
|
{ _id: false }
|
|
2662
2763
|
);
|
|
2663
|
-
var couponParticipantUserSchema = new
|
|
2764
|
+
var couponParticipantUserSchema = new MongooseSchema32(
|
|
2664
2765
|
{
|
|
2665
2766
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2666
2767
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -2669,12 +2770,12 @@ var couponParticipantUserSchema = new MongooseSchema30(
|
|
|
2669
2770
|
userId: {
|
|
2670
2771
|
ref: "User",
|
|
2671
2772
|
required: true,
|
|
2672
|
-
type:
|
|
2773
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2673
2774
|
}
|
|
2674
2775
|
},
|
|
2675
2776
|
{ timestamps: true }
|
|
2676
2777
|
);
|
|
2677
|
-
var couponDataSchema = new
|
|
2778
|
+
var couponDataSchema = new MongooseSchema32(
|
|
2678
2779
|
{
|
|
2679
2780
|
active: { default: true, required: true, type: Boolean },
|
|
2680
2781
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -2693,7 +2794,7 @@ var couponDataSchema = new MongooseSchema30(
|
|
|
2693
2794
|
},
|
|
2694
2795
|
resourceId: { required: true, type: String },
|
|
2695
2796
|
resourceType: {
|
|
2696
|
-
enum: Object.values(
|
|
2797
|
+
enum: Object.values(import_cluemart_shared24.EnumResourceType),
|
|
2697
2798
|
required: true,
|
|
2698
2799
|
type: String
|
|
2699
2800
|
},
|
|
@@ -2701,7 +2802,7 @@ var couponDataSchema = new MongooseSchema30(
|
|
|
2701
2802
|
},
|
|
2702
2803
|
{ timestamps: true }
|
|
2703
2804
|
);
|
|
2704
|
-
var
|
|
2805
|
+
var schema28 = new MongooseSchema32(
|
|
2705
2806
|
{
|
|
2706
2807
|
active: { default: true, required: true, type: Boolean },
|
|
2707
2808
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2713,62 +2814,62 @@ var schema26 = new MongooseSchema30(
|
|
|
2713
2814
|
},
|
|
2714
2815
|
{ timestamps: true }
|
|
2715
2816
|
);
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
var CouponModel =
|
|
2817
|
+
schema28.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2818
|
+
schema28.index({ "couponData.participantUsers.userId": 1 });
|
|
2819
|
+
var CouponModel = import_mongoose37.default.models.Coupon || import_mongoose37.default.model("Coupon", schema28);
|
|
2719
2820
|
|
|
2720
2821
|
// src/mongoose/Impersonation.ts
|
|
2721
|
-
var
|
|
2722
|
-
var
|
|
2723
|
-
var
|
|
2724
|
-
var impersonationSessionSchema = new
|
|
2822
|
+
var import_cluemart_shared25 = require("@timardex/cluemart-shared");
|
|
2823
|
+
var import_mongoose38 = __toESM(require("mongoose"));
|
|
2824
|
+
var MongooseSchema33 = import_mongoose38.default.Schema;
|
|
2825
|
+
var impersonationSessionSchema = new MongooseSchema33(
|
|
2725
2826
|
{
|
|
2726
2827
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
2727
2828
|
impersonatedUserId: {
|
|
2728
2829
|
index: true,
|
|
2729
2830
|
ref: "User",
|
|
2730
2831
|
required: true,
|
|
2731
|
-
type:
|
|
2832
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2732
2833
|
},
|
|
2733
2834
|
impersonatorUserId: {
|
|
2734
2835
|
index: true,
|
|
2735
2836
|
ref: "User",
|
|
2736
2837
|
required: true,
|
|
2737
|
-
type:
|
|
2838
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2738
2839
|
},
|
|
2739
2840
|
refreshToken: { required: true, type: String }
|
|
2740
2841
|
},
|
|
2741
2842
|
{ timestamps: true }
|
|
2742
2843
|
);
|
|
2743
|
-
var ImpersonationSessionModel =
|
|
2844
|
+
var ImpersonationSessionModel = import_mongoose38.default.models.ImpersonationSession || import_mongoose38.default.model(
|
|
2744
2845
|
"ImpersonationSession",
|
|
2745
2846
|
impersonationSessionSchema
|
|
2746
2847
|
);
|
|
2747
|
-
var impersonationAuditSchema = new
|
|
2848
|
+
var impersonationAuditSchema = new MongooseSchema33(
|
|
2748
2849
|
{
|
|
2749
2850
|
action: { enum: ["start", "end"], required: true, type: String },
|
|
2750
2851
|
endReason: { type: String },
|
|
2751
2852
|
impersonatedUserId: {
|
|
2752
2853
|
ref: "User",
|
|
2753
2854
|
required: true,
|
|
2754
|
-
type:
|
|
2855
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2755
2856
|
},
|
|
2756
2857
|
impersonatorUserId: {
|
|
2757
2858
|
ref: "User",
|
|
2758
2859
|
required: true,
|
|
2759
|
-
type:
|
|
2860
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2760
2861
|
},
|
|
2761
|
-
resourceId: { type:
|
|
2762
|
-
resourceType: { enum: Object.values(
|
|
2862
|
+
resourceId: { type: import_mongoose38.default.Schema.Types.ObjectId },
|
|
2863
|
+
resourceType: { enum: Object.values(import_cluemart_shared25.EnumResourceType), type: String },
|
|
2763
2864
|
sessionId: {
|
|
2764
2865
|
ref: "ImpersonationSession",
|
|
2765
2866
|
required: true,
|
|
2766
|
-
type:
|
|
2867
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2767
2868
|
}
|
|
2768
2869
|
},
|
|
2769
2870
|
{ timestamps: true }
|
|
2770
2871
|
);
|
|
2771
|
-
var ImpersonationAuditModel =
|
|
2872
|
+
var ImpersonationAuditModel = import_mongoose38.default.models.ImpersonationAudit || import_mongoose38.default.model(
|
|
2772
2873
|
"ImpersonationAudit",
|
|
2773
2874
|
impersonationAuditSchema
|
|
2774
2875
|
);
|
|
@@ -2789,7 +2890,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
|
|
|
2789
2890
|
}
|
|
2790
2891
|
|
|
2791
2892
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
2792
|
-
var
|
|
2893
|
+
var import_cluemart_shared27 = require("@timardex/cluemart-shared");
|
|
2793
2894
|
var import_utils3 = require("@timardex/cluemart-shared/utils");
|
|
2794
2895
|
|
|
2795
2896
|
// src/service/saveNotificationsInDb.ts
|
|
@@ -2924,7 +3025,7 @@ async function sendPushNotifications({
|
|
|
2924
3025
|
}
|
|
2925
3026
|
|
|
2926
3027
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
2927
|
-
var
|
|
3028
|
+
var import_cluemart_shared26 = require("@timardex/cluemart-shared");
|
|
2928
3029
|
var import_dayjs = __toESM(require("dayjs"));
|
|
2929
3030
|
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
2930
3031
|
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
@@ -2982,17 +3083,17 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
2982
3083
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
2983
3084
|
import_dayjs.default.extend(import_utc.default);
|
|
2984
3085
|
import_dayjs.default.extend(import_timezone.default);
|
|
2985
|
-
var SUBSCRIPTION_REWARD_TIMEZONE =
|
|
3086
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared26.NZ_TZ;
|
|
2986
3087
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
2987
3088
|
const { hasSubscription, validTypes } = await getVendorStripeSubscriptionPlanForRewards(userId, now);
|
|
2988
|
-
if (validTypes.has(
|
|
3089
|
+
if (validTypes.has(import_cluemart_shared26.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared26.EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
2989
3090
|
if (hasSubscription) {
|
|
2990
|
-
return
|
|
3091
|
+
return import_cluemart_shared26.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
|
|
2991
3092
|
}
|
|
2992
|
-
return
|
|
3093
|
+
return import_cluemart_shared26.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
2993
3094
|
}
|
|
2994
|
-
if (validTypes.has(
|
|
2995
|
-
return
|
|
3095
|
+
if (validTypes.has(import_cluemart_shared26.EnumUserLicence.STANDARD_VENDOR)) {
|
|
3096
|
+
return import_cluemart_shared26.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
2996
3097
|
}
|
|
2997
3098
|
return null;
|
|
2998
3099
|
}
|
|
@@ -3004,7 +3105,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
|
3004
3105
|
|
|
3005
3106
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
3006
3107
|
function isEligibleVendorResource(resource) {
|
|
3007
|
-
return resource.resourceType ===
|
|
3108
|
+
return resource.resourceType === import_cluemart_shared27.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
|
|
3008
3109
|
}
|
|
3009
3110
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
3010
3111
|
return await AffiliateModel.find({
|
|
@@ -3013,7 +3114,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
|
|
|
3013
3114
|
$elemMatch: {
|
|
3014
3115
|
resourceActive: true,
|
|
3015
3116
|
resourceDeletedAt: null,
|
|
3016
|
-
resourceType:
|
|
3117
|
+
resourceType: import_cluemart_shared27.EnumResourceType.VENDOR
|
|
3017
3118
|
}
|
|
3018
3119
|
},
|
|
3019
3120
|
deletedAt: null
|
|
@@ -3047,11 +3148,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
|
|
|
3047
3148
|
data: {
|
|
3048
3149
|
resourceId: String(affiliateId),
|
|
3049
3150
|
resourceName: resourceNames.join(", "),
|
|
3050
|
-
resourceType:
|
|
3151
|
+
resourceType: import_cluemart_shared27.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
|
|
3051
3152
|
},
|
|
3052
3153
|
message,
|
|
3053
3154
|
title: "Affiliate points earned",
|
|
3054
|
-
type:
|
|
3155
|
+
type: import_cluemart_shared27.EnumNotificationType.SYSTEM,
|
|
3055
3156
|
userIds: [affiliateOwnerUserId]
|
|
3056
3157
|
};
|
|
3057
3158
|
try {
|
|
@@ -3080,7 +3181,7 @@ async function tryAwardSubscriptionReward({
|
|
|
3080
3181
|
resourceActive: true,
|
|
3081
3182
|
resourceDeletedAt: null,
|
|
3082
3183
|
resourceId: resource.resourceId,
|
|
3083
|
-
resourceType:
|
|
3184
|
+
resourceType: import_cluemart_shared27.EnumResourceType.VENDOR,
|
|
3084
3185
|
rewards: {
|
|
3085
3186
|
$not: {
|
|
3086
3187
|
$elemMatch: {
|
|
@@ -3201,7 +3302,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
3201
3302
|
}
|
|
3202
3303
|
|
|
3203
3304
|
// src/service/database.ts
|
|
3204
|
-
var
|
|
3305
|
+
var import_mongoose42 = __toESM(require("mongoose"));
|
|
3205
3306
|
var connectToDatabase = async ({
|
|
3206
3307
|
appName,
|
|
3207
3308
|
dbName,
|
|
@@ -3214,7 +3315,7 @@ var connectToDatabase = async ({
|
|
|
3214
3315
|
// Fallback to MongoDB Atlas connection string
|
|
3215
3316
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
3216
3317
|
);
|
|
3217
|
-
await
|
|
3318
|
+
await import_mongoose42.default.connect(mongoUri);
|
|
3218
3319
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
3219
3320
|
console.log(
|
|
3220
3321
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -3227,7 +3328,7 @@ var connectToDatabase = async ({
|
|
|
3227
3328
|
|
|
3228
3329
|
// src/types/index.ts
|
|
3229
3330
|
var import_express = __toESM(require("express"));
|
|
3230
|
-
var
|
|
3331
|
+
var import_mongoose43 = __toESM(require("mongoose"));
|
|
3231
3332
|
|
|
3232
3333
|
// src/service/notifyUsers.ts
|
|
3233
3334
|
async function publishNotificationEvents(userId, pubsub) {
|
|
@@ -3275,9 +3376,9 @@ async function notifyUsers({
|
|
|
3275
3376
|
}
|
|
3276
3377
|
|
|
3277
3378
|
// src/service/updateAdStatus.ts
|
|
3278
|
-
var
|
|
3379
|
+
var import_cluemart_shared28 = require("@timardex/cluemart-shared");
|
|
3279
3380
|
async function updateAdStatuses() {
|
|
3280
|
-
const now = (0,
|
|
3381
|
+
const now = (0, import_cluemart_shared28.nzDayKey)();
|
|
3281
3382
|
const invalidResult = await AdModel.updateMany(
|
|
3282
3383
|
{
|
|
3283
3384
|
$or: [
|
|
@@ -3285,50 +3386,50 @@ async function updateAdStatuses() {
|
|
|
3285
3386
|
{ end: { $exists: false } },
|
|
3286
3387
|
{ $expr: { $gt: ["$start", "$end"] } }
|
|
3287
3388
|
],
|
|
3288
|
-
status: { $ne:
|
|
3389
|
+
status: { $ne: import_cluemart_shared28.EnumAdStatus.PAUSED }
|
|
3289
3390
|
},
|
|
3290
|
-
{ $set: { status:
|
|
3391
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.PAUSED } }
|
|
3291
3392
|
);
|
|
3292
3393
|
const expiredResult = await AdModel.updateMany(
|
|
3293
|
-
{ end: { $lte: now }, status: { $ne:
|
|
3294
|
-
{ $set: { status:
|
|
3394
|
+
{ end: { $lte: now }, status: { $ne: import_cluemart_shared28.EnumAdStatus.EXPIRED } },
|
|
3395
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.EXPIRED } }
|
|
3295
3396
|
);
|
|
3296
3397
|
const eligibleBooking = {
|
|
3297
3398
|
$or: [
|
|
3298
3399
|
{ bookingKind: { $exists: false } },
|
|
3299
3400
|
{ bookingKind: null },
|
|
3300
3401
|
{
|
|
3301
|
-
approvalStatus:
|
|
3302
|
-
bookingKind:
|
|
3402
|
+
approvalStatus: import_cluemart_shared28.EnumAdApprovalStatus.APPROVED,
|
|
3403
|
+
bookingKind: import_cluemart_shared28.EnumAdBookingSlotKind.RESERVED
|
|
3303
3404
|
},
|
|
3304
3405
|
{
|
|
3305
|
-
approvalStatus:
|
|
3306
|
-
bookingKind:
|
|
3307
|
-
paymentStatus:
|
|
3406
|
+
approvalStatus: import_cluemart_shared28.EnumAdApprovalStatus.APPROVED,
|
|
3407
|
+
bookingKind: import_cluemart_shared28.EnumAdBookingSlotKind.PAID,
|
|
3408
|
+
paymentStatus: import_cluemart_shared28.EnumAdPaymentStatus.PAID
|
|
3308
3409
|
}
|
|
3309
3410
|
]
|
|
3310
3411
|
};
|
|
3311
3412
|
const awaitingApprovalResult = await AdModel.updateMany(
|
|
3312
3413
|
{
|
|
3313
3414
|
$nor: eligibleBooking.$or,
|
|
3314
|
-
bookingKind: { $in: Object.values(
|
|
3415
|
+
bookingKind: { $in: Object.values(import_cluemart_shared28.EnumAdBookingSlotKind) },
|
|
3315
3416
|
end: { $gt: now },
|
|
3316
|
-
status:
|
|
3417
|
+
status: import_cluemart_shared28.EnumAdStatus.ACTIVE
|
|
3317
3418
|
},
|
|
3318
|
-
{ $set: { status:
|
|
3419
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.PAUSED } }
|
|
3319
3420
|
);
|
|
3320
3421
|
const activeResult = await AdModel.updateMany(
|
|
3321
3422
|
{
|
|
3322
3423
|
end: { $gt: now },
|
|
3323
3424
|
start: { $lte: now },
|
|
3324
|
-
status: { $ne:
|
|
3425
|
+
status: { $ne: import_cluemart_shared28.EnumAdStatus.ACTIVE },
|
|
3325
3426
|
...eligibleBooking
|
|
3326
3427
|
},
|
|
3327
|
-
{ $set: { status:
|
|
3428
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.ACTIVE } }
|
|
3328
3429
|
);
|
|
3329
3430
|
const pausedResult = await AdModel.updateMany(
|
|
3330
|
-
{ start: { $gt: now }, status: { $ne:
|
|
3331
|
-
{ $set: { status:
|
|
3431
|
+
{ start: { $gt: now }, status: { $ne: import_cluemart_shared28.EnumAdStatus.PAUSED } },
|
|
3432
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.PAUSED } }
|
|
3332
3433
|
);
|
|
3333
3434
|
console.log(
|
|
3334
3435
|
`\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
|
|
@@ -3336,15 +3437,15 @@ async function updateAdStatuses() {
|
|
|
3336
3437
|
}
|
|
3337
3438
|
|
|
3338
3439
|
// src/service/objectIdToString.ts
|
|
3339
|
-
var
|
|
3440
|
+
var import_mongoose45 = __toESM(require("mongoose"));
|
|
3340
3441
|
function isValidObjectId(value) {
|
|
3341
|
-
return
|
|
3442
|
+
return import_mongoose45.default.Types.ObjectId.isValid(value);
|
|
3342
3443
|
}
|
|
3343
3444
|
function convertObjectIdsToStrings(obj) {
|
|
3344
3445
|
if (obj === null || obj === void 0) {
|
|
3345
3446
|
return obj;
|
|
3346
3447
|
}
|
|
3347
|
-
if (obj instanceof
|
|
3448
|
+
if (obj instanceof import_mongoose45.default.Types.ObjectId) {
|
|
3348
3449
|
return obj.toString();
|
|
3349
3450
|
}
|
|
3350
3451
|
if (obj instanceof Date) {
|
|
@@ -3538,19 +3639,19 @@ function buildUserPointEntryRemovalPipeline(pointType, sourceId) {
|
|
|
3538
3639
|
}
|
|
3539
3640
|
|
|
3540
3641
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
3541
|
-
var
|
|
3642
|
+
var import_cluemart_shared30 = require("@timardex/cluemart-shared");
|
|
3542
3643
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
3543
3644
|
|
|
3544
3645
|
// src/service/event/archiveEndedEventDates.ts
|
|
3545
|
-
var
|
|
3646
|
+
var import_cluemart_shared29 = require("@timardex/cluemart-shared");
|
|
3546
3647
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
3547
3648
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
3548
3649
|
import_dayjs3.default.extend(import_customParseFormat.default);
|
|
3549
3650
|
var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
|
|
3550
|
-
|
|
3651
|
+
import_cluemart_shared29.EnumEventDateStatus.ENDED
|
|
3551
3652
|
]);
|
|
3552
3653
|
var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
|
|
3553
|
-
|
|
3654
|
+
import_cluemart_shared29.EnumEventDateStatus.INVALID
|
|
3554
3655
|
]);
|
|
3555
3656
|
function splitEventDatesForArchive(dateTime) {
|
|
3556
3657
|
return {
|
|
@@ -3573,12 +3674,12 @@ function dedupeArchivedSlotsByStartDateTime(slots) {
|
|
|
3573
3674
|
});
|
|
3574
3675
|
}
|
|
3575
3676
|
function isPastCanceledEventDate(slot, now) {
|
|
3576
|
-
if (slot.dateStatus !==
|
|
3677
|
+
if (slot.dateStatus !== import_cluemart_shared29.EnumEventDateStatus.CANCELED) {
|
|
3577
3678
|
return false;
|
|
3578
3679
|
}
|
|
3579
3680
|
const endDateTime = (0, import_dayjs3.default)(
|
|
3580
3681
|
`${slot.endDate} ${slot.endTime}`,
|
|
3581
|
-
`${
|
|
3682
|
+
`${import_cluemart_shared29.dateFormat} ${import_cluemart_shared29.timeFormat}`,
|
|
3582
3683
|
true
|
|
3583
3684
|
);
|
|
3584
3685
|
return endDateTime.isValid() && endDateTime.isBefore(now);
|
|
@@ -3624,7 +3725,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3624
3725
|
try {
|
|
3625
3726
|
for await (const doc of cursor) {
|
|
3626
3727
|
const dateTime = doc.dateTime.map(
|
|
3627
|
-
(slot) => (0,
|
|
3728
|
+
(slot) => (0, import_cluemart_shared30.updateSingleDateTimeStatus)(slot, now)
|
|
3628
3729
|
);
|
|
3629
3730
|
if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
|
|
3630
3731
|
continue;
|
|
@@ -3648,9 +3749,9 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3648
3749
|
var ARCHIVABLE_EVENT_FILTER = {
|
|
3649
3750
|
"dateTime.dateStatus": {
|
|
3650
3751
|
$in: [
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3752
|
+
import_cluemart_shared30.EnumEventDateStatus.ENDED,
|
|
3753
|
+
import_cluemart_shared30.EnumEventDateStatus.INVALID,
|
|
3754
|
+
import_cluemart_shared30.EnumEventDateStatus.CANCELED
|
|
3654
3755
|
]
|
|
3655
3756
|
},
|
|
3656
3757
|
deletedAt: null
|
|
@@ -3675,7 +3776,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3675
3776
|
try {
|
|
3676
3777
|
for await (const doc of cursor) {
|
|
3677
3778
|
const updated = doc.dateTime.map(
|
|
3678
|
-
(slot) => (0,
|
|
3779
|
+
(slot) => (0, import_cluemart_shared30.updateSingleDateTimeStatus)(slot, now)
|
|
3679
3780
|
);
|
|
3680
3781
|
const { archive, discard } = splitEventDatesForArchive(updated);
|
|
3681
3782
|
const pastCanceled = updated.filter(
|
|
@@ -3699,13 +3800,13 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3699
3800
|
if (archive.length > 0 || discard.length > 0) {
|
|
3700
3801
|
pullConditions.push({
|
|
3701
3802
|
dateStatus: {
|
|
3702
|
-
$in: [
|
|
3803
|
+
$in: [import_cluemart_shared30.EnumEventDateStatus.ENDED, import_cluemart_shared30.EnumEventDateStatus.INVALID]
|
|
3703
3804
|
}
|
|
3704
3805
|
});
|
|
3705
3806
|
}
|
|
3706
3807
|
for (const slot of pastCanceled) {
|
|
3707
3808
|
pullConditions.push({
|
|
3708
|
-
dateStatus:
|
|
3809
|
+
dateStatus: import_cluemart_shared30.EnumEventDateStatus.CANCELED,
|
|
3709
3810
|
startDate: slot.startDate,
|
|
3710
3811
|
startTime: slot.startTime
|
|
3711
3812
|
});
|
|
@@ -3747,9 +3848,9 @@ async function cleanEventInfoDates(now) {
|
|
|
3747
3848
|
try {
|
|
3748
3849
|
for await (const doc of cursor) {
|
|
3749
3850
|
const updated = doc.dateTime.map(
|
|
3750
|
-
(slot) => (0,
|
|
3851
|
+
(slot) => (0, import_cluemart_shared30.updateSingleDateTimeStatus)(slot, now)
|
|
3751
3852
|
);
|
|
3752
|
-
const kept = (0,
|
|
3853
|
+
const kept = (0, import_cluemart_shared30.filterDatesByFutureStatus)(updated);
|
|
3753
3854
|
if (kept.length === updated.length) {
|
|
3754
3855
|
continue;
|
|
3755
3856
|
}
|
|
@@ -3799,7 +3900,7 @@ async function updateAllEventDateTimeStatuses() {
|
|
|
3799
3900
|
}
|
|
3800
3901
|
|
|
3801
3902
|
// src/service/index.ts
|
|
3802
|
-
var
|
|
3903
|
+
var import_cluemart_shared38 = require("@timardex/cluemart-shared");
|
|
3803
3904
|
|
|
3804
3905
|
// src/service/event/findEventOrImportedMarketById.ts
|
|
3805
3906
|
async function findEventOrImportedMarketById(resourceId) {
|
|
@@ -3816,7 +3917,7 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
3816
3917
|
}
|
|
3817
3918
|
|
|
3818
3919
|
// src/service/relations.ts
|
|
3819
|
-
var
|
|
3920
|
+
var import_cluemart_shared31 = require("@timardex/cluemart-shared");
|
|
3820
3921
|
function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
3821
3922
|
if (!previousDateTime?.length) {
|
|
3822
3923
|
return false;
|
|
@@ -3832,8 +3933,8 @@ function didRemoveAnyStartedDates(previousDateTime, nextDateTime) {
|
|
|
3832
3933
|
return false;
|
|
3833
3934
|
}
|
|
3834
3935
|
return previousDateTime.some(
|
|
3835
|
-
(prev) => prev.dateStatus ===
|
|
3836
|
-
(next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus ===
|
|
3936
|
+
(prev) => prev.dateStatus === import_cluemart_shared31.EnumEventDateStatus.STARTED && !nextDateTime?.some(
|
|
3937
|
+
(next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared31.EnumEventDateStatus.STARTED
|
|
3837
3938
|
)
|
|
3838
3939
|
);
|
|
3839
3940
|
}
|
|
@@ -3844,7 +3945,7 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
|
|
|
3844
3945
|
) ?? false;
|
|
3845
3946
|
return {
|
|
3846
3947
|
...relationDate,
|
|
3847
|
-
status: existsInEvent ? relationDate.status :
|
|
3948
|
+
status: existsInEvent ? relationDate.status : import_cluemart_shared31.EnumInviteStatus.CANCELED
|
|
3848
3949
|
};
|
|
3849
3950
|
});
|
|
3850
3951
|
}
|
|
@@ -3853,15 +3954,15 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
|
|
|
3853
3954
|
var import_dayjs8 = __toESM(require("dayjs"));
|
|
3854
3955
|
|
|
3855
3956
|
// src/service/license/compliance/utils.ts
|
|
3856
|
-
var
|
|
3957
|
+
var import_cluemart_shared36 = require("@timardex/cluemart-shared");
|
|
3857
3958
|
var import_dayjs7 = __toESM(require("dayjs"));
|
|
3858
3959
|
|
|
3859
3960
|
// src/service/license/compliance/event.ts
|
|
3860
|
-
var
|
|
3961
|
+
var import_cluemart_shared32 = require("@timardex/cluemart-shared");
|
|
3861
3962
|
var eventLicences = [
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3963
|
+
import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
|
|
3964
|
+
import_cluemart_shared32.EnumUserLicence.PRO_EVENT,
|
|
3965
|
+
import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT
|
|
3865
3966
|
];
|
|
3866
3967
|
async function handleEventLicenceCompliance(user, now) {
|
|
3867
3968
|
if (!user.licences || !user.events?.length) {
|
|
@@ -4073,9 +4174,9 @@ function buildLicenceExpiryPipeline(params) {
|
|
|
4073
4174
|
}
|
|
4074
4175
|
|
|
4075
4176
|
// src/service/license/compliance/partner.ts
|
|
4076
|
-
var
|
|
4177
|
+
var import_cluemart_shared33 = require("@timardex/cluemart-shared");
|
|
4077
4178
|
var partnerLicences = [
|
|
4078
|
-
|
|
4179
|
+
import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER
|
|
4079
4180
|
];
|
|
4080
4181
|
async function handlePartnerLicenceCompliance(user, now) {
|
|
4081
4182
|
if (!user.licences || !user.partner) {
|
|
@@ -4085,11 +4186,11 @@ async function handlePartnerLicenceCompliance(user, now) {
|
|
|
4085
4186
|
}
|
|
4086
4187
|
|
|
4087
4188
|
// src/service/license/compliance/vendor.ts
|
|
4088
|
-
var
|
|
4189
|
+
var import_cluemart_shared35 = require("@timardex/cluemart-shared");
|
|
4089
4190
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
4090
4191
|
|
|
4091
4192
|
// src/service/license/models.ts
|
|
4092
|
-
var
|
|
4193
|
+
var import_cluemart_shared34 = require("@timardex/cluemart-shared");
|
|
4093
4194
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
4094
4195
|
var import_graphql = require("graphql");
|
|
4095
4196
|
var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
@@ -4101,31 +4202,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
|
4101
4202
|
return LicenceCategory2;
|
|
4102
4203
|
})(LicenceCategory || {});
|
|
4103
4204
|
var licenceCategoryMapping = {
|
|
4104
|
-
[
|
|
4105
|
-
[
|
|
4106
|
-
[
|
|
4107
|
-
[
|
|
4108
|
-
[
|
|
4109
|
-
[
|
|
4110
|
-
[
|
|
4111
|
-
[
|
|
4112
|
-
[
|
|
4205
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
|
|
4206
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
|
|
4207
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
|
|
4208
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
|
|
4209
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
|
|
4210
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
|
|
4211
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
|
|
4212
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
4213
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
|
|
4113
4214
|
};
|
|
4114
4215
|
var licencePriority = {
|
|
4115
|
-
[
|
|
4116
|
-
[
|
|
4117
|
-
[
|
|
4118
|
-
[
|
|
4119
|
-
[
|
|
4120
|
-
[
|
|
4121
|
-
[
|
|
4122
|
-
[
|
|
4123
|
-
[
|
|
4216
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_EVENT]: 3,
|
|
4217
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_EVENT]: 2,
|
|
4218
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT]: 1,
|
|
4219
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
|
|
4220
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_VENDOR]: 2,
|
|
4221
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR]: 1,
|
|
4222
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER]: 1,
|
|
4223
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_AFFILIATE]: 1,
|
|
4224
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_SCHOOL]: 1
|
|
4124
4225
|
};
|
|
4125
4226
|
var standardLicences = [
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4227
|
+
import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR,
|
|
4228
|
+
import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT,
|
|
4229
|
+
import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER
|
|
4129
4230
|
];
|
|
4130
4231
|
var standardLicenceSet = new Set(standardLicences);
|
|
4131
4232
|
function isStandardLicence(licence) {
|
|
@@ -4139,11 +4240,11 @@ var categoryRegexMapping = {
|
|
|
4139
4240
|
["school" /* SCHOOL */]: /_school$/
|
|
4140
4241
|
};
|
|
4141
4242
|
var categoryFallbackLicence = {
|
|
4142
|
-
["event" /* EVENT */]:
|
|
4143
|
-
["partner" /* PARTNER */]:
|
|
4144
|
-
["vendor" /* VENDOR */]:
|
|
4145
|
-
["affiliate" /* AFFILIATE */]:
|
|
4146
|
-
["school" /* SCHOOL */]:
|
|
4243
|
+
["event" /* EVENT */]: import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT,
|
|
4244
|
+
["partner" /* PARTNER */]: import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER,
|
|
4245
|
+
["vendor" /* VENDOR */]: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR,
|
|
4246
|
+
["affiliate" /* AFFILIATE */]: import_cluemart_shared34.EnumUserLicence.STANDARD_AFFILIATE,
|
|
4247
|
+
["school" /* SCHOOL */]: import_cluemart_shared34.EnumUserLicence.STANDARD_SCHOOL
|
|
4147
4248
|
};
|
|
4148
4249
|
var LicenceFilterInput = {
|
|
4149
4250
|
INPUT_USER_LICENCES: "$licences"
|
|
@@ -4173,11 +4274,11 @@ function getHighestLicenceForCategory(licences, category) {
|
|
|
4173
4274
|
function createLicenceObject(expiryDate, licenceType) {
|
|
4174
4275
|
const today = (0, import_dayjs5.default)();
|
|
4175
4276
|
const expiryDateMapping = {
|
|
4176
|
-
[
|
|
4177
|
-
[
|
|
4178
|
-
[
|
|
4179
|
-
[
|
|
4180
|
-
[
|
|
4277
|
+
[import_cluemart_shared34.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
|
|
4278
|
+
[import_cluemart_shared34.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
|
|
4279
|
+
[import_cluemart_shared34.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
|
|
4280
|
+
[import_cluemart_shared34.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
|
|
4281
|
+
[import_cluemart_shared34.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
|
|
4181
4282
|
};
|
|
4182
4283
|
const licenceObject = {
|
|
4183
4284
|
expiryDate: expiryDateMapping[expiryDate],
|
|
@@ -4281,13 +4382,13 @@ async function checkOwnerHasLicence({
|
|
|
4281
4382
|
const owner = await UserModel.findById(userId);
|
|
4282
4383
|
if (!owner) throw new import_graphql.GraphQLError("Owner not found");
|
|
4283
4384
|
const categoryByResource = {
|
|
4284
|
-
[
|
|
4285
|
-
[
|
|
4286
|
-
[
|
|
4287
|
-
[
|
|
4288
|
-
[
|
|
4385
|
+
[import_cluemart_shared34.EnumResourceType.EVENT]: "event" /* EVENT */,
|
|
4386
|
+
[import_cluemart_shared34.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
|
|
4387
|
+
[import_cluemart_shared34.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
|
|
4388
|
+
[import_cluemart_shared34.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
4389
|
+
[import_cluemart_shared34.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
|
|
4289
4390
|
};
|
|
4290
|
-
if (!(0,
|
|
4391
|
+
if (!(0, import_cluemart_shared34.isNonVisitorResourceType)(resourceType)) {
|
|
4291
4392
|
throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
|
|
4292
4393
|
}
|
|
4293
4394
|
const requiredCategory = categoryByResource[resourceType];
|
|
@@ -4367,7 +4468,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
|
|
|
4367
4468
|
return (result?.matchedCount ?? 0) > 0;
|
|
4368
4469
|
}
|
|
4369
4470
|
async function downgradeVendorProFeatures(userId, licenceType) {
|
|
4370
|
-
const isStandardVendor = licenceType ===
|
|
4471
|
+
const isStandardVendor = licenceType === import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR;
|
|
4371
4472
|
if (!isStandardVendor) {
|
|
4372
4473
|
return;
|
|
4373
4474
|
}
|
|
@@ -4414,7 +4515,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
|
|
|
4414
4515
|
return (result?.matchedCount ?? 0) > 0;
|
|
4415
4516
|
}
|
|
4416
4517
|
async function restoreVendorProFeatures(userId, licenceType) {
|
|
4417
|
-
const isProVendor = licenceType ===
|
|
4518
|
+
const isProVendor = licenceType === import_cluemart_shared35.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR;
|
|
4418
4519
|
if (!isProVendor) {
|
|
4419
4520
|
return;
|
|
4420
4521
|
}
|
|
@@ -4435,14 +4536,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
|
4435
4536
|
return false;
|
|
4436
4537
|
}
|
|
4437
4538
|
const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs6.default)(stripe.paymentGracePeriodEndsAt) : null;
|
|
4438
|
-
const hasActivePaymentGracePeriod = (stripe.status ===
|
|
4539
|
+
const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared35.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared35.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
|
|
4439
4540
|
if (hasActivePaymentGracePeriod) {
|
|
4440
4541
|
return true;
|
|
4441
4542
|
}
|
|
4442
4543
|
if (!stripe.subscriptionId) {
|
|
4443
4544
|
return false;
|
|
4444
4545
|
}
|
|
4445
|
-
if (stripe.status !==
|
|
4546
|
+
if (stripe.status !== import_cluemart_shared35.EnumSubscriptionStatus.ACTIVE) {
|
|
4446
4547
|
return false;
|
|
4447
4548
|
}
|
|
4448
4549
|
if (!stripe.endDate) {
|
|
@@ -4462,7 +4563,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4462
4563
|
return;
|
|
4463
4564
|
}
|
|
4464
4565
|
const proLicences = vendorLicencesOfUser.filter(
|
|
4465
|
-
(licence) => licence.licenceType !==
|
|
4566
|
+
(licence) => licence.licenceType !== import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
|
|
4466
4567
|
);
|
|
4467
4568
|
const expiredProLicences = proLicences.filter(
|
|
4468
4569
|
(licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now)
|
|
@@ -4475,7 +4576,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4475
4576
|
const expiredProLicence = expiredProLicences.some(
|
|
4476
4577
|
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
4477
4578
|
);
|
|
4478
|
-
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences,
|
|
4579
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared35.vendorLicences, now);
|
|
4479
4580
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
4480
4581
|
(licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
4481
4582
|
);
|
|
@@ -4491,7 +4592,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4491
4592
|
"owner.userId": user._id
|
|
4492
4593
|
}).lean().exec();
|
|
4493
4594
|
}
|
|
4494
|
-
const licencesToSync =
|
|
4595
|
+
const licencesToSync = import_cluemart_shared35.vendorLicences.filter(
|
|
4495
4596
|
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
4496
4597
|
);
|
|
4497
4598
|
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
@@ -4506,11 +4607,11 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4506
4607
|
data: {
|
|
4507
4608
|
resourceId: String(vendor._id),
|
|
4508
4609
|
resourceName: vendor.name,
|
|
4509
|
-
resourceType:
|
|
4610
|
+
resourceType: import_cluemart_shared35.EnumNotificationResourceType.DOWNGRADED_VENDOR
|
|
4510
4611
|
},
|
|
4511
4612
|
message: `Your Vendor licence has been downgraded due to licence expiration.`,
|
|
4512
4613
|
title: `Vendor Licence Downgraded`,
|
|
4513
|
-
type:
|
|
4614
|
+
type: import_cluemart_shared35.EnumNotificationType.SYSTEM,
|
|
4514
4615
|
userIds: [user._id]
|
|
4515
4616
|
};
|
|
4516
4617
|
await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
|
|
@@ -4543,7 +4644,7 @@ async function vendorOwnerHasProLicence(vendorId) {
|
|
|
4543
4644
|
effectiveVendorLicences,
|
|
4544
4645
|
"vendor" /* VENDOR */
|
|
4545
4646
|
);
|
|
4546
|
-
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[
|
|
4647
|
+
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared35.EnumUserLicence.PRO_VENDOR];
|
|
4547
4648
|
}
|
|
4548
4649
|
|
|
4549
4650
|
// src/service/license/compliance/utils.ts
|
|
@@ -4553,12 +4654,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
|
|
|
4553
4654
|
const pipeline = buildLicenceExpiryPipeline({
|
|
4554
4655
|
downgradeBranches: [
|
|
4555
4656
|
{
|
|
4556
|
-
case:
|
|
4557
|
-
then:
|
|
4657
|
+
case: import_cluemart_shared36.EnumUserLicence.PRO_PLUS_VENDOR,
|
|
4658
|
+
then: import_cluemart_shared36.EnumUserLicence.STANDARD_VENDOR
|
|
4558
4659
|
},
|
|
4559
4660
|
{
|
|
4560
|
-
case:
|
|
4561
|
-
then:
|
|
4661
|
+
case: import_cluemart_shared36.EnumUserLicence.PRO_VENDOR,
|
|
4662
|
+
then: import_cluemart_shared36.EnumUserLicence.STANDARD_VENDOR
|
|
4562
4663
|
}
|
|
4563
4664
|
],
|
|
4564
4665
|
licenceTypes,
|
|
@@ -4687,7 +4788,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
|
4687
4788
|
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
4688
4789
|
|
|
4689
4790
|
// src/service/license/reminder/utils.ts
|
|
4690
|
-
var
|
|
4791
|
+
var import_cluemart_shared37 = require("@timardex/cluemart-shared");
|
|
4691
4792
|
var import_utils8 = require("@timardex/cluemart-shared/utils");
|
|
4692
4793
|
var import_dayjs9 = __toESM(require("dayjs"));
|
|
4693
4794
|
|
|
@@ -4753,28 +4854,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
|
4753
4854
|
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
4754
4855
|
}
|
|
4755
4856
|
function getLicenseName(licenceType) {
|
|
4756
|
-
return
|
|
4857
|
+
return import_cluemart_shared37.licenseNiceNames[licenceType] || licenceType;
|
|
4757
4858
|
}
|
|
4758
4859
|
function getNotificationTypes(isVendorLicense, isPartnerLicense) {
|
|
4759
4860
|
if (isVendorLicense) {
|
|
4760
4861
|
return {
|
|
4761
|
-
notificationType:
|
|
4762
|
-
resourceType:
|
|
4862
|
+
notificationType: import_cluemart_shared37.EnumNotificationType.SYSTEM,
|
|
4863
|
+
resourceType: import_cluemart_shared37.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
|
|
4763
4864
|
};
|
|
4764
4865
|
}
|
|
4765
4866
|
if (isPartnerLicense) {
|
|
4766
4867
|
return {
|
|
4767
|
-
notificationType:
|
|
4768
|
-
resourceType:
|
|
4868
|
+
notificationType: import_cluemart_shared37.EnumNotificationType.SYSTEM,
|
|
4869
|
+
resourceType: import_cluemart_shared37.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
|
|
4769
4870
|
};
|
|
4770
4871
|
}
|
|
4771
4872
|
return {
|
|
4772
|
-
notificationType:
|
|
4773
|
-
resourceType:
|
|
4873
|
+
notificationType: import_cluemart_shared37.EnumNotificationType.SYSTEM,
|
|
4874
|
+
resourceType: import_cluemart_shared37.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
|
|
4774
4875
|
};
|
|
4775
4876
|
}
|
|
4776
4877
|
async function getLicenseResourceInfo(user, licence) {
|
|
4777
|
-
const isVendorLicense =
|
|
4878
|
+
const isVendorLicense = import_cluemart_shared37.vendorLicences.includes(licence.licenceType);
|
|
4778
4879
|
const isPartnerLicense = partnerLicences.includes(licence.licenceType);
|
|
4779
4880
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4780
4881
|
const { notificationType, resourceType } = getNotificationTypes(
|
|
@@ -4822,11 +4923,11 @@ async function getLicenseResourceInfo(user, licence) {
|
|
|
4822
4923
|
};
|
|
4823
4924
|
}
|
|
4824
4925
|
function getLicenceExpiryMode(licenceType) {
|
|
4825
|
-
return licenceType ===
|
|
4926
|
+
return licenceType === import_cluemart_shared37.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared37.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
|
|
4826
4927
|
}
|
|
4827
4928
|
async function sendLicenseReminder(user, licence) {
|
|
4828
4929
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4829
|
-
const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(
|
|
4930
|
+
const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared37.dateFormat);
|
|
4830
4931
|
const userId = String(user._id);
|
|
4831
4932
|
const resourceInfo = await getLicenseResourceInfo(user, licence);
|
|
4832
4933
|
if (!resourceInfo) {
|