@timardex/cluemart-server-shared 3.0.2 → 4.0.0
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-7JWQ7WKJ.mjs → chunk-MVQMMXGY.mjs} +353 -237
- package/dist/chunk-MVQMMXGY.mjs.map +1 -0
- package/dist/index.cjs +547 -427
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +34 -7
- package/dist/index.d.ts +34 -7
- package/dist/index.mjs +369 -248
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +407 -292
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +28 -2
- package/dist/mongoose/index.d.ts +28 -2
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +542 -426
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +6 -5
- package/dist/service/index.d.ts +6 -5
- package/dist/service/index.mjs +12 -6
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-7JWQ7WKJ.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ __export(index_exports, {
|
|
|
39
39
|
AdModel: () => AdModel,
|
|
40
40
|
AdPurchaseModel: () => AdPurchaseModel,
|
|
41
41
|
AffiliateModel: () => AffiliateModel,
|
|
42
|
+
AiImportedMarketModel: () => AiImportedMarketModel,
|
|
42
43
|
AppSettingModel: () => AppSettingModel,
|
|
43
44
|
AuthHandoffTokenModel: () => AuthHandoffTokenModel,
|
|
44
45
|
BILLING_CATALOG_COLLECTION_NAME: () => BILLING_CATALOG_COLLECTION_NAME,
|
|
@@ -70,6 +71,7 @@ __export(index_exports, {
|
|
|
70
71
|
ResourceImageTypeSchema: () => ResourceImageTypeSchema,
|
|
71
72
|
SUBSCRIPTION_REWARD_TIMEZONE: () => SUBSCRIPTION_REWARD_TIMEZONE,
|
|
72
73
|
SchoolModel: () => SchoolModel,
|
|
74
|
+
ScrapeSiteModel: () => ScrapeSiteModel,
|
|
73
75
|
SocialMediaTypeSchema: () => SocialMediaTypeSchema,
|
|
74
76
|
StallTypeSchema: () => StallTypeSchema,
|
|
75
77
|
UnregisteredVendorModel: () => UnregisteredVendorModel,
|
|
@@ -124,7 +126,7 @@ __export(index_exports, {
|
|
|
124
126
|
locationGeoSchema: () => locationGeoSchema,
|
|
125
127
|
locationsSchema: () => locationsSchema,
|
|
126
128
|
mapVendorLicenceToSubscriptionRewardType: () => mapVendorLicenceToSubscriptionRewardType,
|
|
127
|
-
mongoose: () =>
|
|
129
|
+
mongoose: () => import_mongoose41.default,
|
|
128
130
|
normalizeAffiliatePromoCodes: () => normalizeAffiliatePromoCodes,
|
|
129
131
|
normalizePromoCode: () => normalizePromoCode,
|
|
130
132
|
notifyUsers: () => notifyUsers,
|
|
@@ -153,7 +155,7 @@ __export(index_exports, {
|
|
|
153
155
|
updateAdStatuses: () => updateAdStatuses,
|
|
154
156
|
updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
|
|
155
157
|
updateRelationDatesToCanceled: () => updateRelationDatesToCanceled,
|
|
156
|
-
updateSingleDateTimeStatus: () =>
|
|
158
|
+
updateSingleDateTimeStatus: () => import_cluemart_shared37.updateSingleDateTimeStatus,
|
|
157
159
|
upgradeUserToLicence: () => upgradeUserToLicence,
|
|
158
160
|
userLicenseSchema: () => userLicenseSchema,
|
|
159
161
|
vendorOwnerHasProLicence: () => vendorOwnerHasProLicence,
|
|
@@ -1082,15 +1084,15 @@ function syncSearchNameInUpdate(update) {
|
|
|
1082
1084
|
}
|
|
1083
1085
|
return null;
|
|
1084
1086
|
}
|
|
1085
|
-
function searchNamePlugin(
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1087
|
+
function searchNamePlugin(schema28) {
|
|
1088
|
+
schema28.add({ searchName: { default: "", required: false, type: String } });
|
|
1089
|
+
schema28.index({ searchName: 1 });
|
|
1090
|
+
schema28.pre("save", function syncSearchNameOnSave(next) {
|
|
1089
1091
|
const doc = this;
|
|
1090
1092
|
doc.searchName = deriveSearchName(doc.name);
|
|
1091
1093
|
next();
|
|
1092
1094
|
});
|
|
1093
|
-
|
|
1095
|
+
schema28.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
|
|
1094
1096
|
const list = Array.isArray(docs) ? docs : [docs];
|
|
1095
1097
|
for (const doc of list) {
|
|
1096
1098
|
if (doc && typeof doc.name === "string") {
|
|
@@ -1099,7 +1101,7 @@ function searchNamePlugin(schema26) {
|
|
|
1099
1101
|
}
|
|
1100
1102
|
next();
|
|
1101
1103
|
});
|
|
1102
|
-
|
|
1104
|
+
schema28.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
|
|
1103
1105
|
for (const op of ops) {
|
|
1104
1106
|
const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
|
|
1105
1107
|
if (doc && typeof doc.name === "string") {
|
|
@@ -1125,7 +1127,7 @@ function searchNamePlugin(schema26) {
|
|
|
1125
1127
|
}
|
|
1126
1128
|
next();
|
|
1127
1129
|
};
|
|
1128
|
-
|
|
1130
|
+
schema28.pre(
|
|
1129
1131
|
["findOneAndUpdate", "updateOne", "updateMany"],
|
|
1130
1132
|
syncSearchNameOnUpdate
|
|
1131
1133
|
);
|
|
@@ -1209,23 +1211,134 @@ schema7.index({ description: "text", name: "text" });
|
|
|
1209
1211
|
schema7.plugin(searchNamePlugin);
|
|
1210
1212
|
var GoogleImportedMarketModel = import_mongoose10.default.models.GoogleImportedMarket || import_mongoose10.default.model("GoogleImportedMarket", schema7);
|
|
1211
1213
|
|
|
1212
|
-
// src/mongoose/
|
|
1214
|
+
// src/mongoose/AiImportedMarket.ts
|
|
1213
1215
|
var import_cluemart_shared10 = require("@timardex/cluemart-shared");
|
|
1214
1216
|
var import_mongoose11 = __toESM(require("mongoose"));
|
|
1215
1217
|
var MongooseSchema7 = import_mongoose11.default.Schema;
|
|
1216
|
-
var
|
|
1218
|
+
var addressComponentSchema2 = new MongooseSchema7(
|
|
1219
|
+
{
|
|
1220
|
+
longName: { required: false, type: String },
|
|
1221
|
+
shortName: { required: false, type: String },
|
|
1222
|
+
types: { required: false, type: [String] }
|
|
1223
|
+
},
|
|
1224
|
+
{ _id: false }
|
|
1225
|
+
);
|
|
1226
|
+
var schema8 = new MongooseSchema7(
|
|
1227
|
+
{
|
|
1228
|
+
active: { default: false, required: true, type: Boolean },
|
|
1229
|
+
address: { required: true, type: String },
|
|
1230
|
+
addressComponents: { required: false, type: [addressComponentSchema2] },
|
|
1231
|
+
approvedAt: { default: null, required: false, type: Date },
|
|
1232
|
+
claimed: { default: false, required: true, type: Boolean },
|
|
1233
|
+
claimedAt: { default: null, required: false, type: Date },
|
|
1234
|
+
claimedByUserId: {
|
|
1235
|
+
ref: "User",
|
|
1236
|
+
required: false,
|
|
1237
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
1238
|
+
},
|
|
1239
|
+
cover: {
|
|
1240
|
+
required: false,
|
|
1241
|
+
type: ResourceImageTypeSchema
|
|
1242
|
+
},
|
|
1243
|
+
dateTime: [dateTimeSchema],
|
|
1244
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
1245
|
+
description: { required: true, type: String },
|
|
1246
|
+
eventId: {
|
|
1247
|
+
ref: "Event",
|
|
1248
|
+
required: false,
|
|
1249
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
1250
|
+
},
|
|
1251
|
+
eventType: {
|
|
1252
|
+
enum: Object.values(import_cluemart_shared10.EnumEventType),
|
|
1253
|
+
required: true,
|
|
1254
|
+
type: String
|
|
1255
|
+
},
|
|
1256
|
+
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
1257
|
+
location: {
|
|
1258
|
+
required: true,
|
|
1259
|
+
type: locationsSchema
|
|
1260
|
+
},
|
|
1261
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
1262
|
+
name: { required: true, type: String },
|
|
1263
|
+
openingHours: { required: false, type: [String] },
|
|
1264
|
+
rainOrShine: { required: true, type: Boolean },
|
|
1265
|
+
rating: { required: false, type: Number },
|
|
1266
|
+
region: { required: false, type: String },
|
|
1267
|
+
rejectReason: { required: false, type: String },
|
|
1268
|
+
reviewCount: { required: false, type: Number },
|
|
1269
|
+
reviewedAt: { default: null, required: false, type: Date },
|
|
1270
|
+
reviewedByUserId: {
|
|
1271
|
+
ref: "User",
|
|
1272
|
+
required: false,
|
|
1273
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
1274
|
+
},
|
|
1275
|
+
reviewStatus: {
|
|
1276
|
+
default: import_cluemart_shared10.EnumImportedMarketReviewStatus.PENDING,
|
|
1277
|
+
enum: Object.values(import_cluemart_shared10.EnumImportedMarketReviewStatus),
|
|
1278
|
+
required: true,
|
|
1279
|
+
type: String
|
|
1280
|
+
},
|
|
1281
|
+
scrapedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
|
|
1282
|
+
slug: { required: true, type: String },
|
|
1283
|
+
sourceKey: {
|
|
1284
|
+
required: true,
|
|
1285
|
+
type: String,
|
|
1286
|
+
unique: true
|
|
1287
|
+
// unique, indexed
|
|
1288
|
+
},
|
|
1289
|
+
sourceName: { required: true, type: String },
|
|
1290
|
+
sourceUrl: { required: true, type: String },
|
|
1291
|
+
website: { required: false, type: String }
|
|
1292
|
+
},
|
|
1293
|
+
{ timestamps: true }
|
|
1294
|
+
);
|
|
1295
|
+
schema8.index({ "location.geo": "2dsphere" });
|
|
1296
|
+
schema8.index({ name: 1 });
|
|
1297
|
+
schema8.index({ region: 1 });
|
|
1298
|
+
schema8.index({ deletedAt: 1 });
|
|
1299
|
+
schema8.index({ "dateTime.dateStatus": 1 });
|
|
1300
|
+
schema8.index({ slug: 1 });
|
|
1301
|
+
schema8.index({ reviewStatus: 1 });
|
|
1302
|
+
schema8.index({ description: "text", name: "text" });
|
|
1303
|
+
schema8.plugin(searchNamePlugin);
|
|
1304
|
+
var AiImportedMarketModel = import_mongoose11.default.models.AiImportedMarket || import_mongoose11.default.model("AiImportedMarket", schema8);
|
|
1305
|
+
|
|
1306
|
+
// src/mongoose/ScrapeSite.ts
|
|
1307
|
+
var import_mongoose12 = __toESM(require("mongoose"));
|
|
1308
|
+
var MongooseSchema8 = import_mongoose12.default.Schema;
|
|
1309
|
+
var schema9 = new MongooseSchema8(
|
|
1310
|
+
{
|
|
1311
|
+
enabled: { default: true, required: true, type: Boolean },
|
|
1312
|
+
lastError: { required: false, type: String },
|
|
1313
|
+
lastScrapedAt: { required: false, type: Date },
|
|
1314
|
+
lastScrapeStatus: { required: false, type: String },
|
|
1315
|
+
name: { required: true, type: String },
|
|
1316
|
+
regionHint: { required: false, type: String },
|
|
1317
|
+
url: { required: true, type: String }
|
|
1318
|
+
},
|
|
1319
|
+
{ timestamps: true }
|
|
1320
|
+
);
|
|
1321
|
+
schema9.index({ url: 1 }, { unique: true });
|
|
1322
|
+
schema9.index({ enabled: 1 });
|
|
1323
|
+
var ScrapeSiteModel = import_mongoose12.default.models.ScrapeSite || import_mongoose12.default.model("ScrapeSite", schema9);
|
|
1324
|
+
|
|
1325
|
+
// src/mongoose/Notification.ts
|
|
1326
|
+
var import_cluemart_shared11 = require("@timardex/cluemart-shared");
|
|
1327
|
+
var import_mongoose13 = __toESM(require("mongoose"));
|
|
1328
|
+
var MongooseSchema9 = import_mongoose13.default.Schema;
|
|
1329
|
+
var notificationDataSchema = new MongooseSchema9(
|
|
1217
1330
|
{
|
|
1218
1331
|
resourceId: { required: true, type: String },
|
|
1219
1332
|
resourceName: { required: true, type: String },
|
|
1220
1333
|
resourceType: {
|
|
1221
|
-
enum: Object.values(
|
|
1334
|
+
enum: Object.values(import_cluemart_shared11.EnumNotificationResourceType),
|
|
1222
1335
|
required: true,
|
|
1223
1336
|
type: String
|
|
1224
1337
|
}
|
|
1225
1338
|
},
|
|
1226
1339
|
{ _id: false }
|
|
1227
1340
|
);
|
|
1228
|
-
var
|
|
1341
|
+
var schema10 = new MongooseSchema9(
|
|
1229
1342
|
{
|
|
1230
1343
|
data: {
|
|
1231
1344
|
default: null,
|
|
@@ -1236,28 +1349,28 @@ var schema8 = new MongooseSchema7(
|
|
|
1236
1349
|
message: { required: true, type: String },
|
|
1237
1350
|
title: { required: true, type: String },
|
|
1238
1351
|
type: {
|
|
1239
|
-
default:
|
|
1240
|
-
enum: Object.values(
|
|
1352
|
+
default: import_cluemart_shared11.EnumNotificationType.SYSTEM,
|
|
1353
|
+
enum: Object.values(import_cluemart_shared11.EnumNotificationType),
|
|
1241
1354
|
required: true,
|
|
1242
1355
|
type: String
|
|
1243
1356
|
},
|
|
1244
1357
|
userId: {
|
|
1245
1358
|
ref: "User",
|
|
1246
1359
|
required: true,
|
|
1247
|
-
type:
|
|
1360
|
+
type: import_mongoose13.default.Schema.Types.ObjectId
|
|
1248
1361
|
}
|
|
1249
1362
|
},
|
|
1250
1363
|
{ timestamps: true }
|
|
1251
1364
|
);
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
var NotificationModel =
|
|
1365
|
+
schema10.index({ isRead: 1, userId: 1 });
|
|
1366
|
+
schema10.index({ createdAt: -1, userId: 1 });
|
|
1367
|
+
var NotificationModel = import_mongoose13.default.models.Notification || import_mongoose13.default.model("Notification", schema10);
|
|
1255
1368
|
|
|
1256
1369
|
// src/mongoose/PushToken.ts
|
|
1257
1370
|
var import_enums = require("@timardex/cluemart-shared/enums");
|
|
1258
|
-
var
|
|
1259
|
-
var
|
|
1260
|
-
var
|
|
1371
|
+
var import_mongoose14 = __toESM(require("mongoose"));
|
|
1372
|
+
var MongooseSchema10 = import_mongoose14.default.Schema;
|
|
1373
|
+
var schema11 = new MongooseSchema10(
|
|
1261
1374
|
{
|
|
1262
1375
|
platform: {
|
|
1263
1376
|
enum: Object.values(import_enums.EnumOSPlatform),
|
|
@@ -1268,22 +1381,22 @@ var schema9 = new MongooseSchema8(
|
|
|
1268
1381
|
userId: {
|
|
1269
1382
|
ref: "User",
|
|
1270
1383
|
required: true,
|
|
1271
|
-
type:
|
|
1384
|
+
type: import_mongoose14.default.Schema.Types.ObjectId
|
|
1272
1385
|
}
|
|
1273
1386
|
},
|
|
1274
1387
|
{ timestamps: true }
|
|
1275
1388
|
);
|
|
1276
|
-
var PushTokenModel =
|
|
1389
|
+
var PushTokenModel = import_mongoose14.default.models.PushToken || import_mongoose14.default.model("PushToken", schema11);
|
|
1277
1390
|
|
|
1278
1391
|
// src/mongoose/Relation.ts
|
|
1279
|
-
var
|
|
1280
|
-
var
|
|
1392
|
+
var import_cluemart_shared13 = require("@timardex/cluemart-shared");
|
|
1393
|
+
var import_mongoose16 = __toESM(require("mongoose"));
|
|
1281
1394
|
|
|
1282
1395
|
// src/mongoose/event/EventInfo.ts
|
|
1283
|
-
var
|
|
1284
|
-
var
|
|
1285
|
-
var
|
|
1286
|
-
var StallTypeSchema = new
|
|
1396
|
+
var import_cluemart_shared12 = require("@timardex/cluemart-shared");
|
|
1397
|
+
var import_mongoose15 = __toESM(require("mongoose"));
|
|
1398
|
+
var MongooseSchema11 = import_mongoose15.default.Schema;
|
|
1399
|
+
var StallTypeSchema = new MongooseSchema11(
|
|
1287
1400
|
{
|
|
1288
1401
|
label: { required: false, type: String },
|
|
1289
1402
|
price: { required: false, type: Number },
|
|
@@ -1294,10 +1407,10 @@ var StallTypeSchema = new MongooseSchema9(
|
|
|
1294
1407
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1295
1408
|
}
|
|
1296
1409
|
);
|
|
1297
|
-
var dateTimeSchema2 = new
|
|
1410
|
+
var dateTimeSchema2 = new MongooseSchema11(
|
|
1298
1411
|
{
|
|
1299
1412
|
dateStatus: {
|
|
1300
|
-
enum: Object.values(
|
|
1413
|
+
enum: Object.values(import_cluemart_shared12.EnumEventDateStatus),
|
|
1301
1414
|
required: false,
|
|
1302
1415
|
type: String
|
|
1303
1416
|
},
|
|
@@ -1310,13 +1423,13 @@ var dateTimeSchema2 = new MongooseSchema9(
|
|
|
1310
1423
|
{ _id: false }
|
|
1311
1424
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
1312
1425
|
);
|
|
1313
|
-
var paymentInfoSchema = new
|
|
1426
|
+
var paymentInfoSchema = new MongooseSchema11(
|
|
1314
1427
|
{
|
|
1315
1428
|
accountHolderName: { required: false, type: String },
|
|
1316
1429
|
accountNumber: { required: false, type: String },
|
|
1317
1430
|
link: { required: false, type: String },
|
|
1318
1431
|
paymentMethod: {
|
|
1319
|
-
enum: Object.values(
|
|
1432
|
+
enum: Object.values(import_cluemart_shared12.EnumPaymentMethod),
|
|
1320
1433
|
required: true,
|
|
1321
1434
|
type: String
|
|
1322
1435
|
}
|
|
@@ -1324,7 +1437,7 @@ var paymentInfoSchema = new MongooseSchema9(
|
|
|
1324
1437
|
{ _id: false }
|
|
1325
1438
|
// Prevents Mongoose from creating an additional _id field
|
|
1326
1439
|
);
|
|
1327
|
-
var requirementsSchema = new
|
|
1440
|
+
var requirementsSchema = new MongooseSchema11(
|
|
1328
1441
|
{
|
|
1329
1442
|
category: { required: true, type: String },
|
|
1330
1443
|
label: { required: true, type: String },
|
|
@@ -1335,7 +1448,7 @@ var requirementsSchema = new MongooseSchema9(
|
|
|
1335
1448
|
// Prevents Mongoose from creating an additional _id field for
|
|
1336
1449
|
}
|
|
1337
1450
|
);
|
|
1338
|
-
var refundPolicySchema = new
|
|
1451
|
+
var refundPolicySchema = new MongooseSchema11(
|
|
1339
1452
|
{
|
|
1340
1453
|
category: { required: true, type: String },
|
|
1341
1454
|
label: { required: true, type: String },
|
|
@@ -1343,7 +1456,7 @@ var refundPolicySchema = new MongooseSchema9(
|
|
|
1343
1456
|
},
|
|
1344
1457
|
{ _id: false }
|
|
1345
1458
|
);
|
|
1346
|
-
var
|
|
1459
|
+
var schema12 = new MongooseSchema11(
|
|
1347
1460
|
{
|
|
1348
1461
|
active: { default: true, type: Boolean },
|
|
1349
1462
|
applicationDeadlineHours: { required: true, type: Number },
|
|
@@ -1351,7 +1464,7 @@ var schema10 = new MongooseSchema9(
|
|
|
1351
1464
|
eventId: {
|
|
1352
1465
|
ref: "Event",
|
|
1353
1466
|
required: true,
|
|
1354
|
-
type:
|
|
1467
|
+
type: import_mongoose15.default.Schema.Types.ObjectId
|
|
1355
1468
|
},
|
|
1356
1469
|
packInTime: { required: true, type: Number },
|
|
1357
1470
|
paymentDueHours: { required: true, type: Number },
|
|
@@ -1361,15 +1474,15 @@ var schema10 = new MongooseSchema9(
|
|
|
1361
1474
|
},
|
|
1362
1475
|
{ timestamps: true }
|
|
1363
1476
|
);
|
|
1364
|
-
|
|
1365
|
-
var EventInfoModel =
|
|
1477
|
+
schema12.index({ eventId: 1 });
|
|
1478
|
+
var EventInfoModel = import_mongoose15.default.models.EventInfo || import_mongoose15.default.model("EventInfo", schema12);
|
|
1366
1479
|
|
|
1367
1480
|
// src/mongoose/Relation.ts
|
|
1368
|
-
var
|
|
1369
|
-
var relationDateTimeSchema = new
|
|
1481
|
+
var MongooseSchema12 = import_mongoose16.default.Schema;
|
|
1482
|
+
var relationDateTimeSchema = new MongooseSchema12(
|
|
1370
1483
|
{
|
|
1371
1484
|
dateStatus: {
|
|
1372
|
-
enum: Object.values(
|
|
1485
|
+
enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
|
|
1373
1486
|
required: true,
|
|
1374
1487
|
type: String
|
|
1375
1488
|
},
|
|
@@ -1381,7 +1494,7 @@ var relationDateTimeSchema = new MongooseSchema10(
|
|
|
1381
1494
|
},
|
|
1382
1495
|
{ _id: false }
|
|
1383
1496
|
);
|
|
1384
|
-
var relationDatesSchema = new
|
|
1497
|
+
var relationDatesSchema = new MongooseSchema12(
|
|
1385
1498
|
{
|
|
1386
1499
|
dateTime: {
|
|
1387
1500
|
required: true,
|
|
@@ -1393,42 +1506,42 @@ var relationDatesSchema = new MongooseSchema10(
|
|
|
1393
1506
|
},
|
|
1394
1507
|
paymentReference: { required: false, type: String },
|
|
1395
1508
|
status: {
|
|
1396
|
-
enum: Object.values(
|
|
1509
|
+
enum: Object.values(import_cluemart_shared13.EnumInviteStatus),
|
|
1397
1510
|
required: false,
|
|
1398
1511
|
type: String
|
|
1399
1512
|
}
|
|
1400
1513
|
},
|
|
1401
1514
|
{ _id: false }
|
|
1402
1515
|
);
|
|
1403
|
-
var RelationTypeSchema = new
|
|
1516
|
+
var RelationTypeSchema = new MongooseSchema12(
|
|
1404
1517
|
{
|
|
1405
1518
|
active: { default: true, required: true, type: Boolean },
|
|
1406
1519
|
chatId: {
|
|
1407
1520
|
ref: "Chat",
|
|
1408
1521
|
required: true,
|
|
1409
|
-
type:
|
|
1522
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
1410
1523
|
},
|
|
1411
1524
|
deletedAt: { default: null, required: false, type: Date },
|
|
1412
1525
|
eventId: {
|
|
1413
1526
|
ref: "Event",
|
|
1414
1527
|
required: true,
|
|
1415
|
-
type:
|
|
1528
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
1416
1529
|
},
|
|
1417
1530
|
lastUpdateBy: {
|
|
1418
|
-
enum: Object.values(
|
|
1531
|
+
enum: Object.values(import_cluemart_shared13.EnumResourceType),
|
|
1419
1532
|
required: true,
|
|
1420
1533
|
type: String
|
|
1421
1534
|
},
|
|
1422
1535
|
relationDates: [relationDatesSchema],
|
|
1423
1536
|
relationType: {
|
|
1424
|
-
enum: Object.values(
|
|
1537
|
+
enum: Object.values(import_cluemart_shared13.EnumRelationResource),
|
|
1425
1538
|
required: true,
|
|
1426
1539
|
type: String
|
|
1427
1540
|
},
|
|
1428
1541
|
vendorId: {
|
|
1429
1542
|
ref: "Vendor",
|
|
1430
1543
|
required: true,
|
|
1431
|
-
type:
|
|
1544
|
+
type: import_mongoose16.default.Schema.Types.ObjectId
|
|
1432
1545
|
}
|
|
1433
1546
|
},
|
|
1434
1547
|
{ timestamps: true }
|
|
@@ -1440,21 +1553,21 @@ RelationTypeSchema.index({
|
|
|
1440
1553
|
"relationDates.status": 1,
|
|
1441
1554
|
vendorId: 1
|
|
1442
1555
|
});
|
|
1443
|
-
var RelationModel =
|
|
1556
|
+
var RelationModel = import_mongoose16.default.models.Relation || import_mongoose16.default.model("Relation", RelationTypeSchema);
|
|
1444
1557
|
|
|
1445
1558
|
// src/mongoose/ResourceActivity.ts
|
|
1446
|
-
var
|
|
1447
|
-
var
|
|
1448
|
-
var
|
|
1449
|
-
var ActivitySchema = new
|
|
1559
|
+
var import_cluemart_shared14 = require("@timardex/cluemart-shared");
|
|
1560
|
+
var import_mongoose17 = __toESM(require("mongoose"));
|
|
1561
|
+
var MongooseSchema13 = import_mongoose17.default.Schema;
|
|
1562
|
+
var ActivitySchema = new MongooseSchema13(
|
|
1450
1563
|
{
|
|
1451
1564
|
activityType: {
|
|
1452
|
-
enum: Object.values(
|
|
1565
|
+
enum: Object.values(import_cluemart_shared14.EnumActivity),
|
|
1453
1566
|
required: true,
|
|
1454
1567
|
type: String
|
|
1455
1568
|
},
|
|
1456
1569
|
dateStatus: {
|
|
1457
|
-
enum: Object.values(
|
|
1570
|
+
enum: Object.values(import_cluemart_shared14.EnumEventDateStatus),
|
|
1458
1571
|
required: false,
|
|
1459
1572
|
type: String
|
|
1460
1573
|
},
|
|
@@ -1466,7 +1579,7 @@ var ActivitySchema = new MongooseSchema11(
|
|
|
1466
1579
|
startTime: { required: false, type: String },
|
|
1467
1580
|
timestamp: { default: Date.now, type: Date },
|
|
1468
1581
|
userAgent: {
|
|
1469
|
-
enum: Object.values(
|
|
1582
|
+
enum: Object.values(import_cluemart_shared14.EnumOSPlatform),
|
|
1470
1583
|
required: true,
|
|
1471
1584
|
type: String
|
|
1472
1585
|
},
|
|
@@ -1474,61 +1587,61 @@ var ActivitySchema = new MongooseSchema11(
|
|
|
1474
1587
|
},
|
|
1475
1588
|
{ _id: false }
|
|
1476
1589
|
);
|
|
1477
|
-
var
|
|
1590
|
+
var schema13 = new MongooseSchema13(
|
|
1478
1591
|
{
|
|
1479
1592
|
activity: { default: [], type: [ActivitySchema] },
|
|
1480
1593
|
resourceId: { required: true, type: String },
|
|
1481
1594
|
resourceType: {
|
|
1482
|
-
enum: Object.values(
|
|
1595
|
+
enum: Object.values(import_cluemart_shared14.EnumResourceType),
|
|
1483
1596
|
required: true,
|
|
1484
1597
|
type: String
|
|
1485
1598
|
}
|
|
1486
1599
|
},
|
|
1487
1600
|
{ timestamps: true }
|
|
1488
1601
|
);
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
var ResourceActivityModel =
|
|
1602
|
+
schema13.index({ resourceId: 1, resourceType: 1 }, { unique: true });
|
|
1603
|
+
schema13.index({ "views.location": "2dsphere" });
|
|
1604
|
+
var ResourceActivityModel = import_mongoose17.default.models.ResourceActivity || import_mongoose17.default.model("ResourceActivity", schema13);
|
|
1492
1605
|
|
|
1493
1606
|
// src/mongoose/User.ts
|
|
1494
|
-
var
|
|
1495
|
-
var
|
|
1496
|
-
var
|
|
1497
|
-
var userActivityEventSchema = new
|
|
1607
|
+
var import_cluemart_shared15 = require("@timardex/cluemart-shared");
|
|
1608
|
+
var import_mongoose18 = __toESM(require("mongoose"));
|
|
1609
|
+
var MongooseSchema14 = import_mongoose18.default.Schema;
|
|
1610
|
+
var userActivityEventSchema = new MongooseSchema14(
|
|
1498
1611
|
{
|
|
1499
1612
|
dateTime: dateTimeSchema,
|
|
1500
1613
|
resourceId: {
|
|
1501
1614
|
ref: "Event",
|
|
1502
1615
|
required: false,
|
|
1503
|
-
type:
|
|
1616
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1504
1617
|
}
|
|
1505
1618
|
},
|
|
1506
1619
|
{ _id: false }
|
|
1507
1620
|
);
|
|
1508
|
-
var userActivityFavouritesSchema = new
|
|
1621
|
+
var userActivityFavouritesSchema = new MongooseSchema14(
|
|
1509
1622
|
{
|
|
1510
1623
|
events: {
|
|
1511
1624
|
ref: "Event",
|
|
1512
1625
|
required: false,
|
|
1513
|
-
type: [
|
|
1626
|
+
type: [import_mongoose18.default.Schema.Types.ObjectId]
|
|
1514
1627
|
},
|
|
1515
1628
|
partners: {
|
|
1516
1629
|
ref: "Partner",
|
|
1517
1630
|
required: false,
|
|
1518
|
-
type: [
|
|
1631
|
+
type: [import_mongoose18.default.Schema.Types.ObjectId]
|
|
1519
1632
|
},
|
|
1520
1633
|
vendors: {
|
|
1521
1634
|
ref: "Vendor",
|
|
1522
1635
|
required: false,
|
|
1523
|
-
type: [
|
|
1636
|
+
type: [import_mongoose18.default.Schema.Types.ObjectId]
|
|
1524
1637
|
}
|
|
1525
1638
|
},
|
|
1526
1639
|
{ _id: false }
|
|
1527
1640
|
);
|
|
1528
|
-
var stripeSchema = new
|
|
1641
|
+
var stripeSchema = new MongooseSchema14(
|
|
1529
1642
|
{
|
|
1530
1643
|
billingPeriod: {
|
|
1531
|
-
enum: Object.values(
|
|
1644
|
+
enum: Object.values(import_cluemart_shared15.EnumBillingPeriod),
|
|
1532
1645
|
required: false,
|
|
1533
1646
|
type: String
|
|
1534
1647
|
},
|
|
@@ -1537,7 +1650,7 @@ var stripeSchema = new MongooseSchema12(
|
|
|
1537
1650
|
type: Boolean
|
|
1538
1651
|
},
|
|
1539
1652
|
currentPlan: {
|
|
1540
|
-
enum: Object.values(
|
|
1653
|
+
enum: Object.values(import_cluemart_shared15.EnumUserLicence),
|
|
1541
1654
|
required: false,
|
|
1542
1655
|
type: String
|
|
1543
1656
|
},
|
|
@@ -1562,7 +1675,7 @@ var stripeSchema = new MongooseSchema12(
|
|
|
1562
1675
|
type: String
|
|
1563
1676
|
},
|
|
1564
1677
|
pendingBillingPeriod: {
|
|
1565
|
-
enum: Object.values(
|
|
1678
|
+
enum: Object.values(import_cluemart_shared15.EnumBillingPeriod),
|
|
1566
1679
|
required: false,
|
|
1567
1680
|
type: String
|
|
1568
1681
|
},
|
|
@@ -1571,7 +1684,7 @@ var stripeSchema = new MongooseSchema12(
|
|
|
1571
1684
|
type: Date
|
|
1572
1685
|
},
|
|
1573
1686
|
pendingPlan: {
|
|
1574
|
-
enum: Object.values(
|
|
1687
|
+
enum: Object.values(import_cluemart_shared15.EnumUserLicence),
|
|
1575
1688
|
required: false,
|
|
1576
1689
|
type: String
|
|
1577
1690
|
},
|
|
@@ -1588,7 +1701,7 @@ var stripeSchema = new MongooseSchema12(
|
|
|
1588
1701
|
type: Date
|
|
1589
1702
|
},
|
|
1590
1703
|
status: {
|
|
1591
|
-
enum: Object.values(
|
|
1704
|
+
enum: Object.values(import_cluemart_shared15.EnumSubscriptionStatus),
|
|
1592
1705
|
required: false,
|
|
1593
1706
|
type: String
|
|
1594
1707
|
},
|
|
@@ -1607,10 +1720,10 @@ var stripeSchema = new MongooseSchema12(
|
|
|
1607
1720
|
},
|
|
1608
1721
|
{ _id: false }
|
|
1609
1722
|
);
|
|
1610
|
-
var redeemedRewardSchema = new
|
|
1723
|
+
var redeemedRewardSchema = new MongooseSchema14(
|
|
1611
1724
|
{
|
|
1612
1725
|
name: {
|
|
1613
|
-
enum: Object.values(
|
|
1726
|
+
enum: Object.values(import_cluemart_shared15.EnumReward),
|
|
1614
1727
|
required: true,
|
|
1615
1728
|
type: String
|
|
1616
1729
|
},
|
|
@@ -1619,12 +1732,12 @@ var redeemedRewardSchema = new MongooseSchema12(
|
|
|
1619
1732
|
},
|
|
1620
1733
|
{ _id: false }
|
|
1621
1734
|
);
|
|
1622
|
-
var userOverallPointsSchema = new
|
|
1735
|
+
var userOverallPointsSchema = new MongooseSchema14(
|
|
1623
1736
|
{
|
|
1624
1737
|
createdAt: { required: true, type: Date },
|
|
1625
1738
|
points: { default: 0, required: true, type: Number },
|
|
1626
1739
|
pointType: {
|
|
1627
|
-
enum: Object.values(
|
|
1740
|
+
enum: Object.values(import_cluemart_shared15.EnumPointType),
|
|
1628
1741
|
required: true,
|
|
1629
1742
|
type: String
|
|
1630
1743
|
},
|
|
@@ -1632,13 +1745,13 @@ var userOverallPointsSchema = new MongooseSchema12(
|
|
|
1632
1745
|
},
|
|
1633
1746
|
{ _id: false }
|
|
1634
1747
|
);
|
|
1635
|
-
var
|
|
1748
|
+
var schema14 = new MongooseSchema14(
|
|
1636
1749
|
{
|
|
1637
1750
|
active: { default: false, required: true, type: Boolean },
|
|
1638
1751
|
affiliate: {
|
|
1639
1752
|
ref: "Affiliate",
|
|
1640
1753
|
required: false,
|
|
1641
|
-
type:
|
|
1754
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1642
1755
|
},
|
|
1643
1756
|
avatar: {
|
|
1644
1757
|
required: false,
|
|
@@ -1647,28 +1760,28 @@ var schema12 = new MongooseSchema12(
|
|
|
1647
1760
|
coupon: {
|
|
1648
1761
|
ref: "Coupon",
|
|
1649
1762
|
required: false,
|
|
1650
|
-
type:
|
|
1763
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1651
1764
|
},
|
|
1652
1765
|
deletedAt: { default: null, required: false, type: Date },
|
|
1653
1766
|
email: { required: true, type: String },
|
|
1654
1767
|
emailSentFor: {
|
|
1655
|
-
enum: Object.values(
|
|
1768
|
+
enum: Object.values(import_cluemart_shared15.EnumNotificationResourceType),
|
|
1656
1769
|
required: false,
|
|
1657
1770
|
type: [String]
|
|
1658
1771
|
},
|
|
1659
1772
|
events: {
|
|
1660
1773
|
ref: "Event",
|
|
1661
1774
|
required: false,
|
|
1662
|
-
type: [
|
|
1775
|
+
type: [import_mongoose18.default.Schema.Types.ObjectId]
|
|
1663
1776
|
},
|
|
1664
1777
|
firstName: { required: true, type: String },
|
|
1665
1778
|
game: {
|
|
1666
1779
|
ref: "Game",
|
|
1667
1780
|
required: false,
|
|
1668
|
-
type:
|
|
1781
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1669
1782
|
},
|
|
1670
1783
|
interests: {
|
|
1671
|
-
enum: Object.values(
|
|
1784
|
+
enum: Object.values(import_cluemart_shared15.EnumResourceType),
|
|
1672
1785
|
required: false,
|
|
1673
1786
|
type: [String]
|
|
1674
1787
|
},
|
|
@@ -1691,11 +1804,11 @@ var schema12 = new MongooseSchema12(
|
|
|
1691
1804
|
partner: {
|
|
1692
1805
|
ref: "Partner",
|
|
1693
1806
|
required: false,
|
|
1694
|
-
type:
|
|
1807
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1695
1808
|
},
|
|
1696
1809
|
password: { required: true, type: String },
|
|
1697
1810
|
platform: {
|
|
1698
|
-
enum: Object.values(
|
|
1811
|
+
enum: Object.values(import_cluemart_shared15.EnumOSPlatform),
|
|
1699
1812
|
required: false,
|
|
1700
1813
|
type: String
|
|
1701
1814
|
},
|
|
@@ -1724,15 +1837,15 @@ var schema12 = new MongooseSchema12(
|
|
|
1724
1837
|
type: String
|
|
1725
1838
|
},
|
|
1726
1839
|
roles: {
|
|
1727
|
-
default: [
|
|
1728
|
-
enum: Object.values(
|
|
1840
|
+
default: [import_cluemart_shared15.EnumUserRole.CUSTOMER],
|
|
1841
|
+
enum: Object.values(import_cluemart_shared15.EnumUserRole),
|
|
1729
1842
|
required: true,
|
|
1730
1843
|
type: [String]
|
|
1731
1844
|
},
|
|
1732
1845
|
school: {
|
|
1733
1846
|
ref: "School",
|
|
1734
1847
|
required: false,
|
|
1735
|
-
type:
|
|
1848
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1736
1849
|
},
|
|
1737
1850
|
stripe: {
|
|
1738
1851
|
required: false,
|
|
@@ -1757,21 +1870,21 @@ var schema12 = new MongooseSchema12(
|
|
|
1757
1870
|
vendor: {
|
|
1758
1871
|
ref: "Vendor",
|
|
1759
1872
|
required: false,
|
|
1760
|
-
type:
|
|
1873
|
+
type: import_mongoose18.default.Schema.Types.ObjectId
|
|
1761
1874
|
}
|
|
1762
1875
|
},
|
|
1763
1876
|
{ strict: false, timestamps: true }
|
|
1764
1877
|
);
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
var UserModel =
|
|
1878
|
+
schema14.index({ "licences.expiryDate": 1 });
|
|
1879
|
+
schema14.index({ "licences.licenceType": 1 });
|
|
1880
|
+
schema14.index({ promoCodes: 1, active: 1, deletedAt: 1 });
|
|
1881
|
+
schema14.index({ email: "text", firstName: "text", lastName: "text" });
|
|
1882
|
+
var UserModel = import_mongoose18.default.models.User || import_mongoose18.default.model("User", schema14);
|
|
1770
1883
|
|
|
1771
1884
|
// src/mongoose/VerificationToken.ts
|
|
1772
|
-
var
|
|
1773
|
-
var
|
|
1774
|
-
var
|
|
1885
|
+
var import_mongoose19 = __toESM(require("mongoose"));
|
|
1886
|
+
var MongooseSchema15 = import_mongoose19.default.Schema;
|
|
1887
|
+
var schema15 = new MongooseSchema15(
|
|
1775
1888
|
{
|
|
1776
1889
|
createdAt: {
|
|
1777
1890
|
default: Date.now,
|
|
@@ -1786,13 +1899,13 @@ var schema13 = new MongooseSchema13(
|
|
|
1786
1899
|
},
|
|
1787
1900
|
{ timestamps: true }
|
|
1788
1901
|
);
|
|
1789
|
-
var VerificationTokenModel =
|
|
1902
|
+
var VerificationTokenModel = import_mongoose19.default.models.VerificationToken || import_mongoose19.default.model("VerificationToken", schema15);
|
|
1790
1903
|
|
|
1791
1904
|
// src/mongoose/vendor/Vendor.ts
|
|
1792
|
-
var
|
|
1793
|
-
var
|
|
1794
|
-
var
|
|
1795
|
-
var vendorProductTypeSchema = new
|
|
1905
|
+
var import_cluemart_shared16 = require("@timardex/cluemart-shared");
|
|
1906
|
+
var import_mongoose20 = __toESM(require("mongoose"));
|
|
1907
|
+
var MongooseSchema16 = import_mongoose20.default.Schema;
|
|
1908
|
+
var vendorProductTypeSchema = new MongooseSchema16(
|
|
1796
1909
|
{
|
|
1797
1910
|
description: { required: false, type: String },
|
|
1798
1911
|
name: { required: true, type: String },
|
|
@@ -1803,18 +1916,18 @@ var vendorProductTypeSchema = new MongooseSchema14(
|
|
|
1803
1916
|
},
|
|
1804
1917
|
{ timestamps: true }
|
|
1805
1918
|
);
|
|
1806
|
-
var productWrapperSchema = new
|
|
1919
|
+
var productWrapperSchema = new MongooseSchema16(
|
|
1807
1920
|
{
|
|
1808
1921
|
active: { default: false, required: false, type: Boolean },
|
|
1809
1922
|
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
1810
1923
|
},
|
|
1811
1924
|
{ _id: false }
|
|
1812
1925
|
);
|
|
1813
|
-
var calendarSchema = new
|
|
1926
|
+
var calendarSchema = new MongooseSchema16(
|
|
1814
1927
|
{
|
|
1815
1928
|
dateTime: {
|
|
1816
1929
|
dateStatus: {
|
|
1817
|
-
enum: Object.values(
|
|
1930
|
+
enum: Object.values(import_cluemart_shared16.EnumEventDateStatus),
|
|
1818
1931
|
required: false,
|
|
1819
1932
|
type: String
|
|
1820
1933
|
},
|
|
@@ -1831,14 +1944,14 @@ var calendarSchema = new MongooseSchema14(
|
|
|
1831
1944
|
},
|
|
1832
1945
|
{ _id: false }
|
|
1833
1946
|
);
|
|
1834
|
-
var calendarWrapperSchema = new
|
|
1947
|
+
var calendarWrapperSchema = new MongooseSchema16(
|
|
1835
1948
|
{
|
|
1836
1949
|
active: { default: false, required: true, type: Boolean },
|
|
1837
1950
|
calendarData: { required: false, type: [calendarSchema] }
|
|
1838
1951
|
},
|
|
1839
1952
|
{ _id: false }
|
|
1840
1953
|
);
|
|
1841
|
-
var vendorAvailabilitySchema = new
|
|
1954
|
+
var vendorAvailabilitySchema = new MongooseSchema16(
|
|
1842
1955
|
{
|
|
1843
1956
|
corporate: { default: false, required: false, type: Boolean },
|
|
1844
1957
|
private: { default: false, required: false, type: Boolean },
|
|
@@ -1846,7 +1959,7 @@ var vendorAvailabilitySchema = new MongooseSchema14(
|
|
|
1846
1959
|
},
|
|
1847
1960
|
{ _id: false }
|
|
1848
1961
|
);
|
|
1849
|
-
var downgradeSnapshotSchema = new
|
|
1962
|
+
var downgradeSnapshotSchema = new MongooseSchema16(
|
|
1850
1963
|
{
|
|
1851
1964
|
availability: { required: false, type: vendorAvailabilitySchema },
|
|
1852
1965
|
calendarActive: { required: false, type: Boolean },
|
|
@@ -1854,7 +1967,7 @@ var downgradeSnapshotSchema = new MongooseSchema14(
|
|
|
1854
1967
|
},
|
|
1855
1968
|
{ _id: false }
|
|
1856
1969
|
);
|
|
1857
|
-
var
|
|
1970
|
+
var schema16 = new MongooseSchema16(
|
|
1858
1971
|
{
|
|
1859
1972
|
...baseResourceFields,
|
|
1860
1973
|
// Importing base resource fields from global.ts
|
|
@@ -1873,47 +1986,47 @@ var schema14 = new MongooseSchema14(
|
|
|
1873
1986
|
unregisteredVendorId: {
|
|
1874
1987
|
ref: "UnregisteredVendor",
|
|
1875
1988
|
required: false,
|
|
1876
|
-
type:
|
|
1989
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1877
1990
|
},
|
|
1878
1991
|
vendorInfoId: {
|
|
1879
1992
|
ref: "VendorInfo",
|
|
1880
1993
|
required: false,
|
|
1881
|
-
type:
|
|
1994
|
+
type: import_mongoose20.default.Schema.Types.ObjectId
|
|
1882
1995
|
},
|
|
1883
1996
|
vendorType: {
|
|
1884
|
-
enum: Object.values(
|
|
1997
|
+
enum: Object.values(import_cluemart_shared16.EnumVendorType),
|
|
1885
1998
|
required: true,
|
|
1886
1999
|
type: String
|
|
1887
2000
|
}
|
|
1888
2001
|
},
|
|
1889
2002
|
{ timestamps: true }
|
|
1890
2003
|
);
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
2004
|
+
schema16.index({ name: 1 });
|
|
2005
|
+
schema16.index({ description: 1 });
|
|
2006
|
+
schema16.index({ region: 1 });
|
|
2007
|
+
schema16.index({ "categories.name": 1 });
|
|
2008
|
+
schema16.index({ slug: 1 });
|
|
2009
|
+
schema16.index({
|
|
1897
2010
|
categoriesNames: "text",
|
|
1898
2011
|
description: "text",
|
|
1899
2012
|
name: "text"
|
|
1900
2013
|
});
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
var VendorModel =
|
|
2014
|
+
schema16.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2015
|
+
schema16.plugin(searchNamePlugin);
|
|
2016
|
+
var VendorModel = import_mongoose20.default.models.Vendor || import_mongoose20.default.model("Vendor", schema16);
|
|
1904
2017
|
|
|
1905
2018
|
// src/mongoose/vendor/VendorInfo.ts
|
|
1906
|
-
var
|
|
1907
|
-
var
|
|
1908
|
-
var
|
|
1909
|
-
var AttributesSchema = new
|
|
2019
|
+
var import_cluemart_shared17 = require("@timardex/cluemart-shared");
|
|
2020
|
+
var import_mongoose21 = __toESM(require("mongoose"));
|
|
2021
|
+
var MongooseSchema17 = import_mongoose21.default.Schema;
|
|
2022
|
+
var AttributesSchema = new MongooseSchema17(
|
|
1910
2023
|
{
|
|
1911
2024
|
details: { required: false, type: String },
|
|
1912
2025
|
isRequired: { default: false, required: true, type: Boolean }
|
|
1913
2026
|
},
|
|
1914
2027
|
{ _id: false }
|
|
1915
2028
|
);
|
|
1916
|
-
var
|
|
2029
|
+
var schema17 = new MongooseSchema17(
|
|
1917
2030
|
{
|
|
1918
2031
|
active: { default: true, type: Boolean },
|
|
1919
2032
|
compliance: {
|
|
@@ -1923,7 +2036,7 @@ var schema15 = new MongooseSchema15(
|
|
|
1923
2036
|
documents: [ResourceImageTypeSchema],
|
|
1924
2037
|
product: {
|
|
1925
2038
|
foodFlavors: {
|
|
1926
|
-
enum: Object.values(
|
|
2039
|
+
enum: Object.values(import_cluemart_shared17.EnumFoodFlavor),
|
|
1927
2040
|
required: true,
|
|
1928
2041
|
type: [String]
|
|
1929
2042
|
},
|
|
@@ -1948,29 +2061,29 @@ var schema15 = new MongooseSchema15(
|
|
|
1948
2061
|
vendorId: {
|
|
1949
2062
|
ref: "Vendor",
|
|
1950
2063
|
required: true,
|
|
1951
|
-
type:
|
|
2064
|
+
type: import_mongoose21.default.Schema.Types.ObjectId
|
|
1952
2065
|
}
|
|
1953
2066
|
},
|
|
1954
2067
|
{ timestamps: true }
|
|
1955
2068
|
);
|
|
1956
|
-
|
|
1957
|
-
var VendorInfoModel =
|
|
2069
|
+
schema17.index({ vendorId: 1 });
|
|
2070
|
+
var VendorInfoModel = import_mongoose21.default.models.VendorInfo || import_mongoose21.default.model("VendorInfo", schema17);
|
|
1958
2071
|
|
|
1959
2072
|
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
1960
|
-
var
|
|
1961
|
-
var
|
|
1962
|
-
var invitationSchema = new
|
|
2073
|
+
var import_mongoose22 = __toESM(require("mongoose"));
|
|
2074
|
+
var MongooseSchema18 = import_mongoose22.default.Schema;
|
|
2075
|
+
var invitationSchema = new MongooseSchema18(
|
|
1963
2076
|
{
|
|
1964
2077
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
1965
2078
|
inviterId: {
|
|
1966
2079
|
ref: "Event",
|
|
1967
2080
|
required: true,
|
|
1968
|
-
type:
|
|
2081
|
+
type: import_mongoose22.default.Schema.Types.ObjectId
|
|
1969
2082
|
}
|
|
1970
2083
|
},
|
|
1971
2084
|
{ _id: false }
|
|
1972
2085
|
);
|
|
1973
|
-
var
|
|
2086
|
+
var schema18 = new MongooseSchema18(
|
|
1974
2087
|
{
|
|
1975
2088
|
active: { default: true, required: true, type: Boolean },
|
|
1976
2089
|
categoryIds: { required: true, type: [String] },
|
|
@@ -1979,7 +2092,7 @@ var schema16 = new MongooseSchema16(
|
|
|
1979
2092
|
claimedByUserId: {
|
|
1980
2093
|
ref: "User",
|
|
1981
2094
|
required: false,
|
|
1982
|
-
type:
|
|
2095
|
+
type: import_mongoose22.default.Schema.Types.ObjectId
|
|
1983
2096
|
},
|
|
1984
2097
|
claimInitiatedAt: { default: null, required: false, type: Date },
|
|
1985
2098
|
claimToken: { default: null, required: false, type: String },
|
|
@@ -1992,15 +2105,15 @@ var schema16 = new MongooseSchema16(
|
|
|
1992
2105
|
},
|
|
1993
2106
|
{ timestamps: true }
|
|
1994
2107
|
);
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
var UnregisteredVendorModel =
|
|
2108
|
+
schema18.index({ name: 1 });
|
|
2109
|
+
schema18.index({ email: 1 });
|
|
2110
|
+
var UnregisteredVendorModel = import_mongoose22.default.models.UnregisteredVendor || import_mongoose22.default.model("UnregisteredVendor", schema18);
|
|
1998
2111
|
|
|
1999
2112
|
// src/mongoose/event/Event.ts
|
|
2000
|
-
var
|
|
2001
|
-
var
|
|
2002
|
-
var
|
|
2003
|
-
var
|
|
2113
|
+
var import_cluemart_shared18 = require("@timardex/cluemart-shared");
|
|
2114
|
+
var import_mongoose23 = __toESM(require("mongoose"));
|
|
2115
|
+
var MongooseSchema19 = import_mongoose23.default.Schema;
|
|
2116
|
+
var schema19 = new MongooseSchema19(
|
|
2004
2117
|
{
|
|
2005
2118
|
...baseResourceFields,
|
|
2006
2119
|
// Importing base resource fields from global.ts
|
|
@@ -2009,10 +2122,10 @@ var schema17 = new MongooseSchema17(
|
|
|
2009
2122
|
eventInfoId: {
|
|
2010
2123
|
ref: "EventInfo",
|
|
2011
2124
|
required: false,
|
|
2012
|
-
type:
|
|
2125
|
+
type: import_mongoose23.default.Schema.Types.ObjectId
|
|
2013
2126
|
},
|
|
2014
2127
|
eventType: {
|
|
2015
|
-
enum: Object.values(
|
|
2128
|
+
enum: Object.values(import_cluemart_shared18.EnumEventType),
|
|
2016
2129
|
required: true,
|
|
2017
2130
|
type: String
|
|
2018
2131
|
},
|
|
@@ -2033,40 +2146,40 @@ var schema17 = new MongooseSchema17(
|
|
|
2033
2146
|
},
|
|
2034
2147
|
{ timestamps: true }
|
|
2035
2148
|
);
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
var EventModel =
|
|
2149
|
+
schema19.index({ name: 1 });
|
|
2150
|
+
schema19.index({ description: 1 });
|
|
2151
|
+
schema19.index({ region: 1 });
|
|
2152
|
+
schema19.index({ "location.geo": "2dsphere" });
|
|
2153
|
+
schema19.index({ tags: 1 });
|
|
2154
|
+
schema19.index({ deletedAt: 1 });
|
|
2155
|
+
schema19.index({ "dateTime.dateStatus": 1 });
|
|
2156
|
+
schema19.index({ slug: 1 });
|
|
2157
|
+
schema19.index({ description: "text", name: "text", tags: "text" });
|
|
2158
|
+
schema19.index({ deletedAt: 1, "owner.userId": 1 });
|
|
2159
|
+
schema19.plugin(searchNamePlugin);
|
|
2160
|
+
var EventModel = import_mongoose23.default.models.Event || import_mongoose23.default.model("Event", schema19);
|
|
2048
2161
|
|
|
2049
2162
|
// src/mongoose/event/EventDateArchive.ts
|
|
2050
|
-
var
|
|
2051
|
-
var
|
|
2163
|
+
var import_mongoose24 = __toESM(require("mongoose"));
|
|
2164
|
+
var schema20 = new import_mongoose24.default.Schema(
|
|
2052
2165
|
{
|
|
2053
2166
|
dateTime: { required: true, type: [dateTimeSchema] },
|
|
2054
2167
|
eventId: {
|
|
2055
2168
|
ref: "Event",
|
|
2056
2169
|
required: true,
|
|
2057
|
-
type:
|
|
2170
|
+
type: import_mongoose24.default.Schema.Types.ObjectId
|
|
2058
2171
|
}
|
|
2059
2172
|
},
|
|
2060
2173
|
{ timestamps: true }
|
|
2061
2174
|
);
|
|
2062
|
-
|
|
2063
|
-
var EventDateArchiveModel =
|
|
2175
|
+
schema20.index({ eventId: 1 }, { unique: true });
|
|
2176
|
+
var EventDateArchiveModel = import_mongoose24.default.models.EventDateArchive || import_mongoose24.default.model("EventDateArchive", schema20);
|
|
2064
2177
|
|
|
2065
2178
|
// src/mongoose/Partner.ts
|
|
2066
|
-
var
|
|
2067
|
-
var
|
|
2068
|
-
var
|
|
2069
|
-
var
|
|
2179
|
+
var import_cluemart_shared19 = require("@timardex/cluemart-shared");
|
|
2180
|
+
var import_mongoose25 = __toESM(require("mongoose"));
|
|
2181
|
+
var MongooseSchema20 = import_mongoose25.default.Schema;
|
|
2182
|
+
var schema21 = new MongooseSchema20(
|
|
2070
2183
|
{
|
|
2071
2184
|
...baseResourceFields,
|
|
2072
2185
|
location: {
|
|
@@ -2075,53 +2188,53 @@ var schema19 = new MongooseSchema18(
|
|
|
2075
2188
|
},
|
|
2076
2189
|
nzbn: { required: true, type: String },
|
|
2077
2190
|
partnerType: {
|
|
2078
|
-
enum: Object.values(
|
|
2191
|
+
enum: Object.values(import_cluemart_shared19.EnumPartnerType),
|
|
2079
2192
|
required: true,
|
|
2080
2193
|
type: String
|
|
2081
2194
|
}
|
|
2082
2195
|
},
|
|
2083
2196
|
{ timestamps: true }
|
|
2084
2197
|
);
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
var PartnerModel =
|
|
2198
|
+
schema21.index({ name: 1 });
|
|
2199
|
+
schema21.index({ description: 1 });
|
|
2200
|
+
schema21.index({ region: 1 });
|
|
2201
|
+
schema21.index({ "location.geo": "2dsphere" });
|
|
2202
|
+
schema21.index({ slug: 1 });
|
|
2203
|
+
schema21.index({ name: "text", description: "text" });
|
|
2204
|
+
schema21.index({ "owner.userId": 1, deletedAt: 1 });
|
|
2205
|
+
schema21.plugin(searchNamePlugin);
|
|
2206
|
+
var PartnerModel = import_mongoose25.default.models.Partner || import_mongoose25.default.model("Partner", schema21);
|
|
2094
2207
|
|
|
2095
2208
|
// src/mongoose/Post.ts
|
|
2096
|
-
var
|
|
2097
|
-
var
|
|
2098
|
-
var
|
|
2099
|
-
var contentSchema = new
|
|
2209
|
+
var import_cluemart_shared20 = require("@timardex/cluemart-shared");
|
|
2210
|
+
var import_mongoose26 = __toESM(require("mongoose"));
|
|
2211
|
+
var MongooseSchema21 = import_mongoose26.default.Schema;
|
|
2212
|
+
var contentSchema = new MongooseSchema21(
|
|
2100
2213
|
{
|
|
2101
|
-
contentData:
|
|
2214
|
+
contentData: import_mongoose26.Schema.Types.Mixed,
|
|
2102
2215
|
contentOrder: { required: true, type: Number },
|
|
2103
2216
|
contentType: {
|
|
2104
|
-
enum: Object.values(
|
|
2217
|
+
enum: Object.values(import_cluemart_shared20.EnumPostContentType),
|
|
2105
2218
|
required: true,
|
|
2106
2219
|
type: String
|
|
2107
2220
|
}
|
|
2108
2221
|
},
|
|
2109
2222
|
{ _id: false }
|
|
2110
2223
|
);
|
|
2111
|
-
var resourceSchema = new
|
|
2224
|
+
var resourceSchema = new MongooseSchema21(
|
|
2112
2225
|
{
|
|
2113
2226
|
resourceId: { required: true, type: String },
|
|
2114
2227
|
resourceRegion: { required: true, type: String },
|
|
2115
2228
|
resourceSlug: { required: true, type: String },
|
|
2116
2229
|
resourceType: {
|
|
2117
|
-
enum: Object.values(
|
|
2230
|
+
enum: Object.values(import_cluemart_shared20.EnumResourceType),
|
|
2118
2231
|
required: true,
|
|
2119
2232
|
type: String
|
|
2120
2233
|
}
|
|
2121
2234
|
},
|
|
2122
2235
|
{ _id: false }
|
|
2123
2236
|
);
|
|
2124
|
-
var
|
|
2237
|
+
var schema22 = new MongooseSchema21(
|
|
2125
2238
|
{
|
|
2126
2239
|
active: { default: false, required: true, type: Boolean },
|
|
2127
2240
|
approvedAt: { default: null, required: false, type: Date },
|
|
@@ -2137,7 +2250,7 @@ var schema20 = new MongooseSchema19(
|
|
|
2137
2250
|
},
|
|
2138
2251
|
deletedAt: { default: null, required: false, type: Date },
|
|
2139
2252
|
postType: {
|
|
2140
|
-
enum: Object.values(
|
|
2253
|
+
enum: Object.values(import_cluemart_shared20.EnumPostType),
|
|
2141
2254
|
required: true,
|
|
2142
2255
|
type: String
|
|
2143
2256
|
},
|
|
@@ -2152,16 +2265,16 @@ var schema20 = new MongooseSchema19(
|
|
|
2152
2265
|
},
|
|
2153
2266
|
{ timestamps: true }
|
|
2154
2267
|
);
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
var PostModel =
|
|
2268
|
+
schema22.index({ title: 1 });
|
|
2269
|
+
schema22.index({ tags: 1 });
|
|
2270
|
+
schema22.index({ postType: 1, slug: 1 }, { unique: true });
|
|
2271
|
+
var PostModel = import_mongoose26.default.models.Post || import_mongoose26.default.model("Post", schema22);
|
|
2159
2272
|
|
|
2160
2273
|
// src/mongoose/AppSetting.ts
|
|
2161
|
-
var
|
|
2162
|
-
var
|
|
2274
|
+
var import_mongoose27 = __toESM(require("mongoose"));
|
|
2275
|
+
var MongooseSchema22 = import_mongoose27.default.Schema;
|
|
2163
2276
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
2164
|
-
var AppSettingSchema = new
|
|
2277
|
+
var AppSettingSchema = new MongooseSchema22(
|
|
2165
2278
|
{
|
|
2166
2279
|
activeSchoolsStudentCountTotal: {
|
|
2167
2280
|
default: 0,
|
|
@@ -2183,8 +2296,8 @@ var AppSettingSchema = new MongooseSchema20(
|
|
|
2183
2296
|
validate: Number.isInteger
|
|
2184
2297
|
},
|
|
2185
2298
|
mobileDisplayEnabled: { default: false, required: true, type: Boolean },
|
|
2186
|
-
purchasePricing: { type:
|
|
2187
|
-
regionPricing: { type:
|
|
2299
|
+
purchasePricing: { type: MongooseSchema22.Types.Mixed },
|
|
2300
|
+
regionPricing: { type: MongooseSchema22.Types.Mixed },
|
|
2188
2301
|
paidSlotsPerPlacement: { enum: [30], type: Number },
|
|
2189
2302
|
reservedSlotsPerPlacement: { enum: [7], type: Number },
|
|
2190
2303
|
rotationSeconds: { enum: [8], type: Number },
|
|
@@ -2209,12 +2322,12 @@ var AppSettingSchema = new MongooseSchema20(
|
|
|
2209
2322
|
},
|
|
2210
2323
|
{ timestamps: true }
|
|
2211
2324
|
);
|
|
2212
|
-
var AppSettingModel =
|
|
2325
|
+
var AppSettingModel = import_mongoose27.default.models.AppSetting || import_mongoose27.default.model("AppSetting", AppSettingSchema);
|
|
2213
2326
|
|
|
2214
2327
|
// src/mongoose/AuthHandoffToken.ts
|
|
2215
|
-
var
|
|
2216
|
-
var
|
|
2217
|
-
var
|
|
2328
|
+
var import_mongoose28 = __toESM(require("mongoose"));
|
|
2329
|
+
var MongooseSchema23 = import_mongoose28.default.Schema;
|
|
2330
|
+
var schema23 = new MongooseSchema23(
|
|
2218
2331
|
{
|
|
2219
2332
|
expiresAt: { required: true, type: Date },
|
|
2220
2333
|
jti: { index: true, required: true, type: String, unique: true },
|
|
@@ -2223,25 +2336,25 @@ var schema21 = new MongooseSchema21(
|
|
|
2223
2336
|
index: true,
|
|
2224
2337
|
ref: "User",
|
|
2225
2338
|
required: true,
|
|
2226
|
-
type:
|
|
2339
|
+
type: import_mongoose28.default.Schema.Types.ObjectId
|
|
2227
2340
|
}
|
|
2228
2341
|
},
|
|
2229
2342
|
{ timestamps: true }
|
|
2230
2343
|
);
|
|
2231
|
-
|
|
2232
|
-
var AuthHandoffTokenModel =
|
|
2344
|
+
schema23.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
|
|
2345
|
+
var AuthHandoffTokenModel = import_mongoose28.default.models.AuthHandoffToken || import_mongoose28.default.model("AuthHandoffToken", schema23);
|
|
2233
2346
|
|
|
2234
2347
|
// src/mongoose/game/Game.ts
|
|
2235
|
-
var
|
|
2236
|
-
var
|
|
2348
|
+
var import_cluemart_shared21 = require("@timardex/cluemart-shared");
|
|
2349
|
+
var import_mongoose32 = __toESM(require("mongoose"));
|
|
2237
2350
|
|
|
2238
2351
|
// src/mongoose/game/DailyClue.ts
|
|
2239
|
-
var
|
|
2352
|
+
var import_mongoose30 = __toESM(require("mongoose"));
|
|
2240
2353
|
|
|
2241
2354
|
// src/mongoose/game/utils.ts
|
|
2242
|
-
var
|
|
2243
|
-
var
|
|
2244
|
-
var schemaGameDate = new
|
|
2355
|
+
var import_mongoose29 = __toESM(require("mongoose"));
|
|
2356
|
+
var MongooseSchema24 = import_mongoose29.default.Schema;
|
|
2357
|
+
var schemaGameDate = new MongooseSchema24(
|
|
2245
2358
|
{
|
|
2246
2359
|
endDate: { required: true, type: Date },
|
|
2247
2360
|
startDate: { required: true, type: Date }
|
|
@@ -2250,8 +2363,8 @@ var schemaGameDate = new MongooseSchema22(
|
|
|
2250
2363
|
);
|
|
2251
2364
|
|
|
2252
2365
|
// src/mongoose/game/DailyClue.ts
|
|
2253
|
-
var
|
|
2254
|
-
var schemaLetters = new
|
|
2366
|
+
var MongooseSchema25 = import_mongoose30.default.Schema;
|
|
2367
|
+
var schemaLetters = new MongooseSchema25(
|
|
2255
2368
|
{
|
|
2256
2369
|
collected: { required: false, type: [String] },
|
|
2257
2370
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -2259,14 +2372,14 @@ var schemaLetters = new MongooseSchema23(
|
|
|
2259
2372
|
},
|
|
2260
2373
|
{ _id: false }
|
|
2261
2374
|
);
|
|
2262
|
-
var schemaDailyClueBaseGame = new
|
|
2375
|
+
var schemaDailyClueBaseGame = new MongooseSchema25(
|
|
2263
2376
|
{
|
|
2264
2377
|
gameDate: { required: true, type: schemaGameDate },
|
|
2265
2378
|
gameSolution: { required: true, type: String }
|
|
2266
2379
|
},
|
|
2267
2380
|
{ _id: false }
|
|
2268
2381
|
);
|
|
2269
|
-
var schemaDailyClueGameData = new
|
|
2382
|
+
var schemaDailyClueGameData = new MongooseSchema25(
|
|
2270
2383
|
{
|
|
2271
2384
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
2272
2385
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -2281,9 +2394,9 @@ var schemaDailyClueGameData = new MongooseSchema23(
|
|
|
2281
2394
|
);
|
|
2282
2395
|
|
|
2283
2396
|
// src/mongoose/game/PuzzleGame.ts
|
|
2284
|
-
var
|
|
2285
|
-
var
|
|
2286
|
-
var schemaPuzzleAnswer = new
|
|
2397
|
+
var import_mongoose31 = __toESM(require("mongoose"));
|
|
2398
|
+
var MongooseSchema26 = import_mongoose31.default.Schema;
|
|
2399
|
+
var schemaPuzzleAnswer = new MongooseSchema26(
|
|
2287
2400
|
{
|
|
2288
2401
|
answer: { required: true, type: String },
|
|
2289
2402
|
answerId: { required: true, type: String },
|
|
@@ -2291,7 +2404,7 @@ var schemaPuzzleAnswer = new MongooseSchema24(
|
|
|
2291
2404
|
},
|
|
2292
2405
|
{ _id: false }
|
|
2293
2406
|
);
|
|
2294
|
-
var schemaPuzzleQuestion = new
|
|
2407
|
+
var schemaPuzzleQuestion = new MongooseSchema26(
|
|
2295
2408
|
{
|
|
2296
2409
|
answers: { required: true, type: [schemaPuzzleAnswer] },
|
|
2297
2410
|
question: { required: true, type: String },
|
|
@@ -2299,20 +2412,20 @@ var schemaPuzzleQuestion = new MongooseSchema24(
|
|
|
2299
2412
|
},
|
|
2300
2413
|
{ _id: false }
|
|
2301
2414
|
);
|
|
2302
|
-
var schemaPuzzleBaseGame = new
|
|
2415
|
+
var schemaPuzzleBaseGame = new MongooseSchema26(
|
|
2303
2416
|
{
|
|
2304
2417
|
questions: { required: true, type: [schemaPuzzleQuestion] }
|
|
2305
2418
|
},
|
|
2306
2419
|
{ _id: false }
|
|
2307
2420
|
);
|
|
2308
|
-
var schemaPuzzleAnsweredQuestion = new
|
|
2421
|
+
var schemaPuzzleAnsweredQuestion = new MongooseSchema26(
|
|
2309
2422
|
{
|
|
2310
2423
|
questionId: { required: true, type: String },
|
|
2311
2424
|
selectedAnswerId: { required: true, type: String }
|
|
2312
2425
|
},
|
|
2313
2426
|
{ _id: false }
|
|
2314
2427
|
);
|
|
2315
|
-
var schemaPuzzleGameData = new
|
|
2428
|
+
var schemaPuzzleGameData = new MongooseSchema26(
|
|
2316
2429
|
{
|
|
2317
2430
|
answeredQuestions: {
|
|
2318
2431
|
default: null,
|
|
@@ -2327,30 +2440,30 @@ var schemaPuzzleGameData = new MongooseSchema24(
|
|
|
2327
2440
|
);
|
|
2328
2441
|
|
|
2329
2442
|
// src/mongoose/game/Game.ts
|
|
2330
|
-
var
|
|
2443
|
+
var MongooseSchema27 = import_mongoose32.default.Schema;
|
|
2331
2444
|
var gameDataSchemas = {
|
|
2332
|
-
[
|
|
2333
|
-
[
|
|
2334
|
-
[
|
|
2445
|
+
[import_cluemart_shared21.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
2446
|
+
[import_cluemart_shared21.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
|
|
2447
|
+
[import_cluemart_shared21.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
|
|
2335
2448
|
};
|
|
2336
2449
|
var gameDataDefinition = Object.fromEntries(
|
|
2337
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
2450
|
+
Object.entries(gameDataSchemas).map(([key, schema28]) => [
|
|
2338
2451
|
key,
|
|
2339
|
-
{ default: null, required: false, type:
|
|
2452
|
+
{ default: null, required: false, type: schema28 }
|
|
2340
2453
|
])
|
|
2341
2454
|
);
|
|
2342
|
-
var gameHistorySchema = new
|
|
2455
|
+
var gameHistorySchema = new MongooseSchema27(
|
|
2343
2456
|
{
|
|
2344
2457
|
createdAt: { required: true, type: Date },
|
|
2345
2458
|
gameDate: { required: true, type: schemaGameDate },
|
|
2346
2459
|
gameStatus: {
|
|
2347
|
-
enum: Object.values(
|
|
2460
|
+
enum: Object.values(import_cluemart_shared21.EnumGameStatus),
|
|
2348
2461
|
required: true,
|
|
2349
2462
|
type: String
|
|
2350
2463
|
},
|
|
2351
2464
|
gameTitle: { required: true, type: String },
|
|
2352
2465
|
gameType: {
|
|
2353
|
-
enum: Object.values(
|
|
2466
|
+
enum: Object.values(import_cluemart_shared21.EnumGameType),
|
|
2354
2467
|
required: true,
|
|
2355
2468
|
type: String
|
|
2356
2469
|
},
|
|
@@ -2359,14 +2472,14 @@ var gameHistorySchema = new MongooseSchema25(
|
|
|
2359
2472
|
},
|
|
2360
2473
|
{ _id: false }
|
|
2361
2474
|
);
|
|
2362
|
-
var gameTypeSchema = new
|
|
2475
|
+
var gameTypeSchema = new MongooseSchema27(
|
|
2363
2476
|
{
|
|
2364
2477
|
active: { default: true, required: true, type: Boolean },
|
|
2365
2478
|
gameData: gameDataDefinition,
|
|
2366
2479
|
gameHistory: { default: [], required: true, type: [gameHistorySchema] },
|
|
2367
2480
|
gameTitle: { required: true, type: String },
|
|
2368
2481
|
gameType: {
|
|
2369
|
-
enum: Object.values(
|
|
2482
|
+
enum: Object.values(import_cluemart_shared21.EnumGameType),
|
|
2370
2483
|
required: true,
|
|
2371
2484
|
type: String
|
|
2372
2485
|
},
|
|
@@ -2377,7 +2490,7 @@ var gameTypeSchema = new MongooseSchema25(
|
|
|
2377
2490
|
},
|
|
2378
2491
|
{ timestamps: true }
|
|
2379
2492
|
);
|
|
2380
|
-
var
|
|
2493
|
+
var schema24 = new MongooseSchema27(
|
|
2381
2494
|
{
|
|
2382
2495
|
active: { default: false, required: true, type: Boolean },
|
|
2383
2496
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -2390,12 +2503,12 @@ var schema22 = new MongooseSchema25(
|
|
|
2390
2503
|
},
|
|
2391
2504
|
{ timestamps: true }
|
|
2392
2505
|
);
|
|
2393
|
-
var GameModel =
|
|
2506
|
+
var GameModel = import_mongoose32.default.models.Game || import_mongoose32.default.model("Game", schema24);
|
|
2394
2507
|
|
|
2395
2508
|
// src/mongoose/School.ts
|
|
2396
|
-
var
|
|
2397
|
-
var
|
|
2398
|
-
var campaignsSchema = new
|
|
2509
|
+
var import_mongoose33 = __toESM(require("mongoose"));
|
|
2510
|
+
var MongooseSchema28 = import_mongoose33.default.Schema;
|
|
2511
|
+
var campaignsSchema = new MongooseSchema28(
|
|
2399
2512
|
{
|
|
2400
2513
|
endDate: { required: true, type: Date },
|
|
2401
2514
|
name: { required: true, type: String },
|
|
@@ -2403,7 +2516,7 @@ var campaignsSchema = new MongooseSchema26(
|
|
|
2403
2516
|
},
|
|
2404
2517
|
{ _id: false }
|
|
2405
2518
|
);
|
|
2406
|
-
var
|
|
2519
|
+
var schema25 = new MongooseSchema28(
|
|
2407
2520
|
{
|
|
2408
2521
|
// New schools are active by default
|
|
2409
2522
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -2430,26 +2543,26 @@ var schema23 = new MongooseSchema26(
|
|
|
2430
2543
|
},
|
|
2431
2544
|
{ timestamps: true }
|
|
2432
2545
|
);
|
|
2433
|
-
|
|
2546
|
+
schema25.index(
|
|
2434
2547
|
{ schoolCode: 1 },
|
|
2435
2548
|
{
|
|
2436
2549
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2437
2550
|
unique: true
|
|
2438
2551
|
}
|
|
2439
2552
|
);
|
|
2440
|
-
var SchoolModel =
|
|
2553
|
+
var SchoolModel = import_mongoose33.default.models.School || import_mongoose33.default.model("School", schema25);
|
|
2441
2554
|
|
|
2442
2555
|
// src/mongoose/Affiliate.ts
|
|
2443
|
-
var
|
|
2444
|
-
var
|
|
2445
|
-
var
|
|
2446
|
-
var affiliateRewardSchema = new
|
|
2556
|
+
var import_cluemart_shared22 = require("@timardex/cluemart-shared");
|
|
2557
|
+
var import_mongoose34 = __toESM(require("mongoose"));
|
|
2558
|
+
var MongooseSchema29 = import_mongoose34.default.Schema;
|
|
2559
|
+
var affiliateRewardSchema = new MongooseSchema29(
|
|
2447
2560
|
{
|
|
2448
2561
|
createdAt: { required: true, type: Date },
|
|
2449
2562
|
redeemedAt: { default: null, required: false, type: Date },
|
|
2450
2563
|
rewardDescription: { required: true, type: String },
|
|
2451
2564
|
rewardType: {
|
|
2452
|
-
enum: Object.values(
|
|
2565
|
+
enum: Object.values(import_cluemart_shared22.EnumAffiliateRewardType),
|
|
2453
2566
|
required: true,
|
|
2454
2567
|
type: String
|
|
2455
2568
|
},
|
|
@@ -2457,13 +2570,13 @@ var affiliateRewardSchema = new MongooseSchema27(
|
|
|
2457
2570
|
},
|
|
2458
2571
|
{ _id: false }
|
|
2459
2572
|
);
|
|
2460
|
-
var affiliateResourceSchema = new
|
|
2573
|
+
var affiliateResourceSchema = new MongooseSchema29(
|
|
2461
2574
|
{
|
|
2462
2575
|
resourceActive: { default: true, required: true, type: Boolean },
|
|
2463
2576
|
resourceDeletedAt: { default: null, required: false, type: Date },
|
|
2464
2577
|
resourceId: {
|
|
2465
2578
|
required: true,
|
|
2466
|
-
type:
|
|
2579
|
+
type: import_mongoose34.default.Schema.Types.ObjectId
|
|
2467
2580
|
},
|
|
2468
2581
|
resourceName: { required: true, type: String },
|
|
2469
2582
|
resourceOwner: {
|
|
@@ -2471,7 +2584,7 @@ var affiliateResourceSchema = new MongooseSchema27(
|
|
|
2471
2584
|
type: OwnerTypeSchema
|
|
2472
2585
|
},
|
|
2473
2586
|
resourceType: {
|
|
2474
|
-
enum: Object.values(
|
|
2587
|
+
enum: Object.values(import_cluemart_shared22.EnumResourceType),
|
|
2475
2588
|
required: true,
|
|
2476
2589
|
type: String
|
|
2477
2590
|
},
|
|
@@ -2483,20 +2596,20 @@ var affiliateResourceSchema = new MongooseSchema27(
|
|
|
2483
2596
|
},
|
|
2484
2597
|
{ _id: false }
|
|
2485
2598
|
);
|
|
2486
|
-
var affiliateContactDetailsSchema = new
|
|
2599
|
+
var affiliateContactDetailsSchema = new MongooseSchema29(
|
|
2487
2600
|
{
|
|
2488
2601
|
mobilePhone: { required: true, type: String }
|
|
2489
2602
|
},
|
|
2490
2603
|
{ _id: false }
|
|
2491
2604
|
);
|
|
2492
|
-
var affiliateBankAccountDetailsSchema = new
|
|
2605
|
+
var affiliateBankAccountDetailsSchema = new MongooseSchema29(
|
|
2493
2606
|
{
|
|
2494
2607
|
accountHolderName: { required: true, type: String },
|
|
2495
2608
|
accountNumber: { required: true, type: String }
|
|
2496
2609
|
},
|
|
2497
2610
|
{ _id: false }
|
|
2498
2611
|
);
|
|
2499
|
-
var affiliateDetailsSchema = new
|
|
2612
|
+
var affiliateDetailsSchema = new MongooseSchema29(
|
|
2500
2613
|
{
|
|
2501
2614
|
bankAccountDetails: {
|
|
2502
2615
|
required: true,
|
|
@@ -2509,7 +2622,7 @@ var affiliateDetailsSchema = new MongooseSchema27(
|
|
|
2509
2622
|
lastName: { required: true, type: String },
|
|
2510
2623
|
location: { required: true, type: locationsSchema },
|
|
2511
2624
|
participantType: {
|
|
2512
|
-
enum: Object.values(
|
|
2625
|
+
enum: Object.values(import_cluemart_shared22.EnumAffiliateParticipantType),
|
|
2513
2626
|
required: true,
|
|
2514
2627
|
type: String
|
|
2515
2628
|
},
|
|
@@ -2518,7 +2631,7 @@ var affiliateDetailsSchema = new MongooseSchema27(
|
|
|
2518
2631
|
},
|
|
2519
2632
|
{ _id: false }
|
|
2520
2633
|
);
|
|
2521
|
-
var redeemHistorySchema = new
|
|
2634
|
+
var redeemHistorySchema = new MongooseSchema29(
|
|
2522
2635
|
{
|
|
2523
2636
|
paidAt: { default: null, required: false, type: Date },
|
|
2524
2637
|
redeemedAt: { required: true, type: Date },
|
|
@@ -2526,7 +2639,7 @@ var redeemHistorySchema = new MongooseSchema27(
|
|
|
2526
2639
|
},
|
|
2527
2640
|
{ _id: false }
|
|
2528
2641
|
);
|
|
2529
|
-
var
|
|
2642
|
+
var schema26 = new MongooseSchema29(
|
|
2530
2643
|
{
|
|
2531
2644
|
active: { default: false, required: true, type: Boolean },
|
|
2532
2645
|
affiliateBonusRewards: {
|
|
@@ -2556,26 +2669,26 @@ var schema24 = new MongooseSchema27(
|
|
|
2556
2669
|
},
|
|
2557
2670
|
{ timestamps: true }
|
|
2558
2671
|
);
|
|
2559
|
-
|
|
2672
|
+
schema26.index(
|
|
2560
2673
|
{ affiliateCode: 1 },
|
|
2561
2674
|
{
|
|
2562
2675
|
partialFilterExpression: { active: true, deletedAt: null },
|
|
2563
2676
|
unique: true
|
|
2564
2677
|
}
|
|
2565
2678
|
);
|
|
2566
|
-
var AffiliateModel =
|
|
2679
|
+
var AffiliateModel = import_mongoose34.default.models.Affiliate || import_mongoose34.default.model("Affiliate", schema26);
|
|
2567
2680
|
|
|
2568
2681
|
// src/mongoose/Coupon.ts
|
|
2569
|
-
var
|
|
2570
|
-
var
|
|
2571
|
-
var
|
|
2572
|
-
var couponOptionSchema = new
|
|
2682
|
+
var import_cluemart_shared23 = require("@timardex/cluemart-shared");
|
|
2683
|
+
var import_mongoose35 = __toESM(require("mongoose"));
|
|
2684
|
+
var MongooseSchema30 = import_mongoose35.default.Schema;
|
|
2685
|
+
var couponOptionSchema = new MongooseSchema30(
|
|
2573
2686
|
{
|
|
2574
2687
|
buy: { required: false, type: Number },
|
|
2575
2688
|
get: { required: false, type: Number },
|
|
2576
2689
|
maxRewardCount: { required: false, type: Number },
|
|
2577
2690
|
type: {
|
|
2578
|
-
enum: Object.values(
|
|
2691
|
+
enum: Object.values(import_cluemart_shared23.EnumCouponQualificationType),
|
|
2579
2692
|
required: true,
|
|
2580
2693
|
type: String
|
|
2581
2694
|
},
|
|
@@ -2584,29 +2697,29 @@ var couponOptionSchema = new MongooseSchema28(
|
|
|
2584
2697
|
},
|
|
2585
2698
|
{ _id: false }
|
|
2586
2699
|
);
|
|
2587
|
-
var couponVendorProductSchema = new
|
|
2700
|
+
var couponVendorProductSchema = new MongooseSchema30(
|
|
2588
2701
|
{
|
|
2589
2702
|
couponId: {
|
|
2590
2703
|
required: true,
|
|
2591
|
-
type:
|
|
2704
|
+
type: import_mongoose35.default.Schema.Types.ObjectId
|
|
2592
2705
|
},
|
|
2593
2706
|
productId: {
|
|
2594
2707
|
required: true,
|
|
2595
|
-
type:
|
|
2708
|
+
type: import_mongoose35.default.Schema.Types.ObjectId
|
|
2596
2709
|
},
|
|
2597
2710
|
vendorCouponId: {
|
|
2598
2711
|
required: false,
|
|
2599
|
-
type:
|
|
2712
|
+
type: import_mongoose35.default.Schema.Types.ObjectId
|
|
2600
2713
|
},
|
|
2601
2714
|
vendorId: {
|
|
2602
2715
|
ref: "Vendor",
|
|
2603
2716
|
required: true,
|
|
2604
|
-
type:
|
|
2717
|
+
type: import_mongoose35.default.Schema.Types.ObjectId
|
|
2605
2718
|
}
|
|
2606
2719
|
},
|
|
2607
2720
|
{ _id: false }
|
|
2608
2721
|
);
|
|
2609
|
-
var couponCodeSchema = new
|
|
2722
|
+
var couponCodeSchema = new MongooseSchema30(
|
|
2610
2723
|
{
|
|
2611
2724
|
code: { required: true, type: String },
|
|
2612
2725
|
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
@@ -2614,7 +2727,7 @@ var couponCodeSchema = new MongooseSchema28(
|
|
|
2614
2727
|
},
|
|
2615
2728
|
{ _id: false }
|
|
2616
2729
|
);
|
|
2617
|
-
var couponParticipantUserSchema = new
|
|
2730
|
+
var couponParticipantUserSchema = new MongooseSchema30(
|
|
2618
2731
|
{
|
|
2619
2732
|
couponCollectedCount: { default: 0, required: true, type: Number },
|
|
2620
2733
|
couponCycleRedeemed: { default: false, required: true, type: Boolean },
|
|
@@ -2623,12 +2736,12 @@ var couponParticipantUserSchema = new MongooseSchema28(
|
|
|
2623
2736
|
userId: {
|
|
2624
2737
|
ref: "User",
|
|
2625
2738
|
required: true,
|
|
2626
|
-
type:
|
|
2739
|
+
type: import_mongoose35.default.Schema.Types.ObjectId
|
|
2627
2740
|
}
|
|
2628
2741
|
},
|
|
2629
2742
|
{ timestamps: true }
|
|
2630
2743
|
);
|
|
2631
|
-
var couponDataSchema = new
|
|
2744
|
+
var couponDataSchema = new MongooseSchema30(
|
|
2632
2745
|
{
|
|
2633
2746
|
active: { default: true, required: true, type: Boolean },
|
|
2634
2747
|
couponCode: { required: false, type: couponCodeSchema },
|
|
@@ -2647,7 +2760,7 @@ var couponDataSchema = new MongooseSchema28(
|
|
|
2647
2760
|
},
|
|
2648
2761
|
resourceId: { required: true, type: String },
|
|
2649
2762
|
resourceType: {
|
|
2650
|
-
enum: Object.values(
|
|
2763
|
+
enum: Object.values(import_cluemart_shared23.EnumResourceType),
|
|
2651
2764
|
required: true,
|
|
2652
2765
|
type: String
|
|
2653
2766
|
},
|
|
@@ -2655,7 +2768,7 @@ var couponDataSchema = new MongooseSchema28(
|
|
|
2655
2768
|
},
|
|
2656
2769
|
{ timestamps: true }
|
|
2657
2770
|
);
|
|
2658
|
-
var
|
|
2771
|
+
var schema27 = new MongooseSchema30(
|
|
2659
2772
|
{
|
|
2660
2773
|
active: { default: true, required: true, type: Boolean },
|
|
2661
2774
|
couponData: { default: [], required: false, type: [couponDataSchema] },
|
|
@@ -2667,62 +2780,62 @@ var schema25 = new MongooseSchema28(
|
|
|
2667
2780
|
},
|
|
2668
2781
|
{ timestamps: true }
|
|
2669
2782
|
);
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
var CouponModel =
|
|
2783
|
+
schema27.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
|
|
2784
|
+
schema27.index({ "couponData.participantUsers.userId": 1 });
|
|
2785
|
+
var CouponModel = import_mongoose35.default.models.Coupon || import_mongoose35.default.model("Coupon", schema27);
|
|
2673
2786
|
|
|
2674
2787
|
// src/mongoose/Impersonation.ts
|
|
2675
|
-
var
|
|
2676
|
-
var
|
|
2677
|
-
var
|
|
2678
|
-
var impersonationSessionSchema = new
|
|
2788
|
+
var import_cluemart_shared24 = require("@timardex/cluemart-shared");
|
|
2789
|
+
var import_mongoose36 = __toESM(require("mongoose"));
|
|
2790
|
+
var MongooseSchema31 = import_mongoose36.default.Schema;
|
|
2791
|
+
var impersonationSessionSchema = new MongooseSchema31(
|
|
2679
2792
|
{
|
|
2680
2793
|
expiresAt: { expires: 0, required: true, type: Date },
|
|
2681
2794
|
impersonatedUserId: {
|
|
2682
2795
|
index: true,
|
|
2683
2796
|
ref: "User",
|
|
2684
2797
|
required: true,
|
|
2685
|
-
type:
|
|
2798
|
+
type: import_mongoose36.default.Schema.Types.ObjectId
|
|
2686
2799
|
},
|
|
2687
2800
|
impersonatorUserId: {
|
|
2688
2801
|
index: true,
|
|
2689
2802
|
ref: "User",
|
|
2690
2803
|
required: true,
|
|
2691
|
-
type:
|
|
2804
|
+
type: import_mongoose36.default.Schema.Types.ObjectId
|
|
2692
2805
|
},
|
|
2693
2806
|
refreshToken: { required: true, type: String }
|
|
2694
2807
|
},
|
|
2695
2808
|
{ timestamps: true }
|
|
2696
2809
|
);
|
|
2697
|
-
var ImpersonationSessionModel =
|
|
2810
|
+
var ImpersonationSessionModel = import_mongoose36.default.models.ImpersonationSession || import_mongoose36.default.model(
|
|
2698
2811
|
"ImpersonationSession",
|
|
2699
2812
|
impersonationSessionSchema
|
|
2700
2813
|
);
|
|
2701
|
-
var impersonationAuditSchema = new
|
|
2814
|
+
var impersonationAuditSchema = new MongooseSchema31(
|
|
2702
2815
|
{
|
|
2703
2816
|
action: { enum: ["start", "end"], required: true, type: String },
|
|
2704
2817
|
endReason: { type: String },
|
|
2705
2818
|
impersonatedUserId: {
|
|
2706
2819
|
ref: "User",
|
|
2707
2820
|
required: true,
|
|
2708
|
-
type:
|
|
2821
|
+
type: import_mongoose36.default.Schema.Types.ObjectId
|
|
2709
2822
|
},
|
|
2710
2823
|
impersonatorUserId: {
|
|
2711
2824
|
ref: "User",
|
|
2712
2825
|
required: true,
|
|
2713
|
-
type:
|
|
2826
|
+
type: import_mongoose36.default.Schema.Types.ObjectId
|
|
2714
2827
|
},
|
|
2715
|
-
resourceId: { type:
|
|
2716
|
-
resourceType: { enum: Object.values(
|
|
2828
|
+
resourceId: { type: import_mongoose36.default.Schema.Types.ObjectId },
|
|
2829
|
+
resourceType: { enum: Object.values(import_cluemart_shared24.EnumResourceType), type: String },
|
|
2717
2830
|
sessionId: {
|
|
2718
2831
|
ref: "ImpersonationSession",
|
|
2719
2832
|
required: true,
|
|
2720
|
-
type:
|
|
2833
|
+
type: import_mongoose36.default.Schema.Types.ObjectId
|
|
2721
2834
|
}
|
|
2722
2835
|
},
|
|
2723
2836
|
{ timestamps: true }
|
|
2724
2837
|
);
|
|
2725
|
-
var ImpersonationAuditModel =
|
|
2838
|
+
var ImpersonationAuditModel = import_mongoose36.default.models.ImpersonationAudit || import_mongoose36.default.model(
|
|
2726
2839
|
"ImpersonationAudit",
|
|
2727
2840
|
impersonationAuditSchema
|
|
2728
2841
|
);
|
|
@@ -2743,7 +2856,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
|
|
|
2743
2856
|
}
|
|
2744
2857
|
|
|
2745
2858
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
2746
|
-
var
|
|
2859
|
+
var import_cluemart_shared26 = require("@timardex/cluemart-shared");
|
|
2747
2860
|
var import_utils3 = require("@timardex/cluemart-shared/utils");
|
|
2748
2861
|
|
|
2749
2862
|
// src/service/saveNotificationsInDb.ts
|
|
@@ -2878,7 +2991,7 @@ async function sendPushNotifications({
|
|
|
2878
2991
|
}
|
|
2879
2992
|
|
|
2880
2993
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
2881
|
-
var
|
|
2994
|
+
var import_cluemart_shared25 = require("@timardex/cluemart-shared");
|
|
2882
2995
|
var import_dayjs = __toESM(require("dayjs"));
|
|
2883
2996
|
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
2884
2997
|
var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
@@ -2936,17 +3049,17 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
|
|
|
2936
3049
|
// src/service/affiliate/vendorSubscriptionRewards.ts
|
|
2937
3050
|
import_dayjs.default.extend(import_utc.default);
|
|
2938
3051
|
import_dayjs.default.extend(import_timezone.default);
|
|
2939
|
-
var SUBSCRIPTION_REWARD_TIMEZONE =
|
|
3052
|
+
var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared25.NZ_TZ;
|
|
2940
3053
|
async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
|
|
2941
3054
|
const { hasSubscription, validTypes } = await getVendorStripeSubscriptionPlanForRewards(userId, now);
|
|
2942
|
-
if (validTypes.has(
|
|
3055
|
+
if (validTypes.has(import_cluemart_shared25.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared25.EnumUserLicence.PRO_PLUS_VENDOR)) {
|
|
2943
3056
|
if (hasSubscription) {
|
|
2944
|
-
return
|
|
3057
|
+
return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
|
|
2945
3058
|
}
|
|
2946
|
-
return
|
|
3059
|
+
return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
2947
3060
|
}
|
|
2948
|
-
if (validTypes.has(
|
|
2949
|
-
return
|
|
3061
|
+
if (validTypes.has(import_cluemart_shared25.EnumUserLicence.STANDARD_VENDOR)) {
|
|
3062
|
+
return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
|
|
2950
3063
|
}
|
|
2951
3064
|
return null;
|
|
2952
3065
|
}
|
|
@@ -2958,7 +3071,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
|
|
|
2958
3071
|
|
|
2959
3072
|
// src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
|
|
2960
3073
|
function isEligibleVendorResource(resource) {
|
|
2961
|
-
return resource.resourceType ===
|
|
3074
|
+
return resource.resourceType === import_cluemart_shared26.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
|
|
2962
3075
|
}
|
|
2963
3076
|
async function findAffiliatesWithActiveVendorReferrals() {
|
|
2964
3077
|
return await AffiliateModel.find({
|
|
@@ -2967,7 +3080,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
|
|
|
2967
3080
|
$elemMatch: {
|
|
2968
3081
|
resourceActive: true,
|
|
2969
3082
|
resourceDeletedAt: null,
|
|
2970
|
-
resourceType:
|
|
3083
|
+
resourceType: import_cluemart_shared26.EnumResourceType.VENDOR
|
|
2971
3084
|
}
|
|
2972
3085
|
},
|
|
2973
3086
|
deletedAt: null
|
|
@@ -3001,11 +3114,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
|
|
|
3001
3114
|
data: {
|
|
3002
3115
|
resourceId: String(affiliateId),
|
|
3003
3116
|
resourceName: resourceNames.join(", "),
|
|
3004
|
-
resourceType:
|
|
3117
|
+
resourceType: import_cluemart_shared26.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
|
|
3005
3118
|
},
|
|
3006
3119
|
message,
|
|
3007
3120
|
title: "Affiliate points earned",
|
|
3008
|
-
type:
|
|
3121
|
+
type: import_cluemart_shared26.EnumNotificationType.SYSTEM,
|
|
3009
3122
|
userIds: [affiliateOwnerUserId]
|
|
3010
3123
|
};
|
|
3011
3124
|
try {
|
|
@@ -3034,7 +3147,7 @@ async function tryAwardSubscriptionReward({
|
|
|
3034
3147
|
resourceActive: true,
|
|
3035
3148
|
resourceDeletedAt: null,
|
|
3036
3149
|
resourceId: resource.resourceId,
|
|
3037
|
-
resourceType:
|
|
3150
|
+
resourceType: import_cluemart_shared26.EnumResourceType.VENDOR,
|
|
3038
3151
|
rewards: {
|
|
3039
3152
|
$not: {
|
|
3040
3153
|
$elemMatch: {
|
|
@@ -3155,7 +3268,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
|
|
|
3155
3268
|
}
|
|
3156
3269
|
|
|
3157
3270
|
// src/service/database.ts
|
|
3158
|
-
var
|
|
3271
|
+
var import_mongoose40 = __toESM(require("mongoose"));
|
|
3159
3272
|
var connectToDatabase = async ({
|
|
3160
3273
|
appName,
|
|
3161
3274
|
dbName,
|
|
@@ -3168,7 +3281,7 @@ var connectToDatabase = async ({
|
|
|
3168
3281
|
// Fallback to MongoDB Atlas connection string
|
|
3169
3282
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
3170
3283
|
);
|
|
3171
|
-
await
|
|
3284
|
+
await import_mongoose40.default.connect(mongoUri);
|
|
3172
3285
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
3173
3286
|
console.log(
|
|
3174
3287
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -3181,7 +3294,7 @@ var connectToDatabase = async ({
|
|
|
3181
3294
|
|
|
3182
3295
|
// src/types/index.ts
|
|
3183
3296
|
var import_express = __toESM(require("express"));
|
|
3184
|
-
var
|
|
3297
|
+
var import_mongoose41 = __toESM(require("mongoose"));
|
|
3185
3298
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
3186
3299
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
3187
3300
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -3236,9 +3349,9 @@ async function notifyUsers({
|
|
|
3236
3349
|
}
|
|
3237
3350
|
|
|
3238
3351
|
// src/service/updateAdStatus.ts
|
|
3239
|
-
var
|
|
3352
|
+
var import_cluemart_shared27 = require("@timardex/cluemart-shared");
|
|
3240
3353
|
async function updateAdStatuses() {
|
|
3241
|
-
const now = (0,
|
|
3354
|
+
const now = (0, import_cluemart_shared27.nzDayKey)();
|
|
3242
3355
|
const invalidResult = await AdModel.updateMany(
|
|
3243
3356
|
{
|
|
3244
3357
|
$or: [
|
|
@@ -3246,50 +3359,50 @@ async function updateAdStatuses() {
|
|
|
3246
3359
|
{ end: { $exists: false } },
|
|
3247
3360
|
{ $expr: { $gt: ["$start", "$end"] } }
|
|
3248
3361
|
],
|
|
3249
|
-
status: { $ne:
|
|
3362
|
+
status: { $ne: import_cluemart_shared27.EnumAdStatus.PAUSED }
|
|
3250
3363
|
},
|
|
3251
|
-
{ $set: { status:
|
|
3364
|
+
{ $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
|
|
3252
3365
|
);
|
|
3253
3366
|
const expiredResult = await AdModel.updateMany(
|
|
3254
|
-
{ end: { $lte: now }, status: { $ne:
|
|
3255
|
-
{ $set: { status:
|
|
3367
|
+
{ end: { $lte: now }, status: { $ne: import_cluemart_shared27.EnumAdStatus.EXPIRED } },
|
|
3368
|
+
{ $set: { status: import_cluemart_shared27.EnumAdStatus.EXPIRED } }
|
|
3256
3369
|
);
|
|
3257
3370
|
const eligibleBooking = {
|
|
3258
3371
|
$or: [
|
|
3259
3372
|
{ bookingKind: { $exists: false } },
|
|
3260
3373
|
{ bookingKind: null },
|
|
3261
3374
|
{
|
|
3262
|
-
approvalStatus:
|
|
3263
|
-
bookingKind:
|
|
3375
|
+
approvalStatus: import_cluemart_shared27.EnumAdApprovalStatus.APPROVED,
|
|
3376
|
+
bookingKind: import_cluemart_shared27.EnumAdBookingSlotKind.RESERVED
|
|
3264
3377
|
},
|
|
3265
3378
|
{
|
|
3266
|
-
approvalStatus:
|
|
3267
|
-
bookingKind:
|
|
3268
|
-
paymentStatus:
|
|
3379
|
+
approvalStatus: import_cluemart_shared27.EnumAdApprovalStatus.APPROVED,
|
|
3380
|
+
bookingKind: import_cluemart_shared27.EnumAdBookingSlotKind.PAID,
|
|
3381
|
+
paymentStatus: import_cluemart_shared27.EnumAdPaymentStatus.PAID
|
|
3269
3382
|
}
|
|
3270
3383
|
]
|
|
3271
3384
|
};
|
|
3272
3385
|
const awaitingApprovalResult = await AdModel.updateMany(
|
|
3273
3386
|
{
|
|
3274
3387
|
$nor: eligibleBooking.$or,
|
|
3275
|
-
bookingKind: { $in: Object.values(
|
|
3388
|
+
bookingKind: { $in: Object.values(import_cluemart_shared27.EnumAdBookingSlotKind) },
|
|
3276
3389
|
end: { $gt: now },
|
|
3277
|
-
status:
|
|
3390
|
+
status: import_cluemart_shared27.EnumAdStatus.ACTIVE
|
|
3278
3391
|
},
|
|
3279
|
-
{ $set: { status:
|
|
3392
|
+
{ $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
|
|
3280
3393
|
);
|
|
3281
3394
|
const activeResult = await AdModel.updateMany(
|
|
3282
3395
|
{
|
|
3283
3396
|
end: { $gt: now },
|
|
3284
3397
|
start: { $lte: now },
|
|
3285
|
-
status: { $ne:
|
|
3398
|
+
status: { $ne: import_cluemart_shared27.EnumAdStatus.ACTIVE },
|
|
3286
3399
|
...eligibleBooking
|
|
3287
3400
|
},
|
|
3288
|
-
{ $set: { status:
|
|
3401
|
+
{ $set: { status: import_cluemart_shared27.EnumAdStatus.ACTIVE } }
|
|
3289
3402
|
);
|
|
3290
3403
|
const pausedResult = await AdModel.updateMany(
|
|
3291
|
-
{ start: { $gt: now }, status: { $ne:
|
|
3292
|
-
{ $set: { status:
|
|
3404
|
+
{ start: { $gt: now }, status: { $ne: import_cluemart_shared27.EnumAdStatus.PAUSED } },
|
|
3405
|
+
{ $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
|
|
3293
3406
|
);
|
|
3294
3407
|
console.log(
|
|
3295
3408
|
`\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
|
|
@@ -3297,15 +3410,15 @@ async function updateAdStatuses() {
|
|
|
3297
3410
|
}
|
|
3298
3411
|
|
|
3299
3412
|
// src/service/objectIdToString.ts
|
|
3300
|
-
var
|
|
3413
|
+
var import_mongoose43 = __toESM(require("mongoose"));
|
|
3301
3414
|
function isValidObjectId(value) {
|
|
3302
|
-
return
|
|
3415
|
+
return import_mongoose43.default.Types.ObjectId.isValid(value);
|
|
3303
3416
|
}
|
|
3304
3417
|
function convertObjectIdsToStrings(obj) {
|
|
3305
3418
|
if (obj === null || obj === void 0) {
|
|
3306
3419
|
return obj;
|
|
3307
3420
|
}
|
|
3308
|
-
if (obj instanceof
|
|
3421
|
+
if (obj instanceof import_mongoose43.default.Types.ObjectId) {
|
|
3309
3422
|
return obj.toString();
|
|
3310
3423
|
}
|
|
3311
3424
|
if (obj instanceof Date) {
|
|
@@ -3499,19 +3612,19 @@ function buildUserPointEntryRemovalPipeline(pointType, sourceId) {
|
|
|
3499
3612
|
}
|
|
3500
3613
|
|
|
3501
3614
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
3502
|
-
var
|
|
3615
|
+
var import_cluemart_shared29 = require("@timardex/cluemart-shared");
|
|
3503
3616
|
var import_dayjs4 = __toESM(require("dayjs"));
|
|
3504
3617
|
|
|
3505
3618
|
// src/service/event/archiveEndedEventDates.ts
|
|
3506
|
-
var
|
|
3619
|
+
var import_cluemart_shared28 = require("@timardex/cluemart-shared");
|
|
3507
3620
|
var import_dayjs3 = __toESM(require("dayjs"));
|
|
3508
3621
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
|
|
3509
3622
|
import_dayjs3.default.extend(import_customParseFormat.default);
|
|
3510
3623
|
var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
|
|
3511
|
-
|
|
3624
|
+
import_cluemart_shared28.EnumEventDateStatus.ENDED
|
|
3512
3625
|
]);
|
|
3513
3626
|
var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
|
|
3514
|
-
|
|
3627
|
+
import_cluemart_shared28.EnumEventDateStatus.INVALID
|
|
3515
3628
|
]);
|
|
3516
3629
|
function splitEventDatesForArchive(dateTime) {
|
|
3517
3630
|
return {
|
|
@@ -3534,12 +3647,12 @@ function dedupeArchivedSlotsByStartDateTime(slots) {
|
|
|
3534
3647
|
});
|
|
3535
3648
|
}
|
|
3536
3649
|
function isPastCanceledEventDate(slot, now) {
|
|
3537
|
-
if (slot.dateStatus !==
|
|
3650
|
+
if (slot.dateStatus !== import_cluemart_shared28.EnumEventDateStatus.CANCELED) {
|
|
3538
3651
|
return false;
|
|
3539
3652
|
}
|
|
3540
3653
|
const endDateTime = (0, import_dayjs3.default)(
|
|
3541
3654
|
`${slot.endDate} ${slot.endTime}`,
|
|
3542
|
-
`${
|
|
3655
|
+
`${import_cluemart_shared28.dateFormat} ${import_cluemart_shared28.timeFormat}`,
|
|
3543
3656
|
true
|
|
3544
3657
|
);
|
|
3545
3658
|
return endDateTime.isValid() && endDateTime.isBefore(now);
|
|
@@ -3585,7 +3698,7 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3585
3698
|
try {
|
|
3586
3699
|
for await (const doc of cursor) {
|
|
3587
3700
|
const dateTime = doc.dateTime.map(
|
|
3588
|
-
(slot) => (0,
|
|
3701
|
+
(slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
|
|
3589
3702
|
);
|
|
3590
3703
|
if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
|
|
3591
3704
|
continue;
|
|
@@ -3609,9 +3722,9 @@ async function updateModelDateTimeStatuses(model, now) {
|
|
|
3609
3722
|
var ARCHIVABLE_EVENT_FILTER = {
|
|
3610
3723
|
"dateTime.dateStatus": {
|
|
3611
3724
|
$in: [
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3725
|
+
import_cluemart_shared29.EnumEventDateStatus.ENDED,
|
|
3726
|
+
import_cluemart_shared29.EnumEventDateStatus.INVALID,
|
|
3727
|
+
import_cluemart_shared29.EnumEventDateStatus.CANCELED
|
|
3615
3728
|
]
|
|
3616
3729
|
},
|
|
3617
3730
|
deletedAt: null
|
|
@@ -3636,7 +3749,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3636
3749
|
try {
|
|
3637
3750
|
for await (const doc of cursor) {
|
|
3638
3751
|
const updated = doc.dateTime.map(
|
|
3639
|
-
(slot) => (0,
|
|
3752
|
+
(slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
|
|
3640
3753
|
);
|
|
3641
3754
|
const { archive, discard } = splitEventDatesForArchive(updated);
|
|
3642
3755
|
const pastCanceled = updated.filter(
|
|
@@ -3660,13 +3773,13 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
|
|
|
3660
3773
|
if (archive.length > 0 || discard.length > 0) {
|
|
3661
3774
|
pullConditions.push({
|
|
3662
3775
|
dateStatus: {
|
|
3663
|
-
$in: [
|
|
3776
|
+
$in: [import_cluemart_shared29.EnumEventDateStatus.ENDED, import_cluemart_shared29.EnumEventDateStatus.INVALID]
|
|
3664
3777
|
}
|
|
3665
3778
|
});
|
|
3666
3779
|
}
|
|
3667
3780
|
for (const slot of pastCanceled) {
|
|
3668
3781
|
pullConditions.push({
|
|
3669
|
-
dateStatus:
|
|
3782
|
+
dateStatus: import_cluemart_shared29.EnumEventDateStatus.CANCELED,
|
|
3670
3783
|
startDate: slot.startDate,
|
|
3671
3784
|
startTime: slot.startTime
|
|
3672
3785
|
});
|
|
@@ -3708,9 +3821,9 @@ async function cleanEventInfoDates(now) {
|
|
|
3708
3821
|
try {
|
|
3709
3822
|
for await (const doc of cursor) {
|
|
3710
3823
|
const updated = doc.dateTime.map(
|
|
3711
|
-
(slot) => (0,
|
|
3824
|
+
(slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
|
|
3712
3825
|
);
|
|
3713
|
-
const kept = (0,
|
|
3826
|
+
const kept = (0, import_cluemart_shared29.filterDatesByFutureStatus)(updated);
|
|
3714
3827
|
if (kept.length === updated.length) {
|
|
3715
3828
|
continue;
|
|
3716
3829
|
}
|
|
@@ -3733,15 +3846,19 @@ async function cleanEventInfoDates(now) {
|
|
|
3733
3846
|
}
|
|
3734
3847
|
async function updateAllEventDateTimeStatuses() {
|
|
3735
3848
|
const now = (0, import_dayjs4.default)();
|
|
3736
|
-
const [eventCount, marketCount] = await Promise.all([
|
|
3849
|
+
const [eventCount, marketCount, aiMarketCount] = await Promise.all([
|
|
3737
3850
|
updateModelDateTimeStatuses(EventModel, now),
|
|
3738
3851
|
updateModelDateTimeStatuses(
|
|
3739
3852
|
GoogleImportedMarketModel,
|
|
3740
3853
|
now
|
|
3854
|
+
),
|
|
3855
|
+
updateModelDateTimeStatuses(
|
|
3856
|
+
AiImportedMarketModel,
|
|
3857
|
+
now
|
|
3741
3858
|
)
|
|
3742
3859
|
]);
|
|
3743
3860
|
console.log(
|
|
3744
|
-
`\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed`
|
|
3861
|
+
`\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed, ai imported markets=${aiMarketCount} changed`
|
|
3745
3862
|
);
|
|
3746
3863
|
const archivedCount = await archiveEndedAndDiscardInvalidEventDates(now);
|
|
3747
3864
|
if (archivedCount > 0) {
|
|
@@ -3756,7 +3873,7 @@ async function updateAllEventDateTimeStatuses() {
|
|
|
3756
3873
|
}
|
|
3757
3874
|
|
|
3758
3875
|
// src/service/index.ts
|
|
3759
|
-
var
|
|
3876
|
+
var import_cluemart_shared37 = require("@timardex/cluemart-shared");
|
|
3760
3877
|
|
|
3761
3878
|
// src/service/event/findEventOrImportedMarketById.ts
|
|
3762
3879
|
async function findEventOrImportedMarketById(resourceId) {
|
|
@@ -3764,15 +3881,16 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
3764
3881
|
return null;
|
|
3765
3882
|
}
|
|
3766
3883
|
const normalizedId = convertObjectIdsToStrings(resourceId);
|
|
3767
|
-
const [eventDoc, googleImportedDoc] = await Promise.all([
|
|
3884
|
+
const [eventDoc, googleImportedDoc, aiImportedDoc] = await Promise.all([
|
|
3768
3885
|
EventModel.findById(normalizedId).select("_id name dateTime owner").lean().exec(),
|
|
3769
|
-
GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
|
|
3886
|
+
GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
|
|
3887
|
+
AiImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
|
|
3770
3888
|
]);
|
|
3771
|
-
return eventDoc ?? googleImportedDoc;
|
|
3889
|
+
return eventDoc ?? googleImportedDoc ?? aiImportedDoc;
|
|
3772
3890
|
}
|
|
3773
3891
|
|
|
3774
3892
|
// src/service/relations.ts
|
|
3775
|
-
var
|
|
3893
|
+
var import_cluemart_shared30 = require("@timardex/cluemart-shared");
|
|
3776
3894
|
function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
3777
3895
|
if (!previousDateTime?.length) {
|
|
3778
3896
|
return false;
|
|
@@ -3788,8 +3906,8 @@ function didRemoveAnyStartedDates(previousDateTime, nextDateTime) {
|
|
|
3788
3906
|
return false;
|
|
3789
3907
|
}
|
|
3790
3908
|
return previousDateTime.some(
|
|
3791
|
-
(prev) => prev.dateStatus ===
|
|
3792
|
-
(next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus ===
|
|
3909
|
+
(prev) => prev.dateStatus === import_cluemart_shared30.EnumEventDateStatus.STARTED && !nextDateTime?.some(
|
|
3910
|
+
(next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared30.EnumEventDateStatus.STARTED
|
|
3793
3911
|
)
|
|
3794
3912
|
);
|
|
3795
3913
|
}
|
|
@@ -3800,7 +3918,7 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
|
|
|
3800
3918
|
) ?? false;
|
|
3801
3919
|
return {
|
|
3802
3920
|
...relationDate,
|
|
3803
|
-
status: existsInEvent ? relationDate.status :
|
|
3921
|
+
status: existsInEvent ? relationDate.status : import_cluemart_shared30.EnumInviteStatus.CANCELED
|
|
3804
3922
|
};
|
|
3805
3923
|
});
|
|
3806
3924
|
}
|
|
@@ -3809,15 +3927,15 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
|
|
|
3809
3927
|
var import_dayjs8 = __toESM(require("dayjs"));
|
|
3810
3928
|
|
|
3811
3929
|
// src/service/license/compliance/utils.ts
|
|
3812
|
-
var
|
|
3930
|
+
var import_cluemart_shared35 = require("@timardex/cluemart-shared");
|
|
3813
3931
|
var import_dayjs7 = __toESM(require("dayjs"));
|
|
3814
3932
|
|
|
3815
3933
|
// src/service/license/compliance/event.ts
|
|
3816
|
-
var
|
|
3934
|
+
var import_cluemart_shared31 = require("@timardex/cluemart-shared");
|
|
3817
3935
|
var eventLicences = [
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3936
|
+
import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
|
|
3937
|
+
import_cluemart_shared31.EnumUserLicence.PRO_EVENT,
|
|
3938
|
+
import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT
|
|
3821
3939
|
];
|
|
3822
3940
|
async function handleEventLicenceCompliance(user, now) {
|
|
3823
3941
|
if (!user.licences || !user.events?.length) {
|
|
@@ -4029,9 +4147,9 @@ function buildLicenceExpiryPipeline(params) {
|
|
|
4029
4147
|
}
|
|
4030
4148
|
|
|
4031
4149
|
// src/service/license/compliance/partner.ts
|
|
4032
|
-
var
|
|
4150
|
+
var import_cluemart_shared32 = require("@timardex/cluemart-shared");
|
|
4033
4151
|
var partnerLicences = [
|
|
4034
|
-
|
|
4152
|
+
import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER
|
|
4035
4153
|
];
|
|
4036
4154
|
async function handlePartnerLicenceCompliance(user, now) {
|
|
4037
4155
|
if (!user.licences || !user.partner) {
|
|
@@ -4041,11 +4159,11 @@ async function handlePartnerLicenceCompliance(user, now) {
|
|
|
4041
4159
|
}
|
|
4042
4160
|
|
|
4043
4161
|
// src/service/license/compliance/vendor.ts
|
|
4044
|
-
var
|
|
4162
|
+
var import_cluemart_shared34 = require("@timardex/cluemart-shared");
|
|
4045
4163
|
var import_dayjs6 = __toESM(require("dayjs"));
|
|
4046
4164
|
|
|
4047
4165
|
// src/service/license/models.ts
|
|
4048
|
-
var
|
|
4166
|
+
var import_cluemart_shared33 = require("@timardex/cluemart-shared");
|
|
4049
4167
|
var import_dayjs5 = __toESM(require("dayjs"));
|
|
4050
4168
|
var import_graphql = require("graphql");
|
|
4051
4169
|
var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
@@ -4057,31 +4175,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
|
|
|
4057
4175
|
return LicenceCategory2;
|
|
4058
4176
|
})(LicenceCategory || {});
|
|
4059
4177
|
var licenceCategoryMapping = {
|
|
4060
|
-
[
|
|
4061
|
-
[
|
|
4062
|
-
[
|
|
4063
|
-
[
|
|
4064
|
-
[
|
|
4065
|
-
[
|
|
4066
|
-
[
|
|
4067
|
-
[
|
|
4068
|
-
[
|
|
4178
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
|
|
4179
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
|
|
4180
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
|
|
4181
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
|
|
4182
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
|
|
4183
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
|
|
4184
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
|
|
4185
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
4186
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
|
|
4069
4187
|
};
|
|
4070
4188
|
var licencePriority = {
|
|
4071
|
-
[
|
|
4072
|
-
[
|
|
4073
|
-
[
|
|
4074
|
-
[
|
|
4075
|
-
[
|
|
4076
|
-
[
|
|
4077
|
-
[
|
|
4078
|
-
[
|
|
4079
|
-
[
|
|
4189
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_PLUS_EVENT]: 3,
|
|
4190
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_EVENT]: 2,
|
|
4191
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT]: 1,
|
|
4192
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
|
|
4193
|
+
[import_cluemart_shared33.EnumUserLicence.PRO_VENDOR]: 2,
|
|
4194
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR]: 1,
|
|
4195
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER]: 1,
|
|
4196
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE]: 1,
|
|
4197
|
+
[import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL]: 1
|
|
4080
4198
|
};
|
|
4081
4199
|
var standardLicences = [
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4200
|
+
import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR,
|
|
4201
|
+
import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT,
|
|
4202
|
+
import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER
|
|
4085
4203
|
];
|
|
4086
4204
|
var standardLicenceSet = new Set(standardLicences);
|
|
4087
4205
|
function isStandardLicence(licence) {
|
|
@@ -4095,11 +4213,11 @@ var categoryRegexMapping = {
|
|
|
4095
4213
|
["school" /* SCHOOL */]: /_school$/
|
|
4096
4214
|
};
|
|
4097
4215
|
var categoryFallbackLicence = {
|
|
4098
|
-
["event" /* EVENT */]:
|
|
4099
|
-
["partner" /* PARTNER */]:
|
|
4100
|
-
["vendor" /* VENDOR */]:
|
|
4101
|
-
["affiliate" /* AFFILIATE */]:
|
|
4102
|
-
["school" /* SCHOOL */]:
|
|
4216
|
+
["event" /* EVENT */]: import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT,
|
|
4217
|
+
["partner" /* PARTNER */]: import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER,
|
|
4218
|
+
["vendor" /* VENDOR */]: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR,
|
|
4219
|
+
["affiliate" /* AFFILIATE */]: import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE,
|
|
4220
|
+
["school" /* SCHOOL */]: import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL
|
|
4103
4221
|
};
|
|
4104
4222
|
var LicenceFilterInput = {
|
|
4105
4223
|
INPUT_USER_LICENCES: "$licences"
|
|
@@ -4129,11 +4247,11 @@ function getHighestLicenceForCategory(licences, category) {
|
|
|
4129
4247
|
function createLicenceObject(expiryDate, licenceType) {
|
|
4130
4248
|
const today = (0, import_dayjs5.default)();
|
|
4131
4249
|
const expiryDateMapping = {
|
|
4132
|
-
[
|
|
4133
|
-
[
|
|
4134
|
-
[
|
|
4135
|
-
[
|
|
4136
|
-
[
|
|
4250
|
+
[import_cluemart_shared33.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
|
|
4251
|
+
[import_cluemart_shared33.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
|
|
4252
|
+
[import_cluemart_shared33.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
|
|
4253
|
+
[import_cluemart_shared33.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
|
|
4254
|
+
[import_cluemart_shared33.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
|
|
4137
4255
|
};
|
|
4138
4256
|
const licenceObject = {
|
|
4139
4257
|
expiryDate: expiryDateMapping[expiryDate],
|
|
@@ -4237,13 +4355,13 @@ async function checkOwnerHasLicence({
|
|
|
4237
4355
|
const owner = await UserModel.findById(userId);
|
|
4238
4356
|
if (!owner) throw new import_graphql.GraphQLError("Owner not found");
|
|
4239
4357
|
const categoryByResource = {
|
|
4240
|
-
[
|
|
4241
|
-
[
|
|
4242
|
-
[
|
|
4243
|
-
[
|
|
4244
|
-
[
|
|
4358
|
+
[import_cluemart_shared33.EnumResourceType.EVENT]: "event" /* EVENT */,
|
|
4359
|
+
[import_cluemart_shared33.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
|
|
4360
|
+
[import_cluemart_shared33.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
|
|
4361
|
+
[import_cluemart_shared33.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
|
|
4362
|
+
[import_cluemart_shared33.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
|
|
4245
4363
|
};
|
|
4246
|
-
if (!(0,
|
|
4364
|
+
if (!(0, import_cluemart_shared33.isNonVisitorResourceType)(resourceType)) {
|
|
4247
4365
|
throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
|
|
4248
4366
|
}
|
|
4249
4367
|
const requiredCategory = categoryByResource[resourceType];
|
|
@@ -4323,7 +4441,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
|
|
|
4323
4441
|
return (result?.matchedCount ?? 0) > 0;
|
|
4324
4442
|
}
|
|
4325
4443
|
async function downgradeVendorProFeatures(userId, licenceType) {
|
|
4326
|
-
const isStandardVendor = licenceType ===
|
|
4444
|
+
const isStandardVendor = licenceType === import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR;
|
|
4327
4445
|
if (!isStandardVendor) {
|
|
4328
4446
|
return;
|
|
4329
4447
|
}
|
|
@@ -4370,7 +4488,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
|
|
|
4370
4488
|
return (result?.matchedCount ?? 0) > 0;
|
|
4371
4489
|
}
|
|
4372
4490
|
async function restoreVendorProFeatures(userId, licenceType) {
|
|
4373
|
-
const isProVendor = licenceType ===
|
|
4491
|
+
const isProVendor = licenceType === import_cluemart_shared34.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR;
|
|
4374
4492
|
if (!isProVendor) {
|
|
4375
4493
|
return;
|
|
4376
4494
|
}
|
|
@@ -4391,14 +4509,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
|
|
|
4391
4509
|
return false;
|
|
4392
4510
|
}
|
|
4393
4511
|
const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs6.default)(stripe.paymentGracePeriodEndsAt) : null;
|
|
4394
|
-
const hasActivePaymentGracePeriod = (stripe.status ===
|
|
4512
|
+
const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared34.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared34.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
|
|
4395
4513
|
if (hasActivePaymentGracePeriod) {
|
|
4396
4514
|
return true;
|
|
4397
4515
|
}
|
|
4398
4516
|
if (!stripe.subscriptionId) {
|
|
4399
4517
|
return false;
|
|
4400
4518
|
}
|
|
4401
|
-
if (stripe.status !==
|
|
4519
|
+
if (stripe.status !== import_cluemart_shared34.EnumSubscriptionStatus.ACTIVE) {
|
|
4402
4520
|
return false;
|
|
4403
4521
|
}
|
|
4404
4522
|
if (!stripe.endDate) {
|
|
@@ -4418,7 +4536,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4418
4536
|
return;
|
|
4419
4537
|
}
|
|
4420
4538
|
const proLicences = vendorLicencesOfUser.filter(
|
|
4421
|
-
(licence) => licence.licenceType !==
|
|
4539
|
+
(licence) => licence.licenceType !== import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
|
|
4422
4540
|
);
|
|
4423
4541
|
const expiredProLicences = proLicences.filter(
|
|
4424
4542
|
(licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now)
|
|
@@ -4431,7 +4549,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4431
4549
|
const expiredProLicence = expiredProLicences.some(
|
|
4432
4550
|
(licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
4433
4551
|
);
|
|
4434
|
-
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences,
|
|
4552
|
+
const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared34.vendorLicences, now);
|
|
4435
4553
|
const hasExpiredVendorLicence = vendorLicencesOfUser.some(
|
|
4436
4554
|
(licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
|
|
4437
4555
|
);
|
|
@@ -4447,7 +4565,7 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4447
4565
|
"owner.userId": user._id
|
|
4448
4566
|
}).lean().exec();
|
|
4449
4567
|
}
|
|
4450
|
-
const licencesToSync =
|
|
4568
|
+
const licencesToSync = import_cluemart_shared34.vendorLicences.filter(
|
|
4451
4569
|
(licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
|
|
4452
4570
|
);
|
|
4453
4571
|
await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
|
|
@@ -4462,11 +4580,11 @@ async function handleVendorLicenceCompliance(user, now) {
|
|
|
4462
4580
|
data: {
|
|
4463
4581
|
resourceId: String(vendor._id),
|
|
4464
4582
|
resourceName: vendor.name,
|
|
4465
|
-
resourceType:
|
|
4583
|
+
resourceType: import_cluemart_shared34.EnumNotificationResourceType.DOWNGRADED_VENDOR
|
|
4466
4584
|
},
|
|
4467
4585
|
message: `Your Vendor licence has been downgraded due to licence expiration.`,
|
|
4468
4586
|
title: `Vendor Licence Downgraded`,
|
|
4469
|
-
type:
|
|
4587
|
+
type: import_cluemart_shared34.EnumNotificationType.SYSTEM,
|
|
4470
4588
|
userIds: [user._id]
|
|
4471
4589
|
};
|
|
4472
4590
|
await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
|
|
@@ -4499,7 +4617,7 @@ async function vendorOwnerHasProLicence(vendorId) {
|
|
|
4499
4617
|
effectiveVendorLicences,
|
|
4500
4618
|
"vendor" /* VENDOR */
|
|
4501
4619
|
);
|
|
4502
|
-
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[
|
|
4620
|
+
return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared34.EnumUserLicence.PRO_VENDOR];
|
|
4503
4621
|
}
|
|
4504
4622
|
|
|
4505
4623
|
// src/service/license/compliance/utils.ts
|
|
@@ -4509,12 +4627,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
|
|
|
4509
4627
|
const pipeline = buildLicenceExpiryPipeline({
|
|
4510
4628
|
downgradeBranches: [
|
|
4511
4629
|
{
|
|
4512
|
-
case:
|
|
4513
|
-
then:
|
|
4630
|
+
case: import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR,
|
|
4631
|
+
then: import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
|
|
4514
4632
|
},
|
|
4515
4633
|
{
|
|
4516
|
-
case:
|
|
4517
|
-
then:
|
|
4634
|
+
case: import_cluemart_shared35.EnumUserLicence.PRO_VENDOR,
|
|
4635
|
+
then: import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
|
|
4518
4636
|
}
|
|
4519
4637
|
],
|
|
4520
4638
|
licenceTypes,
|
|
@@ -4643,7 +4761,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
|
|
|
4643
4761
|
var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
4644
4762
|
|
|
4645
4763
|
// src/service/license/reminder/utils.ts
|
|
4646
|
-
var
|
|
4764
|
+
var import_cluemart_shared36 = require("@timardex/cluemart-shared");
|
|
4647
4765
|
var import_utils8 = require("@timardex/cluemart-shared/utils");
|
|
4648
4766
|
var import_dayjs9 = __toESM(require("dayjs"));
|
|
4649
4767
|
|
|
@@ -4709,28 +4827,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
|
|
|
4709
4827
|
return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
|
|
4710
4828
|
}
|
|
4711
4829
|
function getLicenseName(licenceType) {
|
|
4712
|
-
return
|
|
4830
|
+
return import_cluemart_shared36.licenseNiceNames[licenceType] || licenceType;
|
|
4713
4831
|
}
|
|
4714
4832
|
function getNotificationTypes(isVendorLicense, isPartnerLicense) {
|
|
4715
4833
|
if (isVendorLicense) {
|
|
4716
4834
|
return {
|
|
4717
|
-
notificationType:
|
|
4718
|
-
resourceType:
|
|
4835
|
+
notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
|
|
4836
|
+
resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
|
|
4719
4837
|
};
|
|
4720
4838
|
}
|
|
4721
4839
|
if (isPartnerLicense) {
|
|
4722
4840
|
return {
|
|
4723
|
-
notificationType:
|
|
4724
|
-
resourceType:
|
|
4841
|
+
notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
|
|
4842
|
+
resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
|
|
4725
4843
|
};
|
|
4726
4844
|
}
|
|
4727
4845
|
return {
|
|
4728
|
-
notificationType:
|
|
4729
|
-
resourceType:
|
|
4846
|
+
notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
|
|
4847
|
+
resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
|
|
4730
4848
|
};
|
|
4731
4849
|
}
|
|
4732
4850
|
async function getLicenseResourceInfo(user, licence) {
|
|
4733
|
-
const isVendorLicense =
|
|
4851
|
+
const isVendorLicense = import_cluemart_shared36.vendorLicences.includes(licence.licenceType);
|
|
4734
4852
|
const isPartnerLicense = partnerLicences.includes(licence.licenceType);
|
|
4735
4853
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4736
4854
|
const { notificationType, resourceType } = getNotificationTypes(
|
|
@@ -4778,11 +4896,11 @@ async function getLicenseResourceInfo(user, licence) {
|
|
|
4778
4896
|
};
|
|
4779
4897
|
}
|
|
4780
4898
|
function getLicenceExpiryMode(licenceType) {
|
|
4781
|
-
return licenceType ===
|
|
4899
|
+
return licenceType === import_cluemart_shared36.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared36.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
|
|
4782
4900
|
}
|
|
4783
4901
|
async function sendLicenseReminder(user, licence) {
|
|
4784
4902
|
const licenceName = getLicenseName(licence.licenceType);
|
|
4785
|
-
const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(
|
|
4903
|
+
const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared36.dateFormat);
|
|
4786
4904
|
const userId = String(user._id);
|
|
4787
4905
|
const resourceInfo = await getLicenseResourceInfo(user, licence);
|
|
4788
4906
|
if (!resourceInfo) {
|
|
@@ -4916,6 +5034,7 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4916
5034
|
AdModel,
|
|
4917
5035
|
AdPurchaseModel,
|
|
4918
5036
|
AffiliateModel,
|
|
5037
|
+
AiImportedMarketModel,
|
|
4919
5038
|
AppSettingModel,
|
|
4920
5039
|
AuthHandoffTokenModel,
|
|
4921
5040
|
BILLING_CATALOG_COLLECTION_NAME,
|
|
@@ -4947,6 +5066,7 @@ async function remindUsersAboutLicenseExpiration() {
|
|
|
4947
5066
|
ResourceImageTypeSchema,
|
|
4948
5067
|
SUBSCRIPTION_REWARD_TIMEZONE,
|
|
4949
5068
|
SchoolModel,
|
|
5069
|
+
ScrapeSiteModel,
|
|
4950
5070
|
SocialMediaTypeSchema,
|
|
4951
5071
|
StallTypeSchema,
|
|
4952
5072
|
UnregisteredVendorModel,
|