@timardex/cluemart-server-shared 4.0.0 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-MVQMMXGY.mjs → chunk-3ICI65FJ.mjs} +363 -240
- package/dist/chunk-3ICI65FJ.mjs.map +1 -0
- package/dist/index.cjs +554 -430
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +105 -8
- package/dist/index.d.ts +105 -8
- package/dist/index.mjs +369 -246
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +424 -300
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +101 -5
- package/dist/mongoose/index.d.ts +101 -5
- package/dist/mongoose/index.mjs +11 -3
- package/dist/service/index.cjs +541 -427
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +4 -3
- package/dist/service/index.d.ts +4 -3
- package/dist/service/index.mjs +1 -1
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-MVQMMXGY.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ACTIVE_NOT_DELETED_FILTER: () => ACTIVE_NOT_DELETED_FILTER,
|
|
34
34
|
AD_BILLING_CATALOG_COLLECTION_NAME: () => AD_BILLING_CATALOG_COLLECTION_NAME,
|
|
35
|
+
AI_IMPORT_RUN_LOCK_KEY: () => AI_IMPORT_RUN_LOCK_KEY,
|
|
35
36
|
APP_SETTINGS_ID: () => APP_SETTINGS_ID,
|
|
36
37
|
AdBillingCatalogModel: () => AdBillingCatalogModel,
|
|
37
38
|
AdBookingModel: () => AdBookingModel,
|
|
@@ -39,6 +40,8 @@ __export(index_exports, {
|
|
|
39
40
|
AdModel: () => AdModel,
|
|
40
41
|
AdPurchaseModel: () => AdPurchaseModel,
|
|
41
42
|
AffiliateModel: () => AffiliateModel,
|
|
43
|
+
AiImportRunLockModel: () => AiImportRunLockModel,
|
|
44
|
+
AiImportRunModel: () => AiImportRunModel,
|
|
42
45
|
AiImportedMarketModel: () => AiImportedMarketModel,
|
|
43
46
|
AppSettingModel: () => AppSettingModel,
|
|
44
47
|
AuthHandoffTokenModel: () => AuthHandoffTokenModel,
|
|
@@ -69,9 +72,10 @@ __export(index_exports, {
|
|
|
69
72
|
RelationTypeSchema: () => RelationTypeSchema,
|
|
70
73
|
ResourceActivityModel: () => ResourceActivityModel,
|
|
71
74
|
ResourceImageTypeSchema: () => ResourceImageTypeSchema,
|
|
75
|
+
SCRAPE_SITES_CONFIG_ID: () => SCRAPE_SITES_CONFIG_ID,
|
|
72
76
|
SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
|
|
73
77
|
SchoolModel: () => SchoolModel,
|
|
74
|
-
|
|
78
|
+
ScrapeSiteConfigModel: () => ScrapeSiteConfigModel,
|
|
75
79
|
SocialMediaTypeSchema: () => SocialMediaTypeSchema,
|
|
76
80
|
StallTypeSchema: () => StallTypeSchema,
|
|
77
81
|
UnregisteredVendorModel: () => UnregisteredVendorModel,
|
|
@@ -126,7 +130,7 @@ __export(index_exports, {
|
|
|
126
130
|
locationGeoSchema: () => locationGeoSchema,
|
|
127
131
|
locationsSchema: () => locationsSchema,
|
|
128
132
|
mapVendorLicenceToSubscriptionRewardType: () => mapVendorLicenceToSubscriptionRewardType,
|
|
129
|
-
mongoose: () =>
|
|
133
|
+
mongoose: () => import_mongoose43.default,
|
|
130
134
|
normalizeAffiliatePromoCodes: () => normalizeAffiliatePromoCodes,
|
|
131
135
|
normalizePromoCode: () => normalizePromoCode,
|
|
132
136
|
notifyUsers: () => notifyUsers,
|
|
@@ -155,7 +159,7 @@ __export(index_exports, {
|
|
|
155
159
|
updateAdStatuses: () => updateAdStatuses,
|
|
156
160
|
updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
|
|
157
161
|
updateRelationDatesToCanceled: () => updateRelationDatesToCanceled,
|
|
158
|
-
updateSingleDateTimeStatus: () =>
|
|
162
|
+
updateSingleDateTimeStatus: () => import_cluemart_shared38.updateSingleDateTimeStatus,
|
|
159
163
|
upgradeUserToLicence: () => upgradeUserToLicence,
|
|
160
164
|
userLicenseSchema: () => userLicenseSchema,
|
|
161
165
|
vendorOwnerHasProLicence: () => vendorOwnerHasProLicence,
|
|
@@ -1084,15 +1088,15 @@ function syncSearchNameInUpdate(update) {
|
|
|
1084
1088
|
}
|
|
1085
1089
|
return null;
|
|
1086
1090
|
}
|
|
1087
|
-
function searchNamePlugin(
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
+
function searchNamePlugin(schema29) {
|
|
1092
|
+
schema29.add({ searchName: { default: "", required: false, type: String } });
|
|
1093
|
+
schema29.index({ searchName: 1 });
|
|
1094
|
+
schema29.pre("save", function syncSearchNameOnSave(next) {
|
|
1091
1095
|
const doc = this;
|
|
1092
1096
|
doc.searchName = deriveSearchName(doc.name);
|
|
1093
1097
|
next();
|
|
1094
1098
|
});
|
|
1095
|
-
|
|
1099
|
+
schema29.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
1096
1100
|
const list = Array.isArray(docs) ? docs : [docs];
|
|
1097
1101
|
for (const doc of list) {
|
|
1098
1102
|
if (doc && typeof doc.name === "string") {
|
|
@@ -1101,7 +1105,7 @@ function searchNamePlugin(schema28) {
|
|
|
1101
1105
|
}
|
|
1102
1106
|
next();
|
|
1103
1107
|
});
|
|
1104
|
-
|
|
1108
|
+
schema29.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
1105
1109
|
for (const op of ops) {
|
|
1106
1110
|
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
1107
1111
|
if (doc && typeof doc.name === "string") {
|
|
@@ -1127,7 +1131,7 @@ function searchNamePlugin(schema28) {
|
|
|
1127
1131
|
}
|
|
1128
1132
|
next();
|
|
1129
1133
|
};
|
|
1130
|
-
|
|
1134
|
+
schema29.pre(
|
|
1131
1135
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
1132
1136
|
syncSearchNameOnUpdate
|
|
1133
1137
|
);
|
|
@@ -1164,6 +1168,7 @@ var schema7 = new MongooseSchema6(
|
|
|
1164
1168
|
dateTime: [dateTimeSchema],
|
|
1165
1169
|
deletedAt: { default: null, required: false, type: Date },
|
|
1166
1170
|
description: { required: true, type: String },
|
|
1171
|
+
earliestStartDate: { default: null, required: false, type: Date },
|
|
1167
1172
|
eventId: {
|
|
1168
1173
|
ref: "Event",
|
|
1169
1174
|
required: false,
|
|
@@ -1206,6 +1211,7 @@ schema7.index({ name: 1 });
|
|
|
1206
1211
|
schema7.index({ region: 1 });
|
|
1207
1212
|
schema7.index({ deletedAt: 1 });
|
|
1208
1213
|
schema7.index({ "dateTime.dateStatus": 1 });
|
|
1214
|
+
schema7.index({ earliestStartDate: 1, _id: 1 });
|
|
1209
1215
|
schema7.index({ slug: 1 });
|
|
1210
1216
|
schema7.index({ description: "text", name: "text" });
|
|
1211
1217
|
schema7.plugin(searchNamePlugin);
|
|
@@ -1241,8 +1247,16 @@ var schema8 = new MongooseSchema7(
|
|
|
1241
1247
|
type: ResourceImageTypeSchema
|
|
1242
1248
|
},
|
|
1243
1249
|
dateTime: [dateTimeSchema],
|
|
1250
|
+
deactivatedReason: {
|
|
1251
|
+
enum: Object.values(import_cluemart_shared10.EnumImportedMarketDeactivationReason),
|
|
1252
|
+
required: false,
|
|
1253
|
+
type: String
|
|
1254
|
+
},
|
|
1244
1255
|
deletedAt: { default: null, required: false, type: Date },
|
|
1245
1256
|
description: { required: true, type: String },
|
|
1257
|
+
descriptionSourceHash: { required: false, type: String },
|
|
1258
|
+
duplicateHint: { required: false, type: String },
|
|
1259
|
+
earliestStartDate: { default: null, required: false, type: Date },
|
|
1246
1260
|
eventId: {
|
|
1247
1261
|
ref: "Event",
|
|
1248
1262
|
required: false,
|
|
@@ -1254,11 +1268,13 @@ var schema8 = new MongooseSchema7(
|
|
|
1254
1268
|
type: String
|
|
1255
1269
|
},
|
|
1256
1270
|
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
1271
|
+
lastSeenAt: { default: null, required: false, type: Date },
|
|
1257
1272
|
location: {
|
|
1258
1273
|
required: true,
|
|
1259
1274
|
type: locationsSchema
|
|
1260
1275
|
},
|
|
1261
1276
|
logo: { required: false, type: ResourceImageTypeSchema },
|
|
1277
|
+
missedRuns: { default: 0, required: true, type: Number },
|
|
1262
1278
|
name: { required: true, type: String },
|
|
1263
1279
|
openingHours: { required: false, type: [String] },
|
|
1264
1280
|
rainOrShine: { required: true, type: Boolean },
|
|
@@ -1288,6 +1304,7 @@ var schema8 = new MongooseSchema7(
|
|
|
1288
1304
|
},
|
|
1289
1305
|
sourceName: { required: true, type: String },
|
|
1290
1306
|
sourceUrl: { required: true, type: String },
|
|
1307
|
+
tags: { required: false, type: [String] },
|
|
1291
1308
|
website: { required: false, type: String }
|
|
1292
1309
|
},
|
|
1293
1310
|
{ timestamps: true }
|
|
@@ -1297,18 +1314,107 @@ schema8.index({ name: 1 });
|
|
|
1297
1314
|
schema8.index({ region: 1 });
|
|
1298
1315
|
schema8.index({ deletedAt: 1 });
|
|
1299
1316
|
schema8.index({ "dateTime.dateStatus": 1 });
|
|
1317
|
+
schema8.index({ earliestStartDate: 1, _id: 1 });
|
|
1318
|
+
schema8.index({ reviewStatus: 1, active: 1, earliestStartDate: 1, _id: 1 });
|
|
1319
|
+
schema8.index({
|
|
1320
|
+
region: 1,
|
|
1321
|
+
reviewStatus: 1,
|
|
1322
|
+
active: 1,
|
|
1323
|
+
earliestStartDate: 1,
|
|
1324
|
+
_id: 1
|
|
1325
|
+
});
|
|
1326
|
+
schema8.index({ region: 1, searchName: 1 });
|
|
1300
1327
|
schema8.index({ slug: 1 });
|
|
1301
1328
|
schema8.index({ reviewStatus: 1 });
|
|
1302
1329
|
schema8.index({ description: "text", name: "text" });
|
|
1303
1330
|
schema8.plugin(searchNamePlugin);
|
|
1304
1331
|
var AiImportedMarketModel = import_mongoose11.default.models.AiImportedMarket || import_mongoose11.default.model("AiImportedMarket", schema8);
|
|
1305
1332
|
|
|
1306
|
-
// src/mongoose/
|
|
1333
|
+
// src/mongoose/AiImportRun.ts
|
|
1334
|
+
var import_cluemart_shared11 = require("@timardex/cluemart-shared");
|
|
1307
1335
|
var import_mongoose12 = __toESM(require("mongoose"));
|
|
1308
1336
|
var MongooseSchema8 = import_mongoose12.default.Schema;
|
|
1337
|
+
var usageSchema = new MongooseSchema8(
|
|
1338
|
+
{
|
|
1339
|
+
completionTokens: { default: 0, required: true, type: Number },
|
|
1340
|
+
promptTokens: { default: 0, required: true, type: Number },
|
|
1341
|
+
totalTokens: { default: 0, required: true, type: Number }
|
|
1342
|
+
},
|
|
1343
|
+
{ _id: false }
|
|
1344
|
+
);
|
|
1345
|
+
var siteResultSchema = new MongooseSchema8(
|
|
1346
|
+
{
|
|
1347
|
+
errors: { default: 0, required: true, type: Number },
|
|
1348
|
+
found: { default: 0, required: true, type: Number },
|
|
1349
|
+
imported: { default: 0, required: true, type: Number },
|
|
1350
|
+
name: { required: true, type: String },
|
|
1351
|
+
skipped: { default: 0, required: true, type: Number },
|
|
1352
|
+
status: {
|
|
1353
|
+
enum: [import_cluemart_shared11.EnumAiImportRunStatus.SUCCESS, import_cluemart_shared11.EnumAiImportRunStatus.ERROR],
|
|
1354
|
+
required: true,
|
|
1355
|
+
type: String
|
|
1356
|
+
},
|
|
1357
|
+
url: { required: true, type: String },
|
|
1358
|
+
usage: { required: true, type: usageSchema }
|
|
1359
|
+
},
|
|
1360
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1361
|
+
);
|
|
1362
|
+
var resultSchema = new MongooseSchema8(
|
|
1363
|
+
{
|
|
1364
|
+
errors: { default: 0, required: true, type: Number },
|
|
1365
|
+
totalFound: { default: 0, required: true, type: Number },
|
|
1366
|
+
totalImported: { default: 0, required: true, type: Number },
|
|
1367
|
+
totalSkipped: { default: 0, required: true, type: Number }
|
|
1368
|
+
},
|
|
1369
|
+
{ _id: false, suppressReservedKeysWarning: true }
|
|
1370
|
+
);
|
|
1309
1371
|
var schema9 = new MongooseSchema8(
|
|
1372
|
+
{
|
|
1373
|
+
error: { required: false, type: String },
|
|
1374
|
+
finishedAt: { required: false, type: Date },
|
|
1375
|
+
result: { required: false, type: resultSchema },
|
|
1376
|
+
siteResults: { default: [], required: true, type: [siteResultSchema] },
|
|
1377
|
+
startedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
|
|
1378
|
+
status: {
|
|
1379
|
+
default: import_cluemart_shared11.EnumAiImportRunStatus.PENDING,
|
|
1380
|
+
enum: Object.values(import_cluemart_shared11.EnumAiImportRunStatus),
|
|
1381
|
+
required: true,
|
|
1382
|
+
type: String
|
|
1383
|
+
},
|
|
1384
|
+
triggeredByUserId: {
|
|
1385
|
+
ref: "User",
|
|
1386
|
+
required: false,
|
|
1387
|
+
type: import_mongoose12.default.Schema.Types.ObjectId
|
|
1388
|
+
},
|
|
1389
|
+
usage: { required: false, type: usageSchema }
|
|
1390
|
+
},
|
|
1391
|
+
{ timestamps: true }
|
|
1392
|
+
);
|
|
1393
|
+
schema9.index({ createdAt: -1 });
|
|
1394
|
+
var AiImportRunModel = import_mongoose12.default.models.AiImportRun || import_mongoose12.default.model("AiImportRun", schema9);
|
|
1395
|
+
|
|
1396
|
+
// src/mongoose/AiImportRunLock.ts
|
|
1397
|
+
var import_mongoose13 = __toESM(require("mongoose"));
|
|
1398
|
+
var AI_IMPORT_RUN_LOCK_KEY = "ai-import-run";
|
|
1399
|
+
var MongooseSchema9 = import_mongoose13.default.Schema;
|
|
1400
|
+
var schema10 = new MongooseSchema9(
|
|
1401
|
+
{
|
|
1402
|
+
_id: { required: true, type: String },
|
|
1403
|
+
lockedAt: { required: false, type: Date },
|
|
1404
|
+
token: { required: false, type: String }
|
|
1405
|
+
},
|
|
1406
|
+
{ timestamps: true }
|
|
1407
|
+
);
|
|
1408
|
+
var AiImportRunLockModel = import_mongoose13.default.models.AiImportRunLock || import_mongoose13.default.model("AiImportRunLock", schema10);
|
|
1409
|
+
|
|
1410
|
+
// src/mongoose/ScrapeSite.ts
|
|
1411
|
+
var import_mongoose14 = __toESM(require("mongoose"));
|
|
1412
|
+
var SCRAPE_SITES_CONFIG_ID = "scrapeSites";
|
|
1413
|
+
var MongooseSchema10 = import_mongoose14.default.Schema;
|
|
1414
|
+
var scrapeSiteItemSchema = new MongooseSchema10(
|
|
1310
1415
|
{
|
|
1311
1416
|
enabled: { default: true, required: true, type: Boolean },
|
|
1417
|
+
lastCount: { required: false, type: Number },
|
|
1312
1418
|
lastError: { required: false, type: String },
|
|
1313
1419
|
lastScrapedAt: { required: false, type: Date },
|
|
1314
1420
|
lastScrapeStatus: { required: false, type: String },
|
|
@@ -1318,27 +1424,41 @@ var schema9 = new MongooseSchema8(
|
|
|
1318
1424
|
},
|
|
1319
1425
|
{ timestamps: true }
|
|
1320
1426
|
);
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1427
|
+
var configSchema = new MongooseSchema10(
|
|
1428
|
+
{
|
|
1429
|
+
_id: { required: true, type: String },
|
|
1430
|
+
sites: {
|
|
1431
|
+
default: [],
|
|
1432
|
+
required: true,
|
|
1433
|
+
type: [scrapeSiteItemSchema]
|
|
1434
|
+
},
|
|
1435
|
+
updatedByUserId: {
|
|
1436
|
+
ref: "User",
|
|
1437
|
+
required: false,
|
|
1438
|
+
type: import_mongoose14.default.Schema.Types.ObjectId
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
{ timestamps: true }
|
|
1442
|
+
);
|
|
1443
|
+
var ScrapeSiteConfigModel = import_mongoose14.default.models.ScrapeSiteConfig || import_mongoose14.default.model("ScrapeSiteConfig", configSchema);
|
|
1324
1444
|
|
|
1325
1445
|
// src/mongoose/Notification.ts
|
|
1326
|
-
var
|
|
1327
|
-
var
|
|
1328
|
-
var
|
|
1329
|
-
var notificationDataSchema = new
|
|
1446
|
+
var import_cluemart_shared12 = require("@timardex/cluemart-shared");
|
|
1447
|
+
var import_mongoose15 = __toESM(require("mongoose"));
|
|
1448
|
+
var MongooseSchema11 = import_mongoose15.default.Schema;
|
|
1449
|
+
var notificationDataSchema = new MongooseSchema11(
|
|
1330
1450
|
{
|
|
1331
1451
|
resourceId: { required: true, type: String },
|
|
1332
1452
|
resourceName: { required: true, type: String },
|
|
1333
1453
|
resourceType: {
|
|
1334
|
-
enum: Object.values(
|
|
1454
|
+
enum: Object.values(import_cluemart_shared12.EnumNotificationResourceType),
|
|
1335
1455
|
required: true,
|
|
1336
1456
|
type: String
|
|
1337
1457
|
}
|
|
1338
1458
|
},
|
|
1339
1459
|
{ _id: false }
|
|
1340
1460
|
);
|
|
1341
|
-
var
|
|
1461
|
+
var schema11 = new MongooseSchema11(
|
|
1342
1462
|
{
|
|
1343
1463
|
data: {
|
|
1344
1464
|
default: null,
|
|
@@ -1349,28 +1469,28 @@ var schema10 = new MongooseSchema9(
|
|
|
1349
1469
|
message: { required: true, type: String },
|
|
1350
1470
|
title: { required: true, type: String },
|
|
1351
1471
|
type: {
|
|
1352
|
-
default:
|
|
1353
|
-
enum: Object.values(
|
|
1472
|
+
default: import_cluemart_shared12.EnumNotificationType.SYSTEM,
|
|
1473
|
+
enum: Object.values(import_cluemart_shared12.EnumNotificationType),
|
|
1354
1474
|
required: true,
|
|
1355
1475
|
type: String
|
|
1356
1476
|
},
|
|
1357
1477
|
userId: {
|
|
1358
1478
|
ref: "User",
|
|
1359
1479
|
required: true,
|
|
1360
|
-
type:
|
|
1480
|
+
type: import_mongoose15.default.Schema.Types.ObjectId
|
|
1361
1481
|
}
|
|
1362
1482
|
},
|
|
1363
1483
|
{ timestamps: true }
|
|
1364
1484
|
);
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
var NotificationModel =
|
|
1485
|
+
schema11.index({ isRead: 1, userId: 1 });
|
|
1486
|
+
schema11.index({ createdAt: -1, userId: 1 });
|
|
1487
|
+
var NotificationModel = import_mongoose15.default.models.Notification || import_mongoose15.default.model("Notification", schema11);
|
|
1368
1488
|
|
|
1369
1489
|
// src/mongoose/PushToken.ts
|
|
1370
1490
|
var import_enums = require("@timardex/cluemart-shared/enums");
|
|
1371
|
-
var
|
|
1372
|
-
var
|
|
1373
|
-
var
|
|
1491
|
+
var import_mongoose16 = __toESM(require("mongoose"));
|
|
1492
|
+
var MongooseSchema12 = import_mongoose16.default.Schema;
|
|
1493
|
+
var schema12 = new MongooseSchema12(
|
|
1374
1494
|
{
|
|
1375
1495
|
platform: {
|
|
1376
1496
|
enum: Object.values(import_enums.EnumOSPlatform),
|
|
@@ -1381,22 +1501,22 @@ var schema11 = new MongooseSchema10(
|
|
|
1381
1501
|
userId: {
|
|
1382
1502
|
ref: "User",
|
|
1383
1503
|
required: true,
|
|
1384
|
-
type:
|
|
1504
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
1385
1505
|
}
|
|
1386
1506
|
},
|
|
1387
1507
|
{ timestamps: true }
|
|
1388
1508
|
);
|
|
1389
|
-
var PushTokenModel =
|
|
1509
|
+
var PushTokenModel = import_mongoose16.default.models.PushToken || import_mongoose16.default.model("PushToken", schema12);
|
|
1390
1510
|
|
|
1391
1511
|
// src/mongoose/Relation.ts
|
|
1392
|
-
var
|
|
1393
|
-
var
|
|
1512
|
+
var import_cluemart_shared14 = require("@timardex/cluemart-shared");
|
|
1513
|
+
var import_mongoose18 = __toESM(require("mongoose"));
|
|
1394
1514
|
|
|
1395
1515
|
// src/mongoose/event/EventInfo.ts
|
|
1396
|
-
var
|
|
1397
|
-
var
|
|
1398
|
-
var
|
|
1399
|
-
var StallTypeSchema = new
|
|
1516
|
+
var import_cluemart_shared13 = require("@timardex/cluemart-shared");
|
|
1517
|
+
var import_mongoose17 = __toESM(require("mongoose"));
|
|
1518
|
+
var MongooseSchema13 = import_mongoose17.default.Schema;
|
|
1519
|
+
var StallTypeSchema = new MongooseSchema13(
|
|
1400
1520
|
{
|
|
1401
1521
|
label: { required: false, type: String },
|
|
1402
1522
|
price: { required: false, type: Number },
|
|
@@ -1407,10 +1527,10 @@ var StallTypeSchema = new MongooseSchema11(
|
|
|
1407
1527
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1408
1528
|
}
|
|
1409
1529
|
);
|
|
1410
|
-
var dateTimeSchema2 = new
|
|
1530
|
+
var dateTimeSchema2 = new MongooseSchema13(
|
|
1411
1531
|
{
|
|
1412
1532
|
dateStatus: {
|
|
1413
|
-
enum: Object.values(
|
|
1533
|
+
enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
|
|
1414
1534
|
required: false,
|
|
1415
1535
|
type: String
|
|
1416
1536
|
},
|
|
@@ -1423,13 +1543,13 @@ var dateTimeSchema2 = new MongooseSchema11(
|
|
|
1423
1543
|
{ _id: false }
|
|
1424
1544
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1425
1545
|
);
|
|
1426
|
-
var paymentInfoSchema = new
|
|
1546
|
+
var paymentInfoSchema = new MongooseSchema13(
|
|
1427
1547
|
{
|
|
1428
1548
|
accountHolderName: { required: false, type: String },
|
|
1429
1549
|
accountNumber: { required: false, type: String },
|
|
1430
1550
|
link: { required: false, type: String },
|
|
1431
1551
|
paymentMethod: {
|
|
1432
|
-
enum: Object.values(
|
|
1552
|
+
enum: Object.values(import_cluemart_shared13.EnumPaymentMethod),
|
|
1433
1553
|
required: true,
|
|
1434
1554
|
type: String
|
|
1435
1555
|
}
|
|
@@ -1437,7 +1557,7 @@ var paymentInfoSchema = new MongooseSchema11(
|
|
|
1437
1557
|
{ _id: false }
|
|
1438
1558
|
// Prevents Mongoose from creating an additional _id field
|
|
1439
1559
|
);
|
|
1440
|
-
var requirementsSchema = new
|
|
1560
|
+
var requirementsSchema = new MongooseSchema13(
|
|
1441
1561
|
{
|
|
1442
1562
|
category: { required: true, type: String },
|
|
1443
1563
|
label: { required: true, type: String },
|
|
@@ -1448,7 +1568,7 @@ var requirementsSchema = new MongooseSchema11(
|
|
|
1448
1568
|
// Prevents Mongoose from creating an additional _id field for
|
|
1449
1569
|
}
|
|
1450
1570
|
);
|
|
1451
|
-
var refundPolicySchema = new
|
|
1571
|
+
var refundPolicySchema = new MongooseSchema13(
|
|
1452
1572
|
{
|
|
1453
1573
|
category: { required: true, type: String },
|
|
1454
1574
|
label: { required: true, type: String },
|
|
@@ -1456,7 +1576,7 @@ var refundPolicySchema = new MongooseSchema11(
|
|
|
1456
1576
|
},
|
|
1457
1577
|
{ _id: false }
|
|
1458
1578
|
);
|
|
1459
|
-
var
|
|
1579
|
+
var schema13 = new MongooseSchema13(
|
|
1460
1580
|
{
|
|
1461
1581
|
active: { default: true, type: Boolean },
|
|
1462
1582
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -1464,7 +1584,7 @@ var schema12 = new MongooseSchema11(
|
|
|
1464
1584
|
eventId: {
|
|
1465
1585
|
ref: "Event",
|
|
1466
1586
|
required: true,
|
|
1467
|
-
type:
|
|
1587
|
+
type: import_mongoose17.default.Schema.Types.ObjectId
|
|
1468
1588
|
},
|
|
1469
1589
|
packInTime: { required: true, type: Number },
|
|
1470
1590
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -1474,15 +1594,15 @@ var schema12 = new MongooseSchema11(
|
|
|
1474
1594
|
},
|
|
1475
1595
|
{ timestamps: true }
|
|
1476
1596
|
);
|
|
1477
|
-
|
|
1478
|
-
var EventInfoModel =
|
|
1597
|
+
schema13.index({ eventId: 1 });
|
|
1598
|
+
var EventInfoModel = import_mongoose17.default.models.EventInfo || import_mongoose17.default.model("EventInfo", schema13);
|
|
1479
1599
|
|
|
1480
1600
|
// src/mongoose/Relation.ts
|
|
1481
|
-
var
|
|
1482
|
-
var relationDateTimeSchema = new
|
|
1601
|
+
var MongooseSchema14 = import_mongoose18.default.Schema;
|
|
1602
|
+
var relationDateTimeSchema = new MongooseSchema14(
|
|
1483
1603
|
{
|
|
1484
1604
|
dateStatus: {
|
|
1485
|
-
enum: Object.values(
|
|
1605
|
+
enum: Object.values(import_cluemart_shared14.EnumEventDateStatus),
|
|
1486
1606
|
required: true,
|
|
1487
1607
|
type: String
|
|
1488
1608
|
},
|
|
@@ -1494,7 +1614,7 @@ var relationDateTimeSchema = new MongooseSchema12(
|
|
|
1494
1614
|
},
|
|
1495
1615
|
{ _id: false }
|
|
1496
1616
|
);
|
|
1497
|
-
var relationDatesSchema = new
|
|
1617
|
+
var relationDatesSchema = new MongooseSchema14(
|
|
1498
1618
|
{
|
|
1499
1619
|
dateTime: {
|
|
1500
1620
|
required: true,
|
|
@@ -1506,42 +1626,42 @@ var relationDatesSchema = new MongooseSchema12(
|
|
|
1506
1626
|
},
|
|
1507
1627
|
paymentReference: { required: false, type: String },
|
|
1508
1628
|
status: {
|
|
1509
|
-
enum: Object.values(
|
|
1629
|
+
enum: Object.values(import_cluemart_shared14.EnumInviteStatus),
|
|
1510
1630
|
required: false,
|
|
1511
1631
|
type: String
|
|
1512
1632
|
}
|
|
1513
1633
|
},
|
|
1514
1634
|
{ _id: false }
|
|
1515
1635
|
);
|
|
1516
|
-
var RelationTypeSchema = new
|
|
1636
|
+
var RelationTypeSchema = new MongooseSchema14(
|
|
1517
1637
|
{
|
|
1518
1638
|
active: { default: true, required: true, type: Boolean },
|
|
1519
1639
|
chatId: {
|
|
1520
1640
|
ref: "Chat",
|
|
1521
1641
|
required: true,
|
|
1522
|
-
type:
|
|
1642
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1523
1643
|
},
|
|
1524
1644
|
deletedAt: { default: null, required: false, type: Date },
|
|
1525
1645
|
eventId: {
|
|
1526
1646
|
ref: "Event",
|
|
1527
1647
|
required: true,
|
|
1528
|
-
type:
|
|
1648
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1529
1649
|
},
|
|
1530
1650
|
lastUpdateBy: {
|
|
1531
|
-
enum: Object.values(
|
|
1651
|
+
enum: Object.values(import_cluemart_shared14.EnumResourceType),
|
|
1532
1652
|
required: true,
|
|
1533
1653
|
type: String
|
|
1534
1654
|
},
|
|
1535
1655
|
relationDates: [relationDatesSchema],
|
|
1536
1656
|
relationType: {
|
|
1537
|
-
enum: Object.values(
|
|
1657
|
+
enum: Object.values(import_cluemart_shared14.EnumRelationResource),
|
|
1538
1658
|
required: true,
|
|
1539
1659
|
type: String
|
|
1540
1660
|
},
|
|
1541
1661
|
vendorId: {
|
|
1542
1662
|
ref: "Vendor",
|
|
1543
1663
|
required: true,
|
|
1544
|
-
type:
|
|
1664
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1545
1665
|
}
|
|
1546
1666
|
},
|
|
1547
1667
|
{ timestamps: true }
|
|
@@ -1553,21 +1673,21 @@ RelationTypeSchema.index({
|
|
|
1553
1673
|
"relationDates.status": 1,
|
|
1554
1674
|
vendorId: 1
|
|
1555
1675
|
});
|
|
1556
|
-
var RelationModel =
|
|
1676
|
+
var RelationModel = import_mongoose18.default.models.Relation || import_mongoose18.default.model("Relation", RelationTypeSchema);
|
|
1557
1677
|
|
|
1558
1678
|
// src/mongoose/ResourceActivity.ts
|
|
1559
|
-
var
|
|
1560
|
-
var
|
|
1561
|
-
var
|
|
1562
|
-
var ActivitySchema = new
|
|
1679
|
+
var import_cluemart_shared15 = require("@timardex/cluemart-shared");
|
|
1680
|
+
var import_mongoose19 = __toESM(require("mongoose"));
|
|
1681
|
+
var MongooseSchema15 = import_mongoose19.default.Schema;
|
|
1682
|
+
var ActivitySchema = new MongooseSchema15(
|
|
1563
1683
|
{
|
|
1564
1684
|
activityType: {
|
|
1565
|
-
enum: Object.values(
|
|
1685
|
+
enum: Object.values(import_cluemart_shared15.EnumActivity),
|
|
1566
1686
|
required: true,
|
|
1567
1687
|
type: String
|
|
1568
1688
|
},
|
|
1569
1689
|
dateStatus: {
|
|
1570
|
-
enum: Object.values(
|
|
1690
|
+
enum: Object.values(import_cluemart_shared15.EnumEventDateStatus),
|
|
1571
1691
|
required: false,
|
|
1572
1692
|
type: String
|
|
1573
1693
|
},
|
|
@@ -1579,7 +1699,7 @@ var ActivitySchema = new MongooseSchema13(
|
|
|
1579
1699
|
startTime: { required: false, type: String },
|
|
1580
1700
|
timestamp: { default: Date.now, type: Date },
|
|
1581
1701
|
userAgent: {
|
|
1582
|
-
enum: Object.values(
|
|
1702
|
+
enum: Object.values(import_cluemart_shared15.EnumOSPlatform),
|
|
1583
1703
|
required: true,
|
|
1584
1704
|
type: String
|
|
1585
1705
|
},
|
|
@@ -1587,61 +1707,61 @@ var ActivitySchema = new MongooseSchema13(
|
|
|
1587
1707
|
},
|
|
1588
1708
|
{ _id: false }
|
|
1589
1709
|
);
|
|
1590
|
-
var
|
|
1710
|
+
var schema14 = new MongooseSchema15(
|
|
1591
1711
|
{
|
|
1592
1712
|
activity: { default: [], type: [ActivitySchema] },
|
|
1593
1713
|
resourceId: { required: true, type: String },
|
|
1594
1714
|
resourceType: {
|
|
1595
|
-
enum: Object.values(
|
|
1715
|
+
enum: Object.values(import_cluemart_shared15.EnumResourceType),
|
|
1596
1716
|
required: true,
|
|
1597
1717
|
type: String
|
|
1598
1718
|
}
|
|
1599
1719
|
},
|
|
1600
1720
|
{ timestamps: true }
|
|
1601
1721
|
);
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
var ResourceActivityModel =
|
|
1722
|
+
schema14.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
1723
|
+
schema14.index({ "views.location": "2dsphere" });
|
|
1724
|
+
var ResourceActivityModel = import_mongoose19.default.models.ResourceActivity || import_mongoose19.default.model("ResourceActivity", schema14);
|
|
1605
1725
|
|
|
1606
1726
|
// src/mongoose/User.ts
|
|
1607
|
-
var
|
|
1608
|
-
var
|
|
1609
|
-
var
|
|
1610
|
-
var userActivityEventSchema = new
|
|
1727
|
+
var import_cluemart_shared16 = require("@timardex/cluemart-shared");
|
|
1728
|
+
var import_mongoose20 = __toESM(require("mongoose"));
|
|
1729
|
+
var MongooseSchema16 = import_mongoose20.default.Schema;
|
|
1730
|
+
var userActivityEventSchema = new MongooseSchema16(
|
|
1611
1731
|
{
|
|
1612
1732
|
dateTime: dateTimeSchema,
|
|
1613
1733
|
resourceId: {
|
|
1614
1734
|
ref: "Event",
|
|
1615
1735
|
required: false,
|
|
1616
|
-
type:
|
|
1736
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1617
1737
|
}
|
|
1618
1738
|
},
|
|
1619
1739
|
{ _id: false }
|
|
1620
1740
|
);
|
|
1621
|
-
var userActivityFavouritesSchema = new
|
|
1741
|
+
var userActivityFavouritesSchema = new MongooseSchema16(
|
|
1622
1742
|
{
|
|
1623
1743
|
events: {
|
|
1624
1744
|
ref: "Event",
|
|
1625
1745
|
required: false,
|
|
1626
|
-
type: [
|
|
1746
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1627
1747
|
},
|
|
1628
1748
|
partners: {
|
|
1629
1749
|
ref: "Partner",
|
|
1630
1750
|
required: false,
|
|
1631
|
-
type: [
|
|
1751
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1632
1752
|
},
|
|
1633
1753
|
vendors: {
|
|
1634
1754
|
ref: "Vendor",
|
|
1635
1755
|
required: false,
|
|
1636
|
-
type: [
|
|
1756
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1637
1757
|
}
|
|
1638
1758
|
},
|
|
1639
1759
|
{ _id: false }
|
|
1640
1760
|
);
|
|
1641
|
-
var stripeSchema = new
|
|
1761
|
+
var stripeSchema = new MongooseSchema16(
|
|
1642
1762
|
{
|
|
1643
1763
|
billingPeriod: {
|
|
1644
|
-
enum: Object.values(
|
|
1764
|
+
enum: Object.values(import_cluemart_shared16.EnumBillingPeriod),
|
|
1645
1765
|
required: false,
|
|
1646
1766
|
type: String
|
|
1647
1767
|
},
|
|
@@ -1650,7 +1770,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1650
1770
|
type: Boolean
|
|
1651
1771
|
},
|
|
1652
1772
|
currentPlan: {
|
|
1653
|
-
enum: Object.values(
|
|
1773
|
+
enum: Object.values(import_cluemart_shared16.EnumUserLicence),
|
|
1654
1774
|
required: false,
|
|
1655
1775
|
type: String
|
|
1656
1776
|
},
|
|
@@ -1675,7 +1795,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1675
1795
|
type: String
|
|
1676
1796
|
},
|
|
1677
1797
|
pendingBillingPeriod: {
|
|
1678
|
-
enum: Object.values(
|
|
1798
|
+
enum: Object.values(import_cluemart_shared16.EnumBillingPeriod),
|
|
1679
1799
|
required: false,
|
|
1680
1800
|
type: String
|
|
1681
1801
|
},
|
|
@@ -1684,7 +1804,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1684
1804
|
type: Date
|
|
1685
1805
|
},
|
|
1686
1806
|
pendingPlan: {
|
|
1687
|
-
enum: Object.values(
|
|
1807
|
+
enum: Object.values(import_cluemart_shared16.EnumUserLicence),
|
|
1688
1808
|
required: false,
|
|
1689
1809
|
type: String
|
|
1690
1810
|
},
|
|
@@ -1701,7 +1821,7 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1701
1821
|
type: Date
|
|
1702
1822
|
},
|
|
1703
1823
|
status: {
|
|
1704
|
-
enum: Object.values(
|
|
1824
|
+
enum: Object.values(import_cluemart_shared16.EnumSubscriptionStatus),
|
|
1705
1825
|
required: false,
|
|
1706
1826
|
type: String
|
|
1707
1827
|
},
|
|
@@ -1720,10 +1840,10 @@ var stripeSchema = new MongooseSchema14(
|
|
|
1720
1840
|
},
|
|
1721
1841
|
{ _id: false }
|
|
1722
1842
|
);
|
|
1723
|
-
var redeemedRewardSchema = new
|
|
1843
|
+
var redeemedRewardSchema = new MongooseSchema16(
|
|
1724
1844
|
{
|
|
1725
1845
|
name: {
|
|
1726
|
-
enum: Object.values(
|
|
1846
|
+
enum: Object.values(import_cluemart_shared16.EnumReward),
|
|
1727
1847
|
required: true,
|
|
1728
1848
|
type: String
|
|
1729
1849
|
},
|
|
@@ -1732,12 +1852,12 @@ var redeemedRewardSchema = new MongooseSchema14(
|
|
|
1732
1852
|
},
|
|
1733
1853
|
{ _id: false }
|
|
1734
1854
|
);
|
|
1735
|
-
var userOverallPointsSchema = new
|
|
1855
|
+
var userOverallPointsSchema = new MongooseSchema16(
|
|
1736
1856
|
{
|
|
1737
1857
|
createdAt: { required: true, type: Date },
|
|
1738
1858
|
points: { default: 0, required: true, type: Number },
|
|
1739
1859
|
pointType: {
|
|
1740
|
-
enum: Object.values(
|
|
1860
|
+
enum: Object.values(import_cluemart_shared16.EnumPointType),
|
|
1741
1861
|
required: true,
|
|
1742
1862
|
type: String
|
|
1743
1863
|
},
|
|
@@ -1745,13 +1865,13 @@ var userOverallPointsSchema = new MongooseSchema14(
|
|
|
1745
1865
|
},
|
|
1746
1866
|
{ _id: false }
|
|
1747
1867
|
);
|
|
1748
|
-
var
|
|
1868
|
+
var schema15 = new MongooseSchema16(
|
|
1749
1869
|
{
|
|
1750
1870
|
active: { default: false, required: true, type: Boolean },
|
|
1751
1871
|
affiliate: {
|
|
1752
1872
|
ref: "Affiliate",
|
|
1753
1873
|
required: false,
|
|
1754
|
-
type:
|
|
1874
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1755
1875
|
},
|
|
1756
1876
|
avatar: {
|
|
1757
1877
|
required: false,
|
|
@@ -1760,28 +1880,28 @@ var schema14 = new MongooseSchema14(
|
|
|
1760
1880
|
coupon: {
|
|
1761
1881
|
ref: "Coupon",
|
|
1762
1882
|
required: false,
|
|
1763
|
-
type:
|
|
1883
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1764
1884
|
},
|
|
1765
1885
|
deletedAt: { default: null, required: false, type: Date },
|
|
1766
1886
|
email: { required: true, type: String },
|
|
1767
1887
|
emailSentFor: {
|
|
1768
|
-
enum: Object.values(
|
|
1888
|
+
enum: Object.values(import_cluemart_shared16.EnumNotificationResourceType),
|
|
1769
1889
|
required: false,
|
|
1770
1890
|
type: [String]
|
|
1771
1891
|
},
|
|
1772
1892
|
events: {
|
|
1773
1893
|
ref: "Event",
|
|
1774
1894
|
required: false,
|
|
1775
|
-
type: [
|
|
1895
|
+
type: [import_mongoose20.default.Schema.Types.ObjectId]
|
|
1776
1896
|
},
|
|
1777
1897
|
firstName: { required: true, type: String },
|
|
1778
1898
|
game: {
|
|
1779
1899
|
ref: "Game",
|
|
1780
1900
|
required: false,
|
|
1781
|
-
type:
|
|
1901
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1782
1902
|
},
|
|
1783
1903
|
interests: {
|
|
1784
|
-
enum: Object.values(
|
|
1904
|
+
enum: Object.values(import_cluemart_shared16.EnumResourceType),
|
|
1785
1905
|
required: false,
|
|
1786
1906
|
type: [String]
|
|
1787
1907
|
},
|
|
@@ -1804,11 +1924,11 @@ var schema14 = new MongooseSchema14(
|
|
|
1804
1924
|
partner: {
|
|
1805
1925
|
ref: "Partner",
|
|
1806
1926
|
required: false,
|
|
1807
|
-
type:
|
|
1927
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1808
1928
|
},
|
|
1809
1929
|
password: { required: true, type: String },
|
|
1810
1930
|
platform: {
|
|
1811
|
-
enum: Object.values(
|
|
1931
|
+
enum: Object.values(import_cluemart_shared16.EnumOSPlatform),
|
|
1812
1932
|
required: false,
|
|
1813
1933
|
type: String
|
|
1814
1934
|
},
|
|
@@ -1837,15 +1957,15 @@ var schema14 = new MongooseSchema14(
|
|
|
1837
1957
|
type: String
|
|
1838
1958
|
},
|
|
1839
1959
|
roles: {
|
|
1840
|
-
default: [
|
|
1841
|
-
enum: Object.values(
|
|
1960
|
+
default: [import_cluemart_shared16.EnumUserRole.CUSTOMER],
|
|
1961
|
+
enum: Object.values(import_cluemart_shared16.EnumUserRole),
|
|
1842
1962
|
required: true,
|
|
1843
1963
|
type: [String]
|
|
1844
1964
|
},
|
|
1845
1965
|
school: {
|
|
1846
1966
|
ref: "School",
|
|
1847
1967
|
required: false,
|
|
1848
|
-
type:
|
|
1968
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1849
1969
|
},
|
|
1850
1970
|
stripe: {
|
|
1851
1971
|
required: false,
|
|
@@ -1870,21 +1990,21 @@ var schema14 = new MongooseSchema14(
|
|
|
1870
1990
|
vendor: {
|
|
1871
1991
|
ref: "Vendor",
|
|
1872
1992
|
required: false,
|
|
1873
|
-
type:
|
|
1993
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1874
1994
|
}
|
|
1875
1995
|
},
|
|
1876
1996
|
{ strict: false, timestamps: true }
|
|
1877
1997
|
);
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
var UserModel =
|
|
1998
|
+
schema15.index({ "licences.expiryDate": 1 });
|
|
1999
|
+
schema15.index({ "licences.licenceType": 1 });
|
|
2000
|
+
schema15.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
2001
|
+
schema15.index({ email: "text", firstName: "text", lastName: "text" });
|
|
2002
|
+
var UserModel = import_mongoose20.default.models.User || import_mongoose20.default.model("User", schema15);
|
|
1883
2003
|
|
|
1884
2004
|
// src/mongoose/VerificationToken.ts
|
|
1885
|
-
var
|
|
1886
|
-
var
|
|
1887
|
-
var
|
|
2005
|
+
var import_mongoose21 = __toESM(require("mongoose"));
|
|
2006
|
+
var MongooseSchema17 = import_mongoose21.default.Schema;
|
|
2007
|
+
var schema16 = new MongooseSchema17(
|
|
1888
2008
|
{
|
|
1889
2009
|
createdAt: {
|
|
1890
2010
|
default: Date.now,
|
|
@@ -1899,13 +2019,13 @@ var schema15 = new MongooseSchema15(
|
|
|
1899
2019
|
},
|
|
1900
2020
|
{ timestamps: true }
|
|
1901
2021
|
);
|
|
1902
|
-
var VerificationTokenModel =
|
|
2022
|
+
var VerificationTokenModel = import_mongoose21.default.models.VerificationToken || import_mongoose21.default.model("VerificationToken", schema16);
|
|
1903
2023
|
|
|
1904
2024
|
// src/mongoose/vendor/Vendor.ts
|
|
1905
|
-
var
|
|
1906
|
-
var
|
|
1907
|
-
var
|
|
1908
|
-
var vendorProductTypeSchema = new
|
|
2025
|
+
var import_cluemart_shared17 = require("@timardex/cluemart-shared");
|
|
2026
|
+
var import_mongoose22 = __toESM(require("mongoose"));
|
|
2027
|
+
var MongooseSchema18 = import_mongoose22.default.Schema;
|
|
2028
|
+
var vendorProductTypeSchema = new MongooseSchema18(
|
|
1909
2029
|
{
|
|
1910
2030
|
description: { required: false, type: String },
|
|
1911
2031
|
name: { required: true, type: String },
|
|
@@ -1916,18 +2036,18 @@ var vendorProductTypeSchema = new MongooseSchema16(
|
|
|
1916
2036
|
},
|
|
1917
2037
|
{ timestamps: true }
|
|
1918
2038
|
);
|
|
1919
|
-
var productWrapperSchema = new
|
|
2039
|
+
var productWrapperSchema = new MongooseSchema18(
|
|
1920
2040
|
{
|
|
1921
2041
|
active: { default: false, required: false, type: Boolean },
|
|
1922
2042
|
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
1923
2043
|
},
|
|
1924
2044
|
{ _id: false }
|
|
1925
2045
|
);
|
|
1926
|
-
var calendarSchema = new
|
|
2046
|
+
var calendarSchema = new MongooseSchema18(
|
|
1927
2047
|
{
|
|
1928
2048
|
dateTime: {
|
|
1929
2049
|
dateStatus: {
|
|
1930
|
-
enum: Object.values(
|
|
2050
|
+
enum: Object.values(import_cluemart_shared17.EnumEventDateStatus),
|
|
1931
2051
|
required: false,
|
|
1932
2052
|
type: String
|
|
1933
2053
|
},
|
|
@@ -1944,14 +2064,14 @@ var calendarSchema = new MongooseSchema16(
|
|
|
1944
2064
|
},
|
|
1945
2065
|
{ _id: false }
|
|
1946
2066
|
);
|
|
1947
|
-
var calendarWrapperSchema = new
|
|
2067
|
+
var calendarWrapperSchema = new MongooseSchema18(
|
|
1948
2068
|
{
|
|
1949
2069
|
active: { default: false, required: true, type: Boolean },
|
|
1950
2070
|
calendarData: { required: false, type: [calendarSchema] }
|
|
1951
2071
|
},
|
|
1952
2072
|
{ _id: false }
|
|
1953
2073
|
);
|
|
1954
|
-
var vendorAvailabilitySchema = new
|
|
2074
|
+
var vendorAvailabilitySchema = new MongooseSchema18(
|
|
1955
2075
|
{
|
|
1956
2076
|
corporate: { default: false, required: false, type: Boolean },
|
|
1957
2077
|
private: { default: false, required: false, type: Boolean },
|
|
@@ -1959,7 +2079,7 @@ var vendorAvailabilitySchema = new MongooseSchema16(
|
|
|
1959
2079
|
},
|
|
1960
2080
|
{ _id: false }
|
|
1961
2081
|
);
|
|
1962
|
-
var downgradeSnapshotSchema = new
|
|
2082
|
+
var downgradeSnapshotSchema = new MongooseSchema18(
|
|
1963
2083
|
{
|
|
1964
2084
|
availability: { required: false, type: vendorAvailabilitySchema },
|
|
1965
2085
|
calendarActive: { required: false, type: Boolean },
|
|
@@ -1967,7 +2087,7 @@ var downgradeSnapshotSchema = new MongooseSchema16(
|
|
|
1967
2087
|
},
|
|
1968
2088
|
{ _id: false }
|
|
1969
2089
|
);
|
|
1970
|
-
var
|
|
2090
|
+
var schema17 = new MongooseSchema18(
|
|
1971
2091
|
{
|
|
1972
2092
|
...baseResourceFields,
|
|
1973
2093
|
// Importing base resource fields from global.ts
|
|
@@ -1986,47 +2106,47 @@ var schema16 = new MongooseSchema16(
|
|
|
1986
2106
|
unregisteredVendorId: {
|
|
1987
2107
|
ref: "UnregisteredVendor",
|
|
1988
2108
|
required: false,
|
|
1989
|
-
type:
|
|
2109
|
+
type: import_mongoose22.default.Schema.Types.ObjectId
|
|
1990
2110
|
},
|
|
1991
2111
|
vendorInfoId: {
|
|
1992
2112
|
ref: "VendorInfo",
|
|
1993
2113
|
required: false,
|
|
1994
|
-
type:
|
|
2114
|
+
type: import_mongoose22.default.Schema.Types.ObjectId
|
|
1995
2115
|
},
|
|
1996
2116
|
vendorType: {
|
|
1997
|
-
enum: Object.values(
|
|
2117
|
+
enum: Object.values(import_cluemart_shared17.EnumVendorType),
|
|
1998
2118
|
required: true,
|
|
1999
2119
|
type: String
|
|
2000
2120
|
}
|
|
2001
2121
|
},
|
|
2002
2122
|
{ timestamps: true }
|
|
2003
2123
|
);
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2124
|
+
schema17.index({ name: 1 });
|
|
2125
|
+
schema17.index({ description: 1 });
|
|
2126
|
+
schema17.index({ region: 1 });
|
|
2127
|
+
schema17.index({ "categories.name": 1 });
|
|
2128
|
+
schema17.index({ slug: 1 });
|
|
2129
|
+
schema17.index({
|
|
2010
2130
|
categoriesNames: "text",
|
|
2011
2131
|
description: "text",
|
|
2012
2132
|
name: "text"
|
|
2013
2133
|
});
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
var VendorModel =
|
|
2134
|
+
schema17.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2135
|
+
schema17.plugin(searchNamePlugin);
|
|
2136
|
+
var VendorModel = import_mongoose22.default.models.Vendor || import_mongoose22.default.model("Vendor", schema17);
|
|
2017
2137
|
|
|
2018
2138
|
// src/mongoose/vendor/VendorInfo.ts
|
|
2019
|
-
var
|
|
2020
|
-
var
|
|
2021
|
-
var
|
|
2022
|
-
var AttributesSchema = new
|
|
2139
|
+
var import_cluemart_shared18 = require("@timardex/cluemart-shared");
|
|
2140
|
+
var import_mongoose23 = __toESM(require("mongoose"));
|
|
2141
|
+
var MongooseSchema19 = import_mongoose23.default.Schema;
|
|
2142
|
+
var AttributesSchema = new MongooseSchema19(
|
|
2023
2143
|
{
|
|
2024
2144
|
details: { required: false, type: String },
|
|
2025
2145
|
isRequired: { default: false, required: true, type: Boolean }
|
|
2026
2146
|
},
|
|
2027
2147
|
{ _id: false }
|
|
2028
2148
|
);
|
|
2029
|
-
var
|
|
2149
|
+
var schema18 = new MongooseSchema19(
|
|
2030
2150
|
{
|
|
2031
2151
|
active: { default: true, type: Boolean },
|
|
2032
2152
|
compliance: {
|
|
@@ -2036,7 +2156,7 @@ var schema17 = new MongooseSchema17(
|
|
|
2036
2156
|
documents: [ResourceImageTypeSchema],
|
|
2037
2157
|
product: {
|
|
2038
2158
|
foodFlavors: {
|
|
2039
|
-
enum: Object.values(
|
|
2159
|
+
enum: Object.values(import_cluemart_shared18.EnumFoodFlavor),
|
|
2040
2160
|
required: true,
|
|
2041
2161
|
type: [String]
|
|
2042
2162
|
},
|
|
@@ -2061,29 +2181,29 @@ var schema17 = new MongooseSchema17(
|
|
|
2061
2181
|
vendorId: {
|
|
2062
2182
|
ref: "Vendor",
|
|
2063
2183
|
required: true,
|
|
2064
|
-
type:
|
|
2184
|
+
type: import_mongoose23.default.Schema.Types.ObjectId
|
|
2065
2185
|
}
|
|
2066
2186
|
},
|
|
2067
2187
|
{ timestamps: true }
|
|
2068
2188
|
);
|
|
2069
|
-
|
|
2070
|
-
var VendorInfoModel =
|
|
2189
|
+
schema18.index({ vendorId: 1 });
|
|
2190
|
+
var VendorInfoModel = import_mongoose23.default.models.VendorInfo || import_mongoose23.default.model("VendorInfo", schema18);
|
|
2071
2191
|
|
|
2072
2192
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
2073
|
-
var
|
|
2074
|
-
var
|
|
2075
|
-
var invitationSchema = new
|
|
2193
|
+
var import_mongoose24 = __toESM(require("mongoose"));
|
|
2194
|
+
var MongooseSchema20 = import_mongoose24.default.Schema;
|
|
2195
|
+
var invitationSchema = new MongooseSchema20(
|
|
2076
2196
|
{
|
|
2077
2197
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
2078
2198
|
inviterId: {
|
|
2079
2199
|
ref: "Event",
|
|
2080
2200
|
required: true,
|
|
2081
|
-
type:
|
|
2201
|
+
type: import_mongoose24.default.Schema.Types.ObjectId
|
|
2082
2202
|
}
|
|
2083
2203
|
},
|
|
2084
2204
|
{ _id: false }
|
|
2085
2205
|
);
|
|
2086
|
-
var
|
|
2206
|
+
var schema19 = new MongooseSchema20(
|
|
2087
2207
|
{
|
|
2088
2208
|
active: { default: true, required: true, type: Boolean },
|
|
2089
2209
|
categoryIds: { required: true, type: [String] },
|
|
@@ -2092,7 +2212,7 @@ var schema18 = new MongooseSchema18(
|
|
|
2092
2212
|
claimedByUserId: {
|
|
2093
2213
|
ref: "User",
|
|
2094
2214
|
required: false,
|
|
2095
|
-
type:
|
|
2215
|
+
type: import_mongoose24.default.Schema.Types.ObjectId
|
|
2096
2216
|
},
|
|
2097
2217
|
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
2098
2218
|
claimToken: { default: null, required: false, type: String },
|
|
@@ -2105,15 +2225,15 @@ var schema18 = new MongooseSchema18(
|
|
|
2105
2225
|
},
|
|
2106
2226
|
{ timestamps: true }
|
|
2107
2227
|
);
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
var UnregisteredVendorModel =
|
|
2228
|
+
schema19.index({ name: 1 });
|
|
2229
|
+
schema19.index({ email: 1 });
|
|
2230
|
+
var UnregisteredVendorModel = import_mongoose24.default.models.UnregisteredVendor || import_mongoose24.default.model("UnregisteredVendor", schema19);
|
|
2111
2231
|
|
|
2112
2232
|
// src/mongoose/event/Event.ts
|
|
2113
|
-
var
|
|
2114
|
-
var
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2233
|
+
var import_cluemart_shared19 = require("@timardex/cluemart-shared");
|
|
2234
|
+
var import_mongoose25 = __toESM(require("mongoose"));
|
|
2235
|
+
var MongooseSchema21 = import_mongoose25.default.Schema;
|
|
2236
|
+
var schema20 = new MongooseSchema21(
|
|
2117
2237
|
{
|
|
2118
2238
|
...baseResourceFields,
|
|
2119
2239
|
// Importing base resource fields from global.ts
|
|
@@ -2122,10 +2242,10 @@ var schema19 = new MongooseSchema19(
|
|
|
2122
2242
|
eventInfoId: {
|
|
2123
2243
|
ref: "EventInfo",
|
|
2124
2244
|
required: false,
|
|
2125
|
-
type:
|
|
2245
|
+
type: import_mongoose25.default.Schema.Types.ObjectId
|
|
2126
2246
|
},
|
|
2127
2247
|
eventType: {
|
|
2128
|
-
enum: Object.values(
|
|
2248
|
+
enum: Object.values(import_cluemart_shared19.EnumEventType),
|
|
2129
2249
|
required: true,
|
|
2130
2250
|
type: String
|
|
2131
2251
|
},
|
|
@@ -2146,40 +2266,40 @@ var schema19 = new MongooseSchema19(
|
|
|
2146
2266
|
},
|
|
2147
2267
|
{ timestamps: true }
|
|
2148
2268
|
);
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
var EventModel =
|
|
2269
|
+
schema20.index({ name: 1 });
|
|
2270
|
+
schema20.index({ description: 1 });
|
|
2271
|
+
schema20.index({ region: 1 });
|
|
2272
|
+
schema20.index({ "location.geo": "2dsphere" });
|
|
2273
|
+
schema20.index({ tags: 1 });
|
|
2274
|
+
schema20.index({ deletedAt: 1 });
|
|
2275
|
+
schema20.index({ "dateTime.dateStatus": 1 });
|
|
2276
|
+
schema20.index({ slug: 1 });
|
|
2277
|
+
schema20.index({ description: "text", name: "text", tags: "text" });
|
|
2278
|
+
schema20.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2279
|
+
schema20.plugin(searchNamePlugin);
|
|
2280
|
+
var EventModel = import_mongoose25.default.models.Event || import_mongoose25.default.model("Event", schema20);
|
|
2161
2281
|
|
|
2162
2282
|
// src/mongoose/event/EventDateArchive.ts
|
|
2163
|
-
var
|
|
2164
|
-
var
|
|
2283
|
+
var import_mongoose26 = __toESM(require("mongoose"));
|
|
2284
|
+
var schema21 = new import_mongoose26.default.Schema(
|
|
2165
2285
|
{
|
|
2166
2286
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
2167
2287
|
eventId: {
|
|
2168
2288
|
ref: "Event",
|
|
2169
2289
|
required: true,
|
|
2170
|
-
type:
|
|
2290
|
+
type: import_mongoose26.default.Schema.Types.ObjectId
|
|
2171
2291
|
}
|
|
2172
2292
|
},
|
|
2173
2293
|
{ timestamps: true }
|
|
2174
2294
|
);
|
|
2175
|
-
|
|
2176
|
-
var EventDateArchiveModel =
|
|
2295
|
+
schema21.index({ eventId: 1 }, { unique: true });
|
|
2296
|
+
var EventDateArchiveModel = import_mongoose26.default.models.EventDateArchive || import_mongoose26.default.model("EventDateArchive", schema21);
|
|
2177
2297
|
|
|
2178
2298
|
// src/mongoose/Partner.ts
|
|
2179
|
-
var
|
|
2180
|
-
var
|
|
2181
|
-
var
|
|
2182
|
-
var
|
|
2299
|
+
var import_cluemart_shared20 = require("@timardex/cluemart-shared");
|
|
2300
|
+
var import_mongoose27 = __toESM(require("mongoose"));
|
|
2301
|
+
var MongooseSchema22 = import_mongoose27.default.Schema;
|
|
2302
|
+
var schema22 = new MongooseSchema22(
|
|
2183
2303
|
{
|
|
2184
2304
|
...baseResourceFields,
|
|
2185
2305
|
location: {
|
|
@@ -2188,53 +2308,53 @@ var schema21 = new MongooseSchema20(
|
|
|
2188
2308
|
},
|
|
2189
2309
|
nzbn: { required: true, type: String },
|
|
2190
2310
|
partnerType: {
|
|
2191
|
-
enum: Object.values(
|
|
2311
|
+
enum: Object.values(import_cluemart_shared20.EnumPartnerType),
|
|
2192
2312
|
required: true,
|
|
2193
2313
|
type: String
|
|
2194
2314
|
}
|
|
2195
2315
|
},
|
|
2196
2316
|
{ timestamps: true }
|
|
2197
2317
|
);
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
var PartnerModel =
|
|
2318
|
+
schema22.index({ name: 1 });
|
|
2319
|
+
schema22.index({ description: 1 });
|
|
2320
|
+
schema22.index({ region: 1 });
|
|
2321
|
+
schema22.index({ "location.geo": "2dsphere" });
|
|
2322
|
+
schema22.index({ slug: 1 });
|
|
2323
|
+
schema22.index({ name: "text", description: "text" });
|
|
2324
|
+
schema22.index({ "owner.userId": 1, deletedAt: 1 });
|
|
2325
|
+
schema22.plugin(searchNamePlugin);
|
|
2326
|
+
var PartnerModel = import_mongoose27.default.models.Partner || import_mongoose27.default.model("Partner", schema22);
|
|
2207
2327
|
|
|
2208
2328
|
// src/mongoose/Post.ts
|
|
2209
|
-
var
|
|
2210
|
-
var
|
|
2211
|
-
var
|
|
2212
|
-
var contentSchema = new
|
|
2329
|
+
var import_cluemart_shared21 = require("@timardex/cluemart-shared");
|
|
2330
|
+
var import_mongoose28 = __toESM(require("mongoose"));
|
|
2331
|
+
var MongooseSchema23 = import_mongoose28.default.Schema;
|
|
2332
|
+
var contentSchema = new MongooseSchema23(
|
|
2213
2333
|
{
|
|
2214
|
-
contentData:
|
|
2334
|
+
contentData: import_mongoose28.Schema.Types.Mixed,
|
|
2215
2335
|
contentOrder: { required: true, type: Number },
|
|
2216
2336
|
contentType: {
|
|
2217
|
-
enum: Object.values(
|
|
2337
|
+
enum: Object.values(import_cluemart_shared21.EnumPostContentType),
|
|
2218
2338
|
required: true,
|
|
2219
2339
|
type: String
|
|
2220
2340
|
}
|
|
2221
2341
|
},
|
|
2222
2342
|
{ _id: false }
|
|
2223
2343
|
);
|
|
2224
|
-
var resourceSchema = new
|
|
2344
|
+
var resourceSchema = new MongooseSchema23(
|
|
2225
2345
|
{
|
|
2226
2346
|
resourceId: { required: true, type: String },
|
|
2227
2347
|
resourceRegion: { required: true, type: String },
|
|
2228
2348
|
resourceSlug: { required: true, type: String },
|
|
2229
2349
|
resourceType: {
|
|
2230
|
-
enum: Object.values(
|
|
2350
|
+
enum: Object.values(import_cluemart_shared21.EnumResourceType),
|
|
2231
2351
|
required: true,
|
|
2232
2352
|
type: String
|
|
2233
2353
|
}
|
|
2234
2354
|
},
|
|
2235
2355
|
{ _id: false }
|
|
2236
2356
|
);
|
|
2237
|
-
var
|
|
2357
|
+
var schema23 = new MongooseSchema23(
|
|
2238
2358
|
{
|
|
2239
2359
|
active: { default: false, required: true, type: Boolean },
|
|
2240
2360
|
approvedAt: { default: null, required: false, type: Date },
|
|
@@ -2250,7 +2370,7 @@ var schema22 = new MongooseSchema21(
|
|
|
2250
2370
|
},
|
|
2251
2371
|
deletedAt: { default: null, required: false, type: Date },
|
|
2252
2372
|
postType: {
|
|
2253
|
-
enum: Object.values(
|
|
2373
|
+
enum: Object.values(import_cluemart_shared21.EnumPostType),
|
|
2254
2374
|
required: true,
|
|
2255
2375
|
type: String
|
|
2256
2376
|
},
|
|
@@ -2265,16 +2385,16 @@ var schema22 = new MongooseSchema21(
|
|
|
2265
2385
|
},
|
|
2266
2386
|
{ timestamps: true }
|
|
2267
2387
|
);
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
var PostModel =
|
|
2388
|
+
schema23.index({ title: 1 });
|
|
2389
|
+
schema23.index({ tags: 1 });
|
|
2390
|
+
schema23.index({ postType: 1, slug: 1 }, { unique: true });
|
|
2391
|
+
var PostModel = import_mongoose28.default.models.Post || import_mongoose28.default.model("Post", schema23);
|
|
2272
2392
|
|
|
2273
2393
|
// src/mongoose/AppSetting.ts
|
|
2274
|
-
var
|
|
2275
|
-
var
|
|
2394
|
+
var import_mongoose29 = __toESM(require("mongoose"));
|
|
2395
|
+
var MongooseSchema24 = import_mongoose29.default.Schema;
|
|
2276
2396
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
2277
|
-
var AppSettingSchema = new
|
|
2397
|
+
var AppSettingSchema = new MongooseSchema24(
|
|
2278
2398
|
{
|
|
2279
2399
|
activeSchoolsStudentCountTotal: {
|
|
2280
2400
|
default: 0,
|
|
@@ -2296,8 +2416,8 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2296
2416
|
validate: Number.isInteger
|
|
2297
2417
|
},
|
|
2298
2418
|
mobileDisplayEnabled: { default: false, required: true, type: Boolean },
|
|
2299
|
-
purchasePricing: { type:
|
|
2300
|
-
regionPricing: { type:
|
|
2419
|
+
purchasePricing: { type: MongooseSchema24.Types.Mixed },
|
|
2420
|
+
regionPricing: { type: MongooseSchema24.Types.Mixed },
|
|
2301
2421
|
paidSlotsPerPlacement: { enum: [30], type: Number },
|
|
2302
2422
|
reservedSlotsPerPlacement: { enum: [7], type: Number },
|
|
2303
2423
|
rotationSeconds: { enum: [8], type: Number },
|
|
@@ -2322,12 +2442,12 @@ var AppSettingSchema = new MongooseSchema22(
|
|
|
2322
2442
|
},
|
|
2323
2443
|
{ timestamps: true }
|
|
2324
2444
|
);
|
|
2325
|
-
var AppSettingModel =
|
|
2445
|
+
var AppSettingModel = import_mongoose29.default.models.AppSetting || import_mongoose29.default.model("AppSetting", AppSettingSchema);
|
|
2326
2446
|
|
|
2327
2447
|
// src/mongoose/AuthHandoffToken.ts
|
|
2328
|
-
var
|
|
2329
|
-
var
|
|
2330
|
-
var
|
|
2448
|
+
var import_mongoose30 = __toESM(require("mongoose"));
|
|
2449
|
+
var MongooseSchema25 = import_mongoose30.default.Schema;
|
|
2450
|
+
var schema24 = new MongooseSchema25(
|
|
2331
2451
|
{
|
|
2332
2452
|
expiresAt: { required: true, type: Date },
|
|
2333
2453
|
jti: { index: true, required: true, type: String, unique: true },
|
|
@@ -2336,25 +2456,25 @@ var schema23 = new MongooseSchema23(
|
|
|
2336
2456
|
index: true,
|
|
2337
2457
|
ref: "User",
|
|
2338
2458
|
required: true,
|
|
2339
|
-
type:
|
|
2459
|
+
type: import_mongoose30.default.Schema.Types.ObjectId
|
|
2340
2460
|
}
|
|
2341
2461
|
},
|
|
2342
2462
|
{ timestamps: true }
|
|
2343
2463
|
);
|
|
2344
|
-
|
|
2345
|
-
var AuthHandoffTokenModel =
|
|
2464
|
+
schema24.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2465
|
+
var AuthHandoffTokenModel = import_mongoose30.default.models.AuthHandoffToken || import_mongoose30.default.model("AuthHandoffToken", schema24);
|
|
2346
2466
|
|
|
2347
2467
|
// src/mongoose/game/Game.ts
|
|
2348
|
-
var
|
|
2349
|
-
var
|
|
2468
|
+
var import_cluemart_shared22 = require("@timardex/cluemart-shared");
|
|
2469
|
+
var import_mongoose34 = __toESM(require("mongoose"));
|
|
2350
2470
|
|
|
2351
2471
|
// src/mongoose/game/DailyClue.ts
|
|
2352
|
-
var
|
|
2472
|
+
var import_mongoose32 = __toESM(require("mongoose"));
|
|
2353
2473
|
|
|
2354
2474
|
// src/mongoose/game/utils.ts
|
|
2355
|
-
var
|
|
2356
|
-
var
|
|
2357
|
-
var schemaGameDate = new
|
|
2475
|
+
var import_mongoose31 = __toESM(require("mongoose"));
|
|
2476
|
+
var MongooseSchema26 = import_mongoose31.default.Schema;
|
|
2477
|
+
var schemaGameDate = new MongooseSchema26(
|
|
2358
2478
|
{
|
|
2359
2479
|
endDate: { required: true, type: Date },
|
|
2360
2480
|
startDate: { required: true, type: Date }
|
|
@@ -2363,8 +2483,8 @@ var schemaGameDate = new MongooseSchema24(
|
|
|
2363
2483
|
);
|
|
2364
2484
|
|
|
2365
2485
|
// src/mongoose/game/DailyClue.ts
|
|
2366
|
-
var
|
|
2367
|
-
var schemaLetters = new
|
|
2486
|
+
var MongooseSchema27 = import_mongoose32.default.Schema;
|
|
2487
|
+
var schemaLetters = new MongooseSchema27(
|
|
2368
2488
|
{
|
|
2369
2489
|
collected: { required: false, type: [String] },
|
|
2370
2490
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -2372,14 +2492,14 @@ var schemaLetters = new MongooseSchema25(
|
|
|
2372
2492
|
},
|
|
2373
2493
|
{ _id: false }
|
|
2374
2494
|
);
|
|
2375
|
-
var schemaDailyClueBaseGame = new
|
|
2495
|
+
var schemaDailyClueBaseGame = new MongooseSchema27(
|
|
2376
2496
|
{
|
|
2377
2497
|
gameDate: { required: true, type: schemaGameDate },
|
|
2378
2498
|
gameSolution: { required: true, type: String }
|
|
2379
2499
|
},
|
|
2380
2500
|
{ _id: false }
|
|
2381
2501
|
);
|
|
2382
|
-
var schemaDailyClueGameData = new
|
|
2502
|
+
var schemaDailyClueGameData = new MongooseSchema27(
|
|
2383
2503
|
{
|
|
2384
2504
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
2385
2505
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -2394,9 +2514,9 @@ var schemaDailyClueGameData = new MongooseSchema25(
|
|
|
2394
2514
|
);
|
|
2395
2515
|
|
|
2396
2516
|
// src/mongoose/game/PuzzleGame.ts
|
|
2397
|
-
var
|
|
2398
|
-
var
|
|
2399
|
-
var schemaPuzzleAnswer = new
|
|
2517
|
+
var import_mongoose33 = __toESM(require("mongoose"));
|
|
2518
|
+
var MongooseSchema28 = import_mongoose33.default.Schema;
|
|
2519
|
+
var schemaPuzzleAnswer = new MongooseSchema28(
|
|
2400
2520
|
{
|
|
2401
2521
|
answer: { required: true, type: String },
|
|
2402
2522
|
answerId: { required: true, type: String },
|
|
@@ -2404,7 +2524,7 @@ var schemaPuzzleAnswer = new MongooseSchema26(
|
|
|
2404
2524
|
},
|
|
2405
2525
|
{ _id: false }
|
|
2406
2526
|
);
|
|
2407
|
-
var schemaPuzzleQuestion = new
|
|
2527
|
+
var schemaPuzzleQuestion = new MongooseSchema28(
|
|
2408
2528
|
{
|
|
2409
2529
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
2410
2530
|
question: { required: true, type: String },
|
|
@@ -2412,20 +2532,20 @@ var schemaPuzzleQuestion = new MongooseSchema26(
|
|
|
2412
2532
|
},
|
|
2413
2533
|
{ _id: false }
|
|
2414
2534
|
);
|
|
2415
|
-
var schemaPuzzleBaseGame = new
|
|
2535
|
+
var schemaPuzzleBaseGame = new MongooseSchema28(
|
|
2416
2536
|
{
|
|
2417
2537
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
2418
2538
|
},
|
|
2419
2539
|
{ _id: false }
|
|
2420
2540
|
);
|
|
2421
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
2541
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema28(
|
|
2422
2542
|
{
|
|
2423
2543
|
questionId: { required: true, type: String },
|
|
2424
2544
|
selectedAnswerId: { required: true, type: String }
|
|
2425
2545
|
},
|
|
2426
2546
|
{ _id: false }
|
|
2427
2547
|
);
|
|
2428
|
-
var schemaPuzzleGameData = new
|
|
2548
|
+
var schemaPuzzleGameData = new MongooseSchema28(
|
|
2429
2549
|
{
|
|
2430
2550
|
answeredQuestions: {
|
|
2431
2551
|
default: null,
|
|
@@ -2440,30 +2560,30 @@ var schemaPuzzleGameData = new MongooseSchema26(
|
|
|
2440
2560
|
);
|
|
2441
2561
|
|
|
2442
2562
|
// src/mongoose/game/Game.ts
|
|
2443
|
-
var
|
|
2563
|
+
var MongooseSchema29 = import_mongoose34.default.Schema;
|
|
2444
2564
|
var gameDataSchemas = {
|
|
2445
|
-
[
|
|
2446
|
-
[
|
|
2447
|
-
[
|
|
2565
|
+
[import_cluemart_shared22.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2566
|
+
[import_cluemart_shared22.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2567
|
+
[import_cluemart_shared22.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2448
2568
|
};
|
|
2449
2569
|
var gameDataDefinition = Object.fromEntries(
|
|
2450
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2570
|
+
Object.entries(gameDataSchemas).map(([key, schema29]) => [
|
|
2451
2571
|
key,
|
|
2452
|
-
{ default: null, required: false, type:
|
|
2572
|
+
{ default: null, required: false, type: schema29 }
|
|
2453
2573
|
])
|
|
2454
2574
|
);
|
|
2455
|
-
var gameHistorySchema = new
|
|
2575
|
+
var gameHistorySchema = new MongooseSchema29(
|
|
2456
2576
|
{
|
|
2457
2577
|
createdAt: { required: true, type: Date },
|
|
2458
2578
|
gameDate: { required: true, type: schemaGameDate },
|
|
2459
2579
|
gameStatus: {
|
|
2460
|
-
enum: Object.values(
|
|
2580
|
+
enum: Object.values(import_cluemart_shared22.EnumGameStatus),
|
|
2461
2581
|
required: true,
|
|
2462
2582
|
type: String
|
|
2463
2583
|
},
|
|
2464
2584
|
gameTitle: { required: true, type: String },
|
|
2465
2585
|
gameType: {
|
|
2466
|
-
enum: Object.values(
|
|
2586
|
+
enum: Object.values(import_cluemart_shared22.EnumGameType),
|
|
2467
2587
|
required: true,
|
|
2468
2588
|
type: String
|
|
2469
2589
|
},
|
|
@@ -2472,14 +2592,14 @@ var gameHistorySchema = new MongooseSchema27(
|
|
|
2472
2592
|
},
|
|
2473
2593
|
{ _id: false }
|
|
2474
2594
|
);
|
|
2475
|
-
var gameTypeSchema = new
|
|
2595
|
+
var gameTypeSchema = new MongooseSchema29(
|
|
2476
2596
|
{
|
|
2477
2597
|
active: { default: true, required: true, type: Boolean },
|
|
2478
2598
|
gameData: gameDataDefinition,
|
|
2479
2599
|
gameHistory: { default: [], required: true, type: [gameHistorySchema] },
|
|
2480
2600
|
gameTitle: { required: true, type: String },
|
|
2481
2601
|
gameType: {
|
|
2482
|
-
enum: Object.values(
|
|
2602
|
+
enum: Object.values(import_cluemart_shared22.EnumGameType),
|
|
2483
2603
|
required: true,
|
|
2484
2604
|
type: String
|
|
2485
2605
|
},
|
|
@@ -2490,7 +2610,7 @@ var gameTypeSchema = new MongooseSchema27(
|
|
|
2490
2610
|
},
|
|
2491
2611
|
{ timestamps: true }
|
|
2492
2612
|
);
|
|
2493
|
-
var
|
|
2613
|
+
var schema25 = new MongooseSchema29(
|
|
2494
2614
|
{
|
|
2495
2615
|
active: { default: false, required: true, type: Boolean },
|
|
2496
2616
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2503,12 +2623,12 @@ var schema24 = new MongooseSchema27(
|
|
|
2503
2623
|
},
|
|
2504
2624
|
{ timestamps: true }
|
|
2505
2625
|
);
|
|
2506
|
-
var GameModel =
|
|
2626
|
+
var GameModel = import_mongoose34.default.models.Game || import_mongoose34.default.model("Game", schema25);
|
|
2507
2627
|
|
|
2508
2628
|
// src/mongoose/School.ts
|
|
2509
|
-
var
|
|
2510
|
-
var
|
|
2511
|
-
var campaignsSchema = new
|
|
2629
|
+
var import_mongoose35 = __toESM(require("mongoose"));
|
|
2630
|
+
var MongooseSchema30 = import_mongoose35.default.Schema;
|
|
2631
|
+
var campaignsSchema = new MongooseSchema30(
|
|
2512
2632
|
{
|
|
2513
2633
|
endDate: { required: true, type: Date },
|
|
2514
2634
|
name: { required: true, type: String },
|
|
@@ -2516,7 +2636,7 @@ var campaignsSchema = new MongooseSchema28(
|
|
|
2516
2636
|
},
|
|
2517
2637
|
{ _id: false }
|
|
2518
2638
|
);
|
|
2519
|
-
var
|
|
2639
|
+
var schema26 = new MongooseSchema30(
|
|
2520
2640
|
{
|
|
2521
2641
|
// New schools are active by default
|
|
2522
2642
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2543,26 +2663,26 @@ var schema25 = new MongooseSchema28(
|
|
|
2543
2663
|
},
|
|
2544
2664
|
{ timestamps: true }
|
|
2545
2665
|
);
|
|
2546
|
-
|
|
2666
|
+
schema26.index(
|
|
2547
2667
|
{ schoolCode: 1 },
|
|
2548
2668
|
{
|
|
2549
2669
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2550
2670
|
unique: true
|
|
2551
2671
|
}
|
|
2552
2672
|
);
|
|
2553
|
-
var SchoolModel =
|
|
2673
|
+
var SchoolModel = import_mongoose35.default.models.School || import_mongoose35.default.model("School", schema26);
|
|
2554
2674
|
|
|
2555
2675
|
// src/mongoose/Affiliate.ts
|
|
2556
|
-
var
|
|
2557
|
-
var
|
|
2558
|
-
var
|
|
2559
|
-
var affiliateRewardSchema = new
|
|
2676
|
+
var import_cluemart_shared23 = require("@timardex/cluemart-shared");
|
|
2677
|
+
var import_mongoose36 = __toESM(require("mongoose"));
|
|
2678
|
+
var MongooseSchema31 = import_mongoose36.default.Schema;
|
|
2679
|
+
var affiliateRewardSchema = new MongooseSchema31(
|
|
2560
2680
|
{
|
|
2561
2681
|
createdAt: { required: true, type: Date },
|
|
2562
2682
|
redeemedAt: { default: null, required: false, type: Date },
|
|
2563
2683
|
rewardDescription: { required: true, type: String },
|
|
2564
2684
|
rewardType: {
|
|
2565
|
-
enum: Object.values(
|
|
2685
|
+
enum: Object.values(import_cluemart_shared23.EnumAffiliateRewardType),
|
|
2566
2686
|
required: true,
|
|
2567
2687
|
type: String
|
|
2568
2688
|
},
|
|
@@ -2570,13 +2690,13 @@ var affiliateRewardSchema = new MongooseSchema29(
|
|
|
2570
2690
|
},
|
|
2571
2691
|
{ _id: false }
|
|
2572
2692
|
);
|
|
2573
|
-
var affiliateResourceSchema = new
|
|
2693
|
+
var affiliateResourceSchema = new MongooseSchema31(
|
|
2574
2694
|
{
|
|
2575
2695
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
2576
2696
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2577
2697
|
resourceId: {
|
|
2578
2698
|
required: true,
|
|
2579
|
-
type:
|
|
2699
|
+
type: import_mongoose36.default.Schema.Types.ObjectId
|
|
2580
2700
|
},
|
|
2581
2701
|
resourceName: { required: true, type: String },
|
|
2582
2702
|
resourceOwner: {
|
|
@@ -2584,7 +2704,7 @@ var affiliateResourceSchema = new MongooseSchema29(
|
|
|
2584
2704
|
type: OwnerTypeSchema
|
|
2585
2705
|
},
|
|
2586
2706
|
resourceType: {
|
|
2587
|
-
enum: Object.values(
|
|
2707
|
+
enum: Object.values(import_cluemart_shared23.EnumResourceType),
|
|
2588
2708
|
required: true,
|
|
2589
2709
|
type: String
|
|
2590
2710
|
},
|
|
@@ -2596,20 +2716,20 @@ var affiliateResourceSchema = new MongooseSchema29(
|
|
|
2596
2716
|
},
|
|
2597
2717
|
{ _id: false }
|
|
2598
2718
|
);
|
|
2599
|
-
var affiliateContactDetailsSchema = new
|
|
2719
|
+
var affiliateContactDetailsSchema = new MongooseSchema31(
|
|
2600
2720
|
{
|
|
2601
2721
|
mobilePhone: { required: true, type: String }
|
|
2602
2722
|
},
|
|
2603
2723
|
{ _id: false }
|
|
2604
2724
|
);
|
|
2605
|
-
var affiliateBankAccountDetailsSchema = new
|
|
2725
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema31(
|
|
2606
2726
|
{
|
|
2607
2727
|
accountHolderName: { required: true, type: String },
|
|
2608
2728
|
accountNumber: { required: true, type: String }
|
|
2609
2729
|
},
|
|
2610
2730
|
{ _id: false }
|
|
2611
2731
|
);
|
|
2612
|
-
var affiliateDetailsSchema = new
|
|
2732
|
+
var affiliateDetailsSchema = new MongooseSchema31(
|
|
2613
2733
|
{
|
|
2614
2734
|
bankAccountDetails: {
|
|
2615
2735
|
required: true,
|
|
@@ -2622,7 +2742,7 @@ var affiliateDetailsSchema = new MongooseSchema29(
|
|
|
2622
2742
|
lastName: { required: true, type: String },
|
|
2623
2743
|
location: { required: true, type: locationsSchema },
|
|
2624
2744
|
participantType: {
|
|
2625
|
-
enum: Object.values(
|
|
2745
|
+
enum: Object.values(import_cluemart_shared23.EnumAffiliateParticipantType),
|
|
2626
2746
|
required: true,
|
|
2627
2747
|
type: String
|
|
2628
2748
|
},
|
|
@@ -2631,7 +2751,7 @@ var affiliateDetailsSchema = new MongooseSchema29(
|
|
|
2631
2751
|
},
|
|
2632
2752
|
{ _id: false }
|
|
2633
2753
|
);
|
|
2634
|
-
var redeemHistorySchema = new
|
|
2754
|
+
var redeemHistorySchema = new MongooseSchema31(
|
|
2635
2755
|
{
|
|
2636
2756
|
paidAt: { default: null, required: false, type: Date },
|
|
2637
2757
|
redeemedAt: { required: true, type: Date },
|
|
@@ -2639,7 +2759,7 @@ var redeemHistorySchema = new MongooseSchema29(
|
|
|
2639
2759
|
},
|
|
2640
2760
|
{ _id: false }
|
|
2641
2761
|
);
|
|
2642
|
-
var
|
|
2762
|
+
var schema27 = new MongooseSchema31(
|
|
2643
2763
|
{
|
|
2644
2764
|
active: { default: false, required: true, type: Boolean },
|
|
2645
2765
|
affiliateBonusRewards: {
|
|
@@ -2669,26 +2789,26 @@ var schema26 = new MongooseSchema29(
|
|
|
2669
2789
|
},
|
|
2670
2790
|
{ timestamps: true }
|
|
2671
2791
|
);
|
|
2672
|
-
|
|
2792
|
+
schema27.index(
|
|
2673
2793
|
{ affiliateCode: 1 },
|
|
2674
2794
|
{
|
|
2675
2795
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2676
2796
|
unique: true
|
|
2677
2797
|
}
|
|
2678
2798
|
);
|
|
2679
|
-
var AffiliateModel =
|
|
2799
|
+
var AffiliateModel = import_mongoose36.default.models.Affiliate || import_mongoose36.default.model("Affiliate", schema27);
|
|
2680
2800
|
|
|
2681
2801
|
// src/mongoose/Coupon.ts
|
|
2682
|
-
var
|
|
2683
|
-
var
|
|
2684
|
-
var
|
|
2685
|
-
var couponOptionSchema = new
|
|
2802
|
+
var import_cluemart_shared24 = require("@timardex/cluemart-shared");
|
|
2803
|
+
var import_mongoose37 = __toESM(require("mongoose"));
|
|
2804
|
+
var MongooseSchema32 = import_mongoose37.default.Schema;
|
|
2805
|
+
var couponOptionSchema = new MongooseSchema32(
|
|
2686
2806
|
{
|
|
2687
2807
|
buy: { required: false, type: Number },
|
|
2688
2808
|
get: { required: false, type: Number },
|
|
2689
2809
|
maxRewardCount: { required: false, type: Number },
|
|
2690
2810
|
type: {
|
|
2691
|
-
enum: Object.values(
|
|
2811
|
+
enum: Object.values(import_cluemart_shared24.EnumCouponQualificationType),
|
|
2692
2812
|
required: true,
|
|
2693
2813
|
type: String
|
|
2694
2814
|
},
|
|
@@ -2697,29 +2817,29 @@ var couponOptionSchema = new MongooseSchema30(
|
|
|
2697
2817
|
},
|
|
2698
2818
|
{ _id: false }
|
|
2699
2819
|
);
|
|
2700
|
-
var couponVendorProductSchema = new
|
|
2820
|
+
var couponVendorProductSchema = new MongooseSchema32(
|
|
2701
2821
|
{
|
|
2702
2822
|
couponId: {
|
|
2703
2823
|
required: true,
|
|
2704
|
-
type:
|
|
2824
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2705
2825
|
},
|
|
2706
2826
|
productId: {
|
|
2707
2827
|
required: true,
|
|
2708
|
-
type:
|
|
2828
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2709
2829
|
},
|
|
2710
2830
|
vendorCouponId: {
|
|
2711
2831
|
required: false,
|
|
2712
|
-
type:
|
|
2832
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2713
2833
|
},
|
|
2714
2834
|
vendorId: {
|
|
2715
2835
|
ref: "Vendor",
|
|
2716
2836
|
required: true,
|
|
2717
|
-
type:
|
|
2837
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2718
2838
|
}
|
|
2719
2839
|
},
|
|
2720
2840
|
{ _id: false }
|
|
2721
2841
|
);
|
|
2722
|
-
var couponCodeSchema = new
|
|
2842
|
+
var couponCodeSchema = new MongooseSchema32(
|
|
2723
2843
|
{
|
|
2724
2844
|
code: { required: true, type: String },
|
|
2725
2845
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -2727,7 +2847,7 @@ var couponCodeSchema = new MongooseSchema30(
|
|
|
2727
2847
|
},
|
|
2728
2848
|
{ _id: false }
|
|
2729
2849
|
);
|
|
2730
|
-
var couponParticipantUserSchema = new
|
|
2850
|
+
var couponParticipantUserSchema = new MongooseSchema32(
|
|
2731
2851
|
{
|
|
2732
2852
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2733
2853
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -2736,12 +2856,12 @@ var couponParticipantUserSchema = new MongooseSchema30(
|
|
|
2736
2856
|
userId: {
|
|
2737
2857
|
ref: "User",
|
|
2738
2858
|
required: true,
|
|
2739
|
-
type:
|
|
2859
|
+
type: import_mongoose37.default.Schema.Types.ObjectId
|
|
2740
2860
|
}
|
|
2741
2861
|
},
|
|
2742
2862
|
{ timestamps: true }
|
|
2743
2863
|
);
|
|
2744
|
-
var couponDataSchema = new
|
|
2864
|
+
var couponDataSchema = new MongooseSchema32(
|
|
2745
2865
|
{
|
|
2746
2866
|
active: { default: true, required: true, type: Boolean },
|
|
2747
2867
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -2760,7 +2880,7 @@ var couponDataSchema = new MongooseSchema30(
|
|
|
2760
2880
|
},
|
|
2761
2881
|
resourceId: { required: true, type: String },
|
|
2762
2882
|
resourceType: {
|
|
2763
|
-
enum: Object.values(
|
|
2883
|
+
enum: Object.values(import_cluemart_shared24.EnumResourceType),
|
|
2764
2884
|
required: true,
|
|
2765
2885
|
type: String
|
|
2766
2886
|
},
|
|
@@ -2768,7 +2888,7 @@ var couponDataSchema = new MongooseSchema30(
|
|
|
2768
2888
|
},
|
|
2769
2889
|
{ timestamps: true }
|
|
2770
2890
|
);
|
|
2771
|
-
var
|
|
2891
|
+
var schema28 = new MongooseSchema32(
|
|
2772
2892
|
{
|
|
2773
2893
|
active: { default: true, required: true, type: Boolean },
|
|
2774
2894
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2780,62 +2900,62 @@ var schema27 = new MongooseSchema30(
|
|
|
2780
2900
|
},
|
|
2781
2901
|
{ timestamps: true }
|
|
2782
2902
|
);
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
var CouponModel =
|
|
2903
|
+
schema28.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2904
|
+
schema28.index({ "couponData.participantUsers.userId": 1 });
|
|
2905
|
+
var CouponModel = import_mongoose37.default.models.Coupon || import_mongoose37.default.model("Coupon", schema28);
|
|
2786
2906
|
|
|
2787
2907
|
// src/mongoose/Impersonation.ts
|
|
2788
|
-
var
|
|
2789
|
-
var
|
|
2790
|
-
var
|
|
2791
|
-
var impersonationSessionSchema = new
|
|
2908
|
+
var import_cluemart_shared25 = require("@timardex/cluemart-shared");
|
|
2909
|
+
var import_mongoose38 = __toESM(require("mongoose"));
|
|
2910
|
+
var MongooseSchema33 = import_mongoose38.default.Schema;
|
|
2911
|
+
var impersonationSessionSchema = new MongooseSchema33(
|
|
2792
2912
|
{
|
|
2793
2913
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
2794
2914
|
impersonatedUserId: {
|
|
2795
2915
|
index: true,
|
|
2796
2916
|
ref: "User",
|
|
2797
2917
|
required: true,
|
|
2798
|
-
type:
|
|
2918
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2799
2919
|
},
|
|
2800
2920
|
impersonatorUserId: {
|
|
2801
2921
|
index: true,
|
|
2802
2922
|
ref: "User",
|
|
2803
2923
|
required: true,
|
|
2804
|
-
type:
|
|
2924
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2805
2925
|
},
|
|
2806
2926
|
refreshToken: { required: true, type: String }
|
|
2807
2927
|
},
|
|
2808
2928
|
{ timestamps: true }
|
|
2809
2929
|
);
|
|
2810
|
-
var ImpersonationSessionModel =
|
|
2930
|
+
var ImpersonationSessionModel = import_mongoose38.default.models.ImpersonationSession || import_mongoose38.default.model(
|
|
2811
2931
|
"ImpersonationSession",
|
|
2812
2932
|
impersonationSessionSchema
|
|
2813
2933
|
);
|
|
2814
|
-
var impersonationAuditSchema = new
|
|
2934
|
+
var impersonationAuditSchema = new MongooseSchema33(
|
|
2815
2935
|
{
|
|
2816
2936
|
action: { enum: ["start", "end"], required: true, type: String },
|
|
2817
2937
|
endReason: { type: String },
|
|
2818
2938
|
impersonatedUserId: {
|
|
2819
2939
|
ref: "User",
|
|
2820
2940
|
required: true,
|
|
2821
|
-
type:
|
|
2941
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2822
2942
|
},
|
|
2823
2943
|
impersonatorUserId: {
|
|
2824
2944
|
ref: "User",
|
|
2825
2945
|
required: true,
|
|
2826
|
-
type:
|
|
2946
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2827
2947
|
},
|
|
2828
|
-
resourceId: { type:
|
|
2829
|
-
resourceType: { enum: Object.values(
|
|
2948
|
+
resourceId: { type: import_mongoose38.default.Schema.Types.ObjectId },
|
|
2949
|
+
resourceType: { enum: Object.values(import_cluemart_shared25.EnumResourceType), type: String },
|
|
2830
2950
|
sessionId: {
|
|
2831
2951
|
ref: "ImpersonationSession",
|
|
2832
2952
|
required: true,
|
|
2833
|
-
type:
|
|
2953
|
+
type: import_mongoose38.default.Schema.Types.ObjectId
|
|
2834
2954
|
}
|
|
2835
2955
|
},
|
|
2836
2956
|
{ timestamps: true }
|
|
2837
2957
|
);
|
|
2838
|
-
var ImpersonationAuditModel =
|
|
2958
|
+
var ImpersonationAuditModel = import_mongoose38.default.models.ImpersonationAudit || import_mongoose38.default.model(
|
|
2839
2959
|
"ImpersonationAudit",
|
|
2840
2960
|
impersonationAuditSchema
|
|
2841
2961
|
);
|
|
@@ -2856,7 +2976,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
|
|
|
2856
2976
|
}
|
|
2857
2977
|
|
|
2858
2978
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
2859
|
-
var
|
|
2979
|
+
var import_cluemart_shared27 = require("@timardex/cluemart-shared");
|
|
2860
2980
|
var import_utils3 = require("@timardex/cluemart-shared/utils");
|
|
2861
2981
|
|
|
2862
2982
|
// src/service/saveNotificationsInDb.ts
|
|
@@ -2991,7 +3111,7 @@ async function sendPushNotifications({
|
|
|
2991
3111
|
}
|
|
2992
3112
|
|
|
2993
3113
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
2994
|
-
var
|
|
3114
|
+
var import_cluemart_shared26 = require("@timardex/cluemart-shared");
|
|
2995
3115
|
var import_dayjs = __toESM(require("dayjs"));
|
|
2996
3116
|
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
2997
3117
|
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
@@ -3049,17 +3169,17 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
3049
3169
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
3050
3170
|
import_dayjs.default.extend(import_utc.default);
|
|
3051
3171
|
import_dayjs.default.extend(import_timezone.default);
|
|
3052
|
-
var SUBSCRIPTION_REWARD_TIMEZONE =
|
|
3172
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared26.NZ_TZ;
|
|
3053
3173
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
3054
3174
|
const { hasSubscription, validTypes } = await getVendorStripeSubscriptionPlanForRewards(userId, now);
|
|
3055
|
-
if (validTypes.has(
|
|
3175
|
+
if (validTypes.has(import_cluemart_shared26.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared26.EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
3056
3176
|
if (hasSubscription) {
|
|
3057
|
-
return
|
|
3177
|
+
return import_cluemart_shared26.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
|
|
3058
3178
|
}
|
|
3059
|
-
return
|
|
3179
|
+
return import_cluemart_shared26.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
3060
3180
|
}
|
|
3061
|
-
if (validTypes.has(
|
|
3062
|
-
return
|
|
3181
|
+
if (validTypes.has(import_cluemart_shared26.EnumUserLicence.STANDARD_VENDOR)) {
|
|
3182
|
+
return import_cluemart_shared26.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
3063
3183
|
}
|
|
3064
3184
|
return null;
|
|
3065
3185
|
}
|
|
@@ -3071,7 +3191,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
|
3071
3191
|
|
|
3072
3192
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
3073
3193
|
function isEligibleVendorResource(resource) {
|
|
3074
|
-
return resource.resourceType ===
|
|
3194
|
+
return resource.resourceType === import_cluemart_shared27.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
|
|
3075
3195
|
}
|
|
3076
3196
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
3077
3197
|
return await AffiliateModel.find({
|
|
@@ -3080,7 +3200,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
|
|
|
3080
3200
|
$elemMatch: {
|
|
3081
3201
|
resourceActive: true,
|
|
3082
3202
|
resourceDeletedAt: null,
|
|
3083
|
-
resourceType:
|
|
3203
|
+
resourceType: import_cluemart_shared27.EnumResourceType.VENDOR
|
|
3084
3204
|
}
|
|
3085
3205
|
},
|
|
3086
3206
|
deletedAt: null
|
|
@@ -3114,11 +3234,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
|
|
|
3114
3234
|
data: {
|
|
3115
3235
|
resourceId: String(affiliateId),
|
|
3116
3236
|
resourceName: resourceNames.join(", "),
|
|
3117
|
-
resourceType:
|
|
3237
|
+
resourceType: import_cluemart_shared27.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
|
|
3118
3238
|
},
|
|
3119
3239
|
message,
|
|
3120
3240
|
title: "Affiliate points earned",
|
|
3121
|
-
type:
|
|
3241
|
+
type: import_cluemart_shared27.EnumNotificationType.SYSTEM,
|
|
3122
3242
|
userIds: [affiliateOwnerUserId]
|
|
3123
3243
|
};
|
|
3124
3244
|
try {
|
|
@@ -3147,7 +3267,7 @@ async function tryAwardSubscriptionReward({
|
|
|
3147
3267
|
resourceActive: true,
|
|
3148
3268
|
resourceDeletedAt: null,
|
|
3149
3269
|
resourceId: resource.resourceId,
|
|
3150
|
-
resourceType:
|
|
3270
|
+
resourceType: import_cluemart_shared27.EnumResourceType.VENDOR,
|
|
3151
3271
|
rewards: {
|
|
3152
3272
|
$not: {
|
|
3153
3273
|
$elemMatch: {
|
|
@@ -3268,7 +3388,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
3268
3388
|
}
|
|
3269
3389
|
|
|
3270
3390
|
// src/service/database.ts
|
|
3271
|
-
var
|
|
3391
|
+
var import_mongoose42 = __toESM(require("mongoose"));
|
|
3272
3392
|
var connectToDatabase = async ({
|
|
3273
3393
|
appName,
|
|
3274
3394
|
dbName,
|
|
@@ -3281,7 +3401,7 @@ var connectToDatabase = async ({
|
|
|
3281
3401
|
// Fallback to MongoDB Atlas connection string
|
|
3282
3402
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
3283
3403
|
);
|
|
3284
|
-
await
|
|
3404
|
+
await import_mongoose42.default.connect(mongoUri);
|
|
3285
3405
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
3286
3406
|
console.log(
|
|
3287
3407
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -3294,7 +3414,7 @@ var connectToDatabase = async ({
|
|
|
3294
3414
|
|
|
3295
3415
|
// src/types/index.ts
|
|
3296
3416
|
var import_express = __toESM(require("express"));
|
|
3297
|
-
var
|
|
3417
|
+
var import_mongoose43 = __toESM(require("mongoose"));
|
|
3298
3418
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
3299
3419
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
3300
3420
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -3349,9 +3469,9 @@ async function notifyUsers({
|
|
|
3349
3469
|
}
|
|
3350
3470
|
|
|
3351
3471
|
// src/service/updateAdStatus.ts
|
|
3352
|
-
var
|
|
3472
|
+
var import_cluemart_shared28 = require("@timardex/cluemart-shared");
|
|
3353
3473
|
async function updateAdStatuses() {
|
|
3354
|
-
const now = (0,
|
|
3474
|
+
const now = (0, import_cluemart_shared28.nzDayKey)();
|
|
3355
3475
|
const invalidResult = await AdModel.updateMany(
|
|
3356
3476
|
{
|
|
3357
3477
|
$or: [
|
|
@@ -3359,50 +3479,50 @@ async function updateAdStatuses() {
|
|
|
3359
3479
|
{ end: { $exists: false } },
|
|
3360
3480
|
{ $expr: { $gt: ["$start", "$end"] } }
|
|
3361
3481
|
],
|
|
3362
|
-
status: { $ne:
|
|
3482
|
+
status: { $ne: import_cluemart_shared28.EnumAdStatus.PAUSED }
|
|
3363
3483
|
},
|
|
3364
|
-
{ $set: { status:
|
|
3484
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.PAUSED } }
|
|
3365
3485
|
);
|
|
3366
3486
|
const expiredResult = await AdModel.updateMany(
|
|
3367
|
-
{ end: { $lte: now }, status: { $ne:
|
|
3368
|
-
{ $set: { status:
|
|
3487
|
+
{ end: { $lte: now }, status: { $ne: import_cluemart_shared28.EnumAdStatus.EXPIRED } },
|
|
3488
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.EXPIRED } }
|
|
3369
3489
|
);
|
|
3370
3490
|
const eligibleBooking = {
|
|
3371
3491
|
$or: [
|
|
3372
3492
|
{ bookingKind: { $exists: false } },
|
|
3373
3493
|
{ bookingKind: null },
|
|
3374
3494
|
{
|
|
3375
|
-
approvalStatus:
|
|
3376
|
-
bookingKind:
|
|
3495
|
+
approvalStatus: import_cluemart_shared28.EnumAdApprovalStatus.APPROVED,
|
|
3496
|
+
bookingKind: import_cluemart_shared28.EnumAdBookingSlotKind.RESERVED
|
|
3377
3497
|
},
|
|
3378
3498
|
{
|
|
3379
|
-
approvalStatus:
|
|
3380
|
-
bookingKind:
|
|
3381
|
-
paymentStatus:
|
|
3499
|
+
approvalStatus: import_cluemart_shared28.EnumAdApprovalStatus.APPROVED,
|
|
3500
|
+
bookingKind: import_cluemart_shared28.EnumAdBookingSlotKind.PAID,
|
|
3501
|
+
paymentStatus: import_cluemart_shared28.EnumAdPaymentStatus.PAID
|
|
3382
3502
|
}
|
|
3383
3503
|
]
|
|
3384
3504
|
};
|
|
3385
3505
|
const awaitingApprovalResult = await AdModel.updateMany(
|
|
3386
3506
|
{
|
|
3387
3507
|
$nor: eligibleBooking.$or,
|
|
3388
|
-
bookingKind: { $in: Object.values(
|
|
3508
|
+
bookingKind: { $in: Object.values(import_cluemart_shared28.EnumAdBookingSlotKind) },
|
|
3389
3509
|
end: { $gt: now },
|
|
3390
|
-
status:
|
|
3510
|
+
status: import_cluemart_shared28.EnumAdStatus.ACTIVE
|
|
3391
3511
|
},
|
|
3392
|
-
{ $set: { status:
|
|
3512
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.PAUSED } }
|
|
3393
3513
|
);
|
|
3394
3514
|
const activeResult = await AdModel.updateMany(
|
|
3395
3515
|
{
|
|
3396
3516
|
end: { $gt: now },
|
|
3397
3517
|
start: { $lte: now },
|
|
3398
|
-
status: { $ne:
|
|
3518
|
+
status: { $ne: import_cluemart_shared28.EnumAdStatus.ACTIVE },
|
|
3399
3519
|
...eligibleBooking
|
|
3400
3520
|
},
|
|
3401
|
-
{ $set: { status:
|
|
3521
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.ACTIVE } }
|
|
3402
3522
|
);
|
|
3403
3523
|
const pausedResult = await AdModel.updateMany(
|
|
3404
|
-
{ start: { $gt: now }, status: { $ne:
|
|
3405
|
-
{ $set: { status:
|
|
3524
|
+
{ start: { $gt: now }, status: { $ne: import_cluemart_shared28.EnumAdStatus.PAUSED } },
|
|
3525
|
+
{ $set: { status: import_cluemart_shared28.EnumAdStatus.PAUSED } }
|
|
3406
3526
|
);
|
|
3407
3527
|
console.log(
|
|
3408
3528
|
`\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
|
|
@@ -3410,15 +3530,15 @@ async function updateAdStatuses() {
|
|
|
3410
3530
|
}
|
|
3411
3531
|
|
|
3412
3532
|
// src/service/objectIdToString.ts
|
|
3413
|
-
var
|
|
3533
|
+
var import_mongoose45 = __toESM(require("mongoose"));
|
|
3414
3534
|
function isValidObjectId(value) {
|
|
3415
|
-
return
|
|
3535
|
+
return import_mongoose45.default.Types.ObjectId.isValid(value);
|
|
3416
3536
|
}
|
|
3417
3537
|
function convertObjectIdsToStrings(obj) {
|
|
3418
3538
|
if (obj === null || obj === void 0) {
|
|
3419
3539
|
return obj;
|
|
3420
3540
|
}
|
|
3421
|
-
if (obj instanceof
|
|
3541
|
+
if (obj instanceof import_mongoose45.default.Types.ObjectId) {
|
|
3422
3542
|
return obj.toString();
|
|
3423
3543
|
}
|
|
3424
3544
|
if (obj instanceof Date) {
|
|
@@ -3612,19 +3732,19 @@ function buildUserPointEntryRemovalPipeline(pointType, sourceId) {
|
|
|
3612
3732
|
}
|
|
3613
3733
|
|
|
3614
3734
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
3615
|
-
var
|
|
3735
|
+
var import_cluemart_shared30 = require("@timardex/cluemart-shared");
|
|
3616
3736
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
3617
3737
|
|
|
3618
3738
|
// src/service/event/archiveEndedEventDates.ts
|
|
3619
|
-
var
|
|
3739
|
+
var import_cluemart_shared29 = require("@timardex/cluemart-shared");
|
|
3620
3740
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
3621
3741
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
3622
3742
|
import_dayjs3.default.extend(import_customParseFormat.default);
|
|
3623
3743
|
var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
|
|
3624
|
-
|
|
3744
|
+
import_cluemart_shared29.EnumEventDateStatus.ENDED
|
|
3625
3745
|
]);
|
|
3626
3746
|
var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
|
|
3627
|
-
|
|
3747
|
+
import_cluemart_shared29.EnumEventDateStatus.INVALID
|
|
3628
3748
|
]);
|
|
3629
3749
|
function splitEventDatesForArchive(dateTime) {
|
|
3630
3750
|
return {
|
|
@@ -3647,12 +3767,12 @@ function dedupeArchivedSlotsByStartDateTime(slots) {
|
|
|
3647
3767
|
});
|
|
3648
3768
|
}
|
|
3649
3769
|
function isPastCanceledEventDate(slot, now) {
|
|
3650
|
-
if (slot.dateStatus !==
|
|
3770
|
+
if (slot.dateStatus !== import_cluemart_shared29.EnumEventDateStatus.CANCELED) {
|
|
3651
3771
|
return false;
|
|
3652
3772
|
}
|
|
3653
3773
|
const endDateTime = (0, import_dayjs3.default)(
|
|
3654
3774
|
`${slot.endDate} ${slot.endTime}`,
|
|
3655
|
-
`${
|
|
3775
|
+
`${import_cluemart_shared29.dateFormat} ${import_cluemart_shared29.timeFormat}`,
|
|
3656
3776
|
true
|
|
3657
3777
|
);
|
|
3658
3778
|
return endDateTime.isValid() && endDateTime.isBefore(now);
|
|
@@ -3698,7 +3818,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3698
3818
|
try {
|
|
3699
3819
|
for await (const doc of cursor) {
|
|
3700
3820
|
const dateTime = doc.dateTime.map(
|
|
3701
|
-
(slot) => (0,
|
|
3821
|
+
(slot) => (0, import_cluemart_shared30.updateSingleDateTimeStatus)(slot, now)
|
|
3702
3822
|
);
|
|
3703
3823
|
if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
|
|
3704
3824
|
continue;
|
|
@@ -3722,9 +3842,9 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3722
3842
|
var ARCHIVABLE_EVENT_FILTER = {
|
|
3723
3843
|
"dateTime.dateStatus": {
|
|
3724
3844
|
$in: [
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3845
|
+
import_cluemart_shared30.EnumEventDateStatus.ENDED,
|
|
3846
|
+
import_cluemart_shared30.EnumEventDateStatus.INVALID,
|
|
3847
|
+
import_cluemart_shared30.EnumEventDateStatus.CANCELED
|
|
3728
3848
|
]
|
|
3729
3849
|
},
|
|
3730
3850
|
deletedAt: null
|
|
@@ -3749,7 +3869,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3749
3869
|
try {
|
|
3750
3870
|
for await (const doc of cursor) {
|
|
3751
3871
|
const updated = doc.dateTime.map(
|
|
3752
|
-
(slot) => (0,
|
|
3872
|
+
(slot) => (0, import_cluemart_shared30.updateSingleDateTimeStatus)(slot, now)
|
|
3753
3873
|
);
|
|
3754
3874
|
const { archive, discard } = splitEventDatesForArchive(updated);
|
|
3755
3875
|
const pastCanceled = updated.filter(
|
|
@@ -3773,13 +3893,13 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3773
3893
|
if (archive.length > 0 || discard.length > 0) {
|
|
3774
3894
|
pullConditions.push({
|
|
3775
3895
|
dateStatus: {
|
|
3776
|
-
$in: [
|
|
3896
|
+
$in: [import_cluemart_shared30.EnumEventDateStatus.ENDED, import_cluemart_shared30.EnumEventDateStatus.INVALID]
|
|
3777
3897
|
}
|
|
3778
3898
|
});
|
|
3779
3899
|
}
|
|
3780
3900
|
for (const slot of pastCanceled) {
|
|
3781
3901
|
pullConditions.push({
|
|
3782
|
-
dateStatus:
|
|
3902
|
+
dateStatus: import_cluemart_shared30.EnumEventDateStatus.CANCELED,
|
|
3783
3903
|
startDate: slot.startDate,
|
|
3784
3904
|
startTime: slot.startTime
|
|
3785
3905
|
});
|
|
@@ -3821,9 +3941,9 @@ async function cleanEventInfoDates(now) {
|
|
|
3821
3941
|
try {
|
|
3822
3942
|
for await (const doc of cursor) {
|
|
3823
3943
|
const updated = doc.dateTime.map(
|
|
3824
|
-
(slot) => (0,
|
|
3944
|
+
(slot) => (0, import_cluemart_shared30.updateSingleDateTimeStatus)(slot, now)
|
|
3825
3945
|
);
|
|
3826
|
-
const kept = (0,
|
|
3946
|
+
const kept = (0, import_cluemart_shared30.filterDatesByFutureStatus)(updated);
|
|
3827
3947
|
if (kept.length === updated.length) {
|
|
3828
3948
|
continue;
|
|
3829
3949
|
}
|
|
@@ -3873,7 +3993,7 @@ async function updateAllEventDateTimeStatuses() {
|
|
|
3873
3993
|
}
|
|
3874
3994
|
|
|
3875
3995
|
// src/service/index.ts
|
|
3876
|
-
var
|
|
3996
|
+
var import_cluemart_shared38 = require("@timardex/cluemart-shared");
|
|
3877
3997
|
|
|
3878
3998
|
// src/service/event/findEventOrImportedMarketById.ts
|
|
3879
3999
|
async function findEventOrImportedMarketById(resourceId) {
|
|
@@ -3890,7 +4010,7 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
3890
4010
|
}
|
|
3891
4011
|
|
|
3892
4012
|
// src/service/relations.ts
|
|
3893
|
-
var
|
|
4013
|
+
var import_cluemart_shared31 = require("@timardex/cluemart-shared");
|
|
3894
4014
|
function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
3895
4015
|
if (!previousDateTime?.length) {
|
|
3896
4016
|
return false;
|
|
@@ -3906,8 +4026,8 @@ function didRemoveAnyStartedDates(previousDateTime, nextDateTime) {
|
|
|
3906
4026
|
return false;
|
|
3907
4027
|
}
|
|
3908
4028
|
return previousDateTime.some(
|
|
3909
|
-
(prev) => prev.dateStatus ===
|
|
3910
|
-
(next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus ===
|
|
4029
|
+
(prev) => prev.dateStatus === import_cluemart_shared31.EnumEventDateStatus.STARTED && !nextDateTime?.some(
|
|
4030
|
+
(next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared31.EnumEventDateStatus.STARTED
|
|
3911
4031
|
)
|
|
3912
4032
|
);
|
|
3913
4033
|
}
|
|
@@ -3918,7 +4038,7 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
|
|
|
3918
4038
|
) ?? false;
|
|
3919
4039
|
return {
|
|
3920
4040
|
...relationDate,
|
|
3921
|
-
status: existsInEvent ? relationDate.status :
|
|
4041
|
+
status: existsInEvent ? relationDate.status : import_cluemart_shared31.EnumInviteStatus.CANCELED
|
|
3922
4042
|
};
|
|
3923
4043
|
});
|
|
3924
4044
|
}
|
|
@@ -3927,15 +4047,15 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
|
|
|
3927
4047
|
var import_dayjs8 = __toESM(require("dayjs"));
|
|
3928
4048
|
|
|
3929
4049
|
// src/service/license/compliance/utils.ts
|
|
3930
|
-
var
|
|
4050
|
+
var import_cluemart_shared36 = require("@timardex/cluemart-shared");
|
|
3931
4051
|
var import_dayjs7 = __toESM(require("dayjs"));
|
|
3932
4052
|
|
|
3933
4053
|
// src/service/license/compliance/event.ts
|
|
3934
|
-
var
|
|
4054
|
+
var import_cluemart_shared32 = require("@timardex/cluemart-shared");
|
|
3935
4055
|
var eventLicences = [
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
4056
|
+
import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
|
|
4057
|
+
import_cluemart_shared32.EnumUserLicence.PRO_EVENT,
|
|
4058
|
+
import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT
|
|
3939
4059
|
];
|
|
3940
4060
|
async function handleEventLicenceCompliance(user, now) {
|
|
3941
4061
|
if (!user.licences || !user.events?.length) {
|
|
@@ -4147,9 +4267,9 @@ function buildLicenceExpiryPipeline(params) {
|
|
|
4147
4267
|
}
|
|
4148
4268
|
|
|
4149
4269
|
// src/service/license/compliance/partner.ts
|
|
4150
|
-
var
|
|
4270
|
+
var import_cluemart_shared33 = require("@timardex/cluemart-shared");
|
|
4151
4271
|
var partnerLicences = [
|
|
4152
|
-
|
|
4272
|
+
import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER
|
|
4153
4273
|
];
|
|
4154
4274
|
async function handlePartnerLicenceCompliance(user, now) {
|
|
4155
4275
|
if (!user.licences || !user.partner) {
|
|
@@ -4159,11 +4279,11 @@ async function handlePartnerLicenceCompliance(user, now) {
|
|
|
4159
4279
|
}
|
|
4160
4280
|
|
|
4161
4281
|
// src/service/license/compliance/vendor.ts
|
|
4162
|
-
var
|
|
4282
|
+
var import_cluemart_shared35 = require("@timardex/cluemart-shared");
|
|
4163
4283
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
4164
4284
|
|
|
4165
4285
|
// src/service/license/models.ts
|
|
4166
|
-
var
|
|
4286
|
+
var import_cluemart_shared34 = require("@timardex/cluemart-shared");
|
|
4167
4287
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
4168
4288
|
var import_graphql = require("graphql");
|
|
4169
4289
|
var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
@@ -4175,31 +4295,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
|
4175
4295
|
return LicenceCategory2;
|
|
4176
4296
|
})(LicenceCategory || {});
|
|
4177
4297
|
var licenceCategoryMapping = {
|
|
4178
|
-
[
|
|
4179
|
-
[
|
|
4180
|
-
[
|
|
4181
|
-
[
|
|
4182
|
-
[
|
|
4183
|
-
[
|
|
4184
|
-
[
|
|
4185
|
-
[
|
|
4186
|
-
[
|
|
4298
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
|
|
4299
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
|
|
4300
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
|
|
4301
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
|
|
4302
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
|
|
4303
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
|
|
4304
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
|
|
4305
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
4306
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
|
|
4187
4307
|
};
|
|
4188
4308
|
var licencePriority = {
|
|
4189
|
-
[
|
|
4190
|
-
[
|
|
4191
|
-
[
|
|
4192
|
-
[
|
|
4193
|
-
[
|
|
4194
|
-
[
|
|
4195
|
-
[
|
|
4196
|
-
[
|
|
4197
|
-
[
|
|
4309
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_EVENT]: 3,
|
|
4310
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_EVENT]: 2,
|
|
4311
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT]: 1,
|
|
4312
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
|
|
4313
|
+
[import_cluemart_shared34.EnumUserLicence.PRO_VENDOR]: 2,
|
|
4314
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR]: 1,
|
|
4315
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER]: 1,
|
|
4316
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_AFFILIATE]: 1,
|
|
4317
|
+
[import_cluemart_shared34.EnumUserLicence.STANDARD_SCHOOL]: 1
|
|
4198
4318
|
};
|
|
4199
4319
|
var standardLicences = [
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4320
|
+
import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR,
|
|
4321
|
+
import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT,
|
|
4322
|
+
import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER
|
|
4203
4323
|
];
|
|
4204
4324
|
var standardLicenceSet = new Set(standardLicences);
|
|
4205
4325
|
function isStandardLicence(licence) {
|
|
@@ -4213,11 +4333,11 @@ var categoryRegexMapping = {
|
|
|
4213
4333
|
["school" /* SCHOOL */]: /_school$/
|
|
4214
4334
|
};
|
|
4215
4335
|
var categoryFallbackLicence = {
|
|
4216
|
-
["event" /* EVENT */]:
|
|
4217
|
-
["partner" /* PARTNER */]:
|
|
4218
|
-
["vendor" /* VENDOR */]:
|
|
4219
|
-
["affiliate" /* AFFILIATE */]:
|
|
4220
|
-
["school" /* SCHOOL */]:
|
|
4336
|
+
["event" /* EVENT */]: import_cluemart_shared34.EnumUserLicence.STANDARD_EVENT,
|
|
4337
|
+
["partner" /* PARTNER */]: import_cluemart_shared34.EnumUserLicence.STANDARD_PARTNER,
|
|
4338
|
+
["vendor" /* VENDOR */]: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR,
|
|
4339
|
+
["affiliate" /* AFFILIATE */]: import_cluemart_shared34.EnumUserLicence.STANDARD_AFFILIATE,
|
|
4340
|
+
["school" /* SCHOOL */]: import_cluemart_shared34.EnumUserLicence.STANDARD_SCHOOL
|
|
4221
4341
|
};
|
|
4222
4342
|
var LicenceFilterInput = {
|
|
4223
4343
|
INPUT_USER_LICENCES: "$licences"
|
|
@@ -4247,11 +4367,11 @@ function getHighestLicenceForCategory(licences, category) {
|
|
|
4247
4367
|
function createLicenceObject(expiryDate, licenceType) {
|
|
4248
4368
|
const today = (0, import_dayjs5.default)();
|
|
4249
4369
|
const expiryDateMapping = {
|
|
4250
|
-
[
|
|
4251
|
-
[
|
|
4252
|
-
[
|
|
4253
|
-
[
|
|
4254
|
-
[
|
|
4370
|
+
[import_cluemart_shared34.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
|
|
4371
|
+
[import_cluemart_shared34.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
|
|
4372
|
+
[import_cluemart_shared34.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
|
|
4373
|
+
[import_cluemart_shared34.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
|
|
4374
|
+
[import_cluemart_shared34.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
|
|
4255
4375
|
};
|
|
4256
4376
|
const licenceObject = {
|
|
4257
4377
|
expiryDate: expiryDateMapping[expiryDate],
|
|
@@ -4355,13 +4475,13 @@ async function checkOwnerHasLicence({
|
|
|
4355
4475
|
const owner = await UserModel.findById(userId);
|
|
4356
4476
|
if (!owner) throw new import_graphql.GraphQLError("Owner not found");
|
|
4357
4477
|
const categoryByResource = {
|
|
4358
|
-
[
|
|
4359
|
-
[
|
|
4360
|
-
[
|
|
4361
|
-
[
|
|
4362
|
-
[
|
|
4478
|
+
[import_cluemart_shared34.EnumResourceType.EVENT]: "event" /* EVENT */,
|
|
4479
|
+
[import_cluemart_shared34.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
|
|
4480
|
+
[import_cluemart_shared34.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
|
|
4481
|
+
[import_cluemart_shared34.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
4482
|
+
[import_cluemart_shared34.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
|
|
4363
4483
|
};
|
|
4364
|
-
if (!(0,
|
|
4484
|
+
if (!(0, import_cluemart_shared34.isNonVisitorResourceType)(resourceType)) {
|
|
4365
4485
|
throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
|
|
4366
4486
|
}
|
|
4367
4487
|
const requiredCategory = categoryByResource[resourceType];
|
|
@@ -4441,7 +4561,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
|
|
|
4441
4561
|
return (result?.matchedCount ?? 0) > 0;
|
|
4442
4562
|
}
|
|
4443
4563
|
async function downgradeVendorProFeatures(userId, licenceType) {
|
|
4444
|
-
const isStandardVendor = licenceType ===
|
|
4564
|
+
const isStandardVendor = licenceType === import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR;
|
|
4445
4565
|
if (!isStandardVendor) {
|
|
4446
4566
|
return;
|
|
4447
4567
|
}
|
|
@@ -4488,7 +4608,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
|
|
|
4488
4608
|
return (result?.matchedCount ?? 0) > 0;
|
|
4489
4609
|
}
|
|
4490
4610
|
async function restoreVendorProFeatures(userId, licenceType) {
|
|
4491
|
-
const isProVendor = licenceType ===
|
|
4611
|
+
const isProVendor = licenceType === import_cluemart_shared35.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR;
|
|
4492
4612
|
if (!isProVendor) {
|
|
4493
4613
|
return;
|
|
4494
4614
|
}
|
|
@@ -4509,14 +4629,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
|
4509
4629
|
return false;
|
|
4510
4630
|
}
|
|
4511
4631
|
const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs6.default)(stripe.paymentGracePeriodEndsAt) : null;
|
|
4512
|
-
const hasActivePaymentGracePeriod = (stripe.status ===
|
|
4632
|
+
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);
|
|
4513
4633
|
if (hasActivePaymentGracePeriod) {
|
|
4514
4634
|
return true;
|
|
4515
4635
|
}
|
|
4516
4636
|
if (!stripe.subscriptionId) {
|
|
4517
4637
|
return false;
|
|
4518
4638
|
}
|
|
4519
|
-
if (stripe.status !==
|
|
4639
|
+
if (stripe.status !== import_cluemart_shared35.EnumSubscriptionStatus.ACTIVE) {
|
|
4520
4640
|
return false;
|
|
4521
4641
|
}
|
|
4522
4642
|
if (!stripe.endDate) {
|
|
@@ -4536,7 +4656,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4536
4656
|
return;
|
|
4537
4657
|
}
|
|
4538
4658
|
const proLicences = vendorLicencesOfUser.filter(
|
|
4539
|
-
(licence) => licence.licenceType !==
|
|
4659
|
+
(licence) => licence.licenceType !== import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
|
|
4540
4660
|
);
|
|
4541
4661
|
const expiredProLicences = proLicences.filter(
|
|
4542
4662
|
(licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now)
|
|
@@ -4549,7 +4669,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4549
4669
|
const expiredProLicence = expiredProLicences.some(
|
|
4550
4670
|
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
4551
4671
|
);
|
|
4552
|
-
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences,
|
|
4672
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared35.vendorLicences, now);
|
|
4553
4673
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
4554
4674
|
(licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
4555
4675
|
);
|
|
@@ -4565,7 +4685,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4565
4685
|
"owner.userId": user._id
|
|
4566
4686
|
}).lean().exec();
|
|
4567
4687
|
}
|
|
4568
|
-
const licencesToSync =
|
|
4688
|
+
const licencesToSync = import_cluemart_shared35.vendorLicences.filter(
|
|
4569
4689
|
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
4570
4690
|
);
|
|
4571
4691
|
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
@@ -4580,11 +4700,11 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4580
4700
|
data: {
|
|
4581
4701
|
resourceId: String(vendor._id),
|
|
4582
4702
|
resourceName: vendor.name,
|
|
4583
|
-
resourceType:
|
|
4703
|
+
resourceType: import_cluemart_shared35.EnumNotificationResourceType.DOWNGRADED_VENDOR
|
|
4584
4704
|
},
|
|
4585
4705
|
message: `Your Vendor licence has been downgraded due to licence expiration.`,
|
|
4586
4706
|
title: `Vendor Licence Downgraded`,
|
|
4587
|
-
type:
|
|
4707
|
+
type: import_cluemart_shared35.EnumNotificationType.SYSTEM,
|
|
4588
4708
|
userIds: [user._id]
|
|
4589
4709
|
};
|
|
4590
4710
|
await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
|
|
@@ -4617,7 +4737,7 @@ async function vendorOwnerHasProLicence(vendorId) {
|
|
|
4617
4737
|
effectiveVendorLicences,
|
|
4618
4738
|
"vendor" /* VENDOR */
|
|
4619
4739
|
);
|
|
4620
|
-
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[
|
|
4740
|
+
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared35.EnumUserLicence.PRO_VENDOR];
|
|
4621
4741
|
}
|
|
4622
4742
|
|
|
4623
4743
|
// src/service/license/compliance/utils.ts
|
|
@@ -4627,12 +4747,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
|
|
|
4627
4747
|
const pipeline = buildLicenceExpiryPipeline({
|
|
4628
4748
|
downgradeBranches: [
|
|
4629
4749
|
{
|
|
4630
|
-
case:
|
|
4631
|
-
then:
|
|
4750
|
+
case: import_cluemart_shared36.EnumUserLicence.PRO_PLUS_VENDOR,
|
|
4751
|
+
then: import_cluemart_shared36.EnumUserLicence.STANDARD_VENDOR
|
|
4632
4752
|
},
|
|
4633
4753
|
{
|
|
4634
|
-
case:
|
|
4635
|
-
then:
|
|
4754
|
+
case: import_cluemart_shared36.EnumUserLicence.PRO_VENDOR,
|
|
4755
|
+
then: import_cluemart_shared36.EnumUserLicence.STANDARD_VENDOR
|
|
4636
4756
|
}
|
|
4637
4757
|
],
|
|
4638
4758
|
licenceTypes,
|
|
@@ -4761,7 +4881,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
|
4761
4881
|
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
4762
4882
|
|
|
4763
4883
|
// src/service/license/reminder/utils.ts
|
|
4764
|
-
var
|
|
4884
|
+
var import_cluemart_shared37 = require("@timardex/cluemart-shared");
|
|
4765
4885
|
var import_utils8 = require("@timardex/cluemart-shared/utils");
|
|
4766
4886
|
var import_dayjs9 = __toESM(require("dayjs"));
|
|
4767
4887
|
|
|
@@ -4827,28 +4947,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
|
4827
4947
|
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
4828
4948
|
}
|
|
4829
4949
|
function getLicenseName(licenceType) {
|
|
4830
|
-
return
|
|
4950
|
+
return import_cluemart_shared37.licenseNiceNames[licenceType] || licenceType;
|
|
4831
4951
|
}
|
|
4832
4952
|
function getNotificationTypes(isVendorLicense, isPartnerLicense) {
|
|
4833
4953
|
if (isVendorLicense) {
|
|
4834
4954
|
return {
|
|
4835
|
-
notificationType:
|
|
4836
|
-
resourceType:
|
|
4955
|
+
notificationType: import_cluemart_shared37.EnumNotificationType.SYSTEM,
|
|
4956
|
+
resourceType: import_cluemart_shared37.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
|
|
4837
4957
|
};
|
|
4838
4958
|
}
|
|
4839
4959
|
if (isPartnerLicense) {
|
|
4840
4960
|
return {
|
|
4841
|
-
notificationType:
|
|
4842
|
-
resourceType:
|
|
4961
|
+
notificationType: import_cluemart_shared37.EnumNotificationType.SYSTEM,
|
|
4962
|
+
resourceType: import_cluemart_shared37.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
|
|
4843
4963
|
};
|
|
4844
4964
|
}
|
|
4845
4965
|
return {
|
|
4846
|
-
notificationType:
|
|
4847
|
-
resourceType:
|
|
4966
|
+
notificationType: import_cluemart_shared37.EnumNotificationType.SYSTEM,
|
|
4967
|
+
resourceType: import_cluemart_shared37.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
|
|
4848
4968
|
};
|
|
4849
4969
|
}
|
|
4850
4970
|
async function getLicenseResourceInfo(user, licence) {
|
|
4851
|
-
const isVendorLicense =
|
|
4971
|
+
const isVendorLicense = import_cluemart_shared37.vendorLicences.includes(licence.licenceType);
|
|
4852
4972
|
const isPartnerLicense = partnerLicences.includes(licence.licenceType);
|
|
4853
4973
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4854
4974
|
const { notificationType, resourceType } = getNotificationTypes(
|
|
@@ -4896,11 +5016,11 @@ async function getLicenseResourceInfo(user, licence) {
|
|
|
4896
5016
|
};
|
|
4897
5017
|
}
|
|
4898
5018
|
function getLicenceExpiryMode(licenceType) {
|
|
4899
|
-
return licenceType ===
|
|
5019
|
+
return licenceType === import_cluemart_shared37.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared37.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
|
|
4900
5020
|
}
|
|
4901
5021
|
async function sendLicenseReminder(user, licence) {
|
|
4902
5022
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4903
|
-
const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(
|
|
5023
|
+
const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared37.dateFormat);
|
|
4904
5024
|
const userId = String(user._id);
|
|
4905
5025
|
const resourceInfo = await getLicenseResourceInfo(user, licence);
|
|
4906
5026
|
if (!resourceInfo) {
|
|
@@ -5027,6 +5147,7 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
5027
5147
|
0 && (module.exports = {
|
|
5028
5148
|
ACTIVE_NOT_DELETED_FILTER,
|
|
5029
5149
|
AD_BILLING_CATALOG_COLLECTION_NAME,
|
|
5150
|
+
AI_IMPORT_RUN_LOCK_KEY,
|
|
5030
5151
|
APP_SETTINGS_ID,
|
|
5031
5152
|
AdBillingCatalogModel,
|
|
5032
5153
|
AdBookingModel,
|
|
@@ -5034,6 +5155,8 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
5034
5155
|
AdModel,
|
|
5035
5156
|
AdPurchaseModel,
|
|
5036
5157
|
AffiliateModel,
|
|
5158
|
+
AiImportRunLockModel,
|
|
5159
|
+
AiImportRunModel,
|
|
5037
5160
|
AiImportedMarketModel,
|
|
5038
5161
|
AppSettingModel,
|
|
5039
5162
|
AuthHandoffTokenModel,
|
|
@@ -5064,9 +5187,10 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
5064
5187
|
RelationTypeSchema,
|
|
5065
5188
|
ResourceActivityModel,
|
|
5066
5189
|
ResourceImageTypeSchema,
|
|
5190
|
+
SCRAPE_SITES_CONFIG_ID,
|
|
5067
5191
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
5068
5192
|
SchoolModel,
|
|
5069
|
-
|
|
5193
|
+
ScrapeSiteConfigModel,
|
|
5070
5194
|
SocialMediaTypeSchema,
|
|
5071
5195
|
StallTypeSchema,
|
|
5072
5196
|
UnregisteredVendorModel,
|