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