@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.
@@ -97,7 +97,7 @@ __export(service_exports, {
97
97
  updateAdStatuses: () => updateAdStatuses,
98
98
  updateAllEventDateTimeStatuses: () => updateAllEventDateTimeStatuses,
99
99
  updateRelationDatesToCanceled: () => updateRelationDatesToCanceled,
100
- updateSingleDateTimeStatus: () => import_cluemart_shared36.updateSingleDateTimeStatus,
100
+ updateSingleDateTimeStatus: () => import_cluemart_shared37.updateSingleDateTimeStatus,
101
101
  upgradeUserToLicence: () => upgradeUserToLicence,
102
102
  vendorOwnerHasProLicence: () => vendorOwnerHasProLicence
103
103
  });
@@ -1004,15 +1004,15 @@ function syncSearchNameInUpdate(update) {
1004
1004
  }
1005
1005
  return null;
1006
1006
  }
1007
- function searchNamePlugin(schema26) {
1008
- schema26.add({ searchName: { default: "", required: false, type: String } });
1009
- schema26.index({ searchName: 1 });
1010
- schema26.pre("save", function syncSearchNameOnSave(next) {
1007
+ function searchNamePlugin(schema28) {
1008
+ schema28.add({ searchName: { default: "", required: false, type: String } });
1009
+ schema28.index({ searchName: 1 });
1010
+ schema28.pre("save", function syncSearchNameOnSave(next) {
1011
1011
  const doc = this;
1012
1012
  doc.searchName = deriveSearchName(doc.name);
1013
1013
  next();
1014
1014
  });
1015
- schema26.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
1015
+ schema28.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
1016
1016
  const list = Array.isArray(docs) ? docs : [docs];
1017
1017
  for (const doc of list) {
1018
1018
  if (doc && typeof doc.name === "string") {
@@ -1021,7 +1021,7 @@ function searchNamePlugin(schema26) {
1021
1021
  }
1022
1022
  next();
1023
1023
  });
1024
- schema26.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
1024
+ schema28.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
1025
1025
  for (const op of ops) {
1026
1026
  const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
1027
1027
  if (doc && typeof doc.name === "string") {
@@ -1047,7 +1047,7 @@ function searchNamePlugin(schema26) {
1047
1047
  }
1048
1048
  next();
1049
1049
  };
1050
- schema26.pre(
1050
+ schema28.pre(
1051
1051
  ["findOneAndUpdate", "updateOne", "updateMany"],
1052
1052
  syncSearchNameOnUpdate
1053
1053
  );
@@ -1131,23 +1131,134 @@ schema7.index({ description: "text", name: "text" });
1131
1131
  schema7.plugin(searchNamePlugin);
1132
1132
  var GoogleImportedMarketModel = import_mongoose10.default.models.GoogleImportedMarket || import_mongoose10.default.model("GoogleImportedMarket", schema7);
1133
1133
 
1134
- // src/mongoose/Notification.ts
1134
+ // src/mongoose/AiImportedMarket.ts
1135
1135
  var import_cluemart_shared10 = require("@timardex/cluemart-shared");
1136
1136
  var import_mongoose11 = __toESM(require("mongoose"));
1137
1137
  var MongooseSchema7 = import_mongoose11.default.Schema;
1138
- var notificationDataSchema = new MongooseSchema7(
1138
+ var addressComponentSchema2 = new MongooseSchema7(
1139
+ {
1140
+ longName: { required: false, type: String },
1141
+ shortName: { required: false, type: String },
1142
+ types: { required: false, type: [String] }
1143
+ },
1144
+ { _id: false }
1145
+ );
1146
+ var schema8 = new MongooseSchema7(
1147
+ {
1148
+ active: { default: false, required: true, type: Boolean },
1149
+ address: { required: true, type: String },
1150
+ addressComponents: { required: false, type: [addressComponentSchema2] },
1151
+ approvedAt: { default: null, required: false, type: Date },
1152
+ claimed: { default: false, required: true, type: Boolean },
1153
+ claimedAt: { default: null, required: false, type: Date },
1154
+ claimedByUserId: {
1155
+ ref: "User",
1156
+ required: false,
1157
+ type: import_mongoose11.default.Schema.Types.ObjectId
1158
+ },
1159
+ cover: {
1160
+ required: false,
1161
+ type: ResourceImageTypeSchema
1162
+ },
1163
+ dateTime: [dateTimeSchema],
1164
+ deletedAt: { default: null, required: false, type: Date },
1165
+ description: { required: true, type: String },
1166
+ eventId: {
1167
+ ref: "Event",
1168
+ required: false,
1169
+ type: import_mongoose11.default.Schema.Types.ObjectId
1170
+ },
1171
+ eventType: {
1172
+ enum: Object.values(import_cluemart_shared10.EnumEventType),
1173
+ required: true,
1174
+ type: String
1175
+ },
1176
+ images: { required: false, type: [ResourceImageTypeSchema] },
1177
+ location: {
1178
+ required: true,
1179
+ type: locationsSchema
1180
+ },
1181
+ logo: { required: false, type: ResourceImageTypeSchema },
1182
+ name: { required: true, type: String },
1183
+ openingHours: { required: false, type: [String] },
1184
+ rainOrShine: { required: true, type: Boolean },
1185
+ rating: { required: false, type: Number },
1186
+ region: { required: false, type: String },
1187
+ rejectReason: { required: false, type: String },
1188
+ reviewCount: { required: false, type: Number },
1189
+ reviewedAt: { default: null, required: false, type: Date },
1190
+ reviewedByUserId: {
1191
+ ref: "User",
1192
+ required: false,
1193
+ type: import_mongoose11.default.Schema.Types.ObjectId
1194
+ },
1195
+ reviewStatus: {
1196
+ default: import_cluemart_shared10.EnumImportedMarketReviewStatus.PENDING,
1197
+ enum: Object.values(import_cluemart_shared10.EnumImportedMarketReviewStatus),
1198
+ required: true,
1199
+ type: String
1200
+ },
1201
+ scrapedAt: { default: () => /* @__PURE__ */ new Date(), required: true, type: Date },
1202
+ slug: { required: true, type: String },
1203
+ sourceKey: {
1204
+ required: true,
1205
+ type: String,
1206
+ unique: true
1207
+ // unique, indexed
1208
+ },
1209
+ sourceName: { required: true, type: String },
1210
+ sourceUrl: { required: true, type: String },
1211
+ website: { required: false, type: String }
1212
+ },
1213
+ { timestamps: true }
1214
+ );
1215
+ schema8.index({ "location.geo": "2dsphere" });
1216
+ schema8.index({ name: 1 });
1217
+ schema8.index({ region: 1 });
1218
+ schema8.index({ deletedAt: 1 });
1219
+ schema8.index({ "dateTime.dateStatus": 1 });
1220
+ schema8.index({ slug: 1 });
1221
+ schema8.index({ reviewStatus: 1 });
1222
+ schema8.index({ description: "text", name: "text" });
1223
+ schema8.plugin(searchNamePlugin);
1224
+ var AiImportedMarketModel = import_mongoose11.default.models.AiImportedMarket || import_mongoose11.default.model("AiImportedMarket", schema8);
1225
+
1226
+ // src/mongoose/ScrapeSite.ts
1227
+ var import_mongoose12 = __toESM(require("mongoose"));
1228
+ var MongooseSchema8 = import_mongoose12.default.Schema;
1229
+ var schema9 = new MongooseSchema8(
1230
+ {
1231
+ enabled: { default: true, required: true, type: Boolean },
1232
+ lastError: { required: false, type: String },
1233
+ lastScrapedAt: { required: false, type: Date },
1234
+ lastScrapeStatus: { required: false, type: String },
1235
+ name: { required: true, type: String },
1236
+ regionHint: { required: false, type: String },
1237
+ url: { required: true, type: String }
1238
+ },
1239
+ { timestamps: true }
1240
+ );
1241
+ schema9.index({ url: 1 }, { unique: true });
1242
+ schema9.index({ enabled: 1 });
1243
+ var ScrapeSiteModel = import_mongoose12.default.models.ScrapeSite || import_mongoose12.default.model("ScrapeSite", schema9);
1244
+
1245
+ // src/mongoose/Notification.ts
1246
+ var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1247
+ var import_mongoose13 = __toESM(require("mongoose"));
1248
+ var MongooseSchema9 = import_mongoose13.default.Schema;
1249
+ var notificationDataSchema = new MongooseSchema9(
1139
1250
  {
1140
1251
  resourceId: { required: true, type: String },
1141
1252
  resourceName: { required: true, type: String },
1142
1253
  resourceType: {
1143
- enum: Object.values(import_cluemart_shared10.EnumNotificationResourceType),
1254
+ enum: Object.values(import_cluemart_shared11.EnumNotificationResourceType),
1144
1255
  required: true,
1145
1256
  type: String
1146
1257
  }
1147
1258
  },
1148
1259
  { _id: false }
1149
1260
  );
1150
- var schema8 = new MongooseSchema7(
1261
+ var schema10 = new MongooseSchema9(
1151
1262
  {
1152
1263
  data: {
1153
1264
  default: null,
@@ -1158,28 +1269,28 @@ var schema8 = new MongooseSchema7(
1158
1269
  message: { required: true, type: String },
1159
1270
  title: { required: true, type: String },
1160
1271
  type: {
1161
- default: import_cluemart_shared10.EnumNotificationType.SYSTEM,
1162
- enum: Object.values(import_cluemart_shared10.EnumNotificationType),
1272
+ default: import_cluemart_shared11.EnumNotificationType.SYSTEM,
1273
+ enum: Object.values(import_cluemart_shared11.EnumNotificationType),
1163
1274
  required: true,
1164
1275
  type: String
1165
1276
  },
1166
1277
  userId: {
1167
1278
  ref: "User",
1168
1279
  required: true,
1169
- type: import_mongoose11.default.Schema.Types.ObjectId
1280
+ type: import_mongoose13.default.Schema.Types.ObjectId
1170
1281
  }
1171
1282
  },
1172
1283
  { timestamps: true }
1173
1284
  );
1174
- schema8.index({ isRead: 1, userId: 1 });
1175
- schema8.index({ createdAt: -1, userId: 1 });
1176
- var NotificationModel = import_mongoose11.default.models.Notification || import_mongoose11.default.model("Notification", schema8);
1285
+ schema10.index({ isRead: 1, userId: 1 });
1286
+ schema10.index({ createdAt: -1, userId: 1 });
1287
+ var NotificationModel = import_mongoose13.default.models.Notification || import_mongoose13.default.model("Notification", schema10);
1177
1288
 
1178
1289
  // src/mongoose/PushToken.ts
1179
1290
  var import_enums = require("@timardex/cluemart-shared/enums");
1180
- var import_mongoose12 = __toESM(require("mongoose"));
1181
- var MongooseSchema8 = import_mongoose12.default.Schema;
1182
- var schema9 = new MongooseSchema8(
1291
+ var import_mongoose14 = __toESM(require("mongoose"));
1292
+ var MongooseSchema10 = import_mongoose14.default.Schema;
1293
+ var schema11 = new MongooseSchema10(
1183
1294
  {
1184
1295
  platform: {
1185
1296
  enum: Object.values(import_enums.EnumOSPlatform),
@@ -1190,22 +1301,22 @@ var schema9 = new MongooseSchema8(
1190
1301
  userId: {
1191
1302
  ref: "User",
1192
1303
  required: true,
1193
- type: import_mongoose12.default.Schema.Types.ObjectId
1304
+ type: import_mongoose14.default.Schema.Types.ObjectId
1194
1305
  }
1195
1306
  },
1196
1307
  { timestamps: true }
1197
1308
  );
1198
- var PushTokenModel = import_mongoose12.default.models.PushToken || import_mongoose12.default.model("PushToken", schema9);
1309
+ var PushTokenModel = import_mongoose14.default.models.PushToken || import_mongoose14.default.model("PushToken", schema11);
1199
1310
 
1200
1311
  // src/mongoose/Relation.ts
1201
- var import_cluemart_shared12 = require("@timardex/cluemart-shared");
1202
- var import_mongoose14 = __toESM(require("mongoose"));
1312
+ var import_cluemart_shared13 = require("@timardex/cluemart-shared");
1313
+ var import_mongoose16 = __toESM(require("mongoose"));
1203
1314
 
1204
1315
  // src/mongoose/event/EventInfo.ts
1205
- var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1206
- var import_mongoose13 = __toESM(require("mongoose"));
1207
- var MongooseSchema9 = import_mongoose13.default.Schema;
1208
- var StallTypeSchema = new MongooseSchema9(
1316
+ var import_cluemart_shared12 = require("@timardex/cluemart-shared");
1317
+ var import_mongoose15 = __toESM(require("mongoose"));
1318
+ var MongooseSchema11 = import_mongoose15.default.Schema;
1319
+ var StallTypeSchema = new MongooseSchema11(
1209
1320
  {
1210
1321
  label: { required: false, type: String },
1211
1322
  price: { required: false, type: Number },
@@ -1216,10 +1327,10 @@ var StallTypeSchema = new MongooseSchema9(
1216
1327
  // Prevents Mongoose from creating an additional _id field for subdocuments
1217
1328
  }
1218
1329
  );
1219
- var dateTimeSchema2 = new MongooseSchema9(
1330
+ var dateTimeSchema2 = new MongooseSchema11(
1220
1331
  {
1221
1332
  dateStatus: {
1222
- enum: Object.values(import_cluemart_shared11.EnumEventDateStatus),
1333
+ enum: Object.values(import_cluemart_shared12.EnumEventDateStatus),
1223
1334
  required: false,
1224
1335
  type: String
1225
1336
  },
@@ -1232,13 +1343,13 @@ var dateTimeSchema2 = new MongooseSchema9(
1232
1343
  { _id: false }
1233
1344
  // Prevents Mongoose from creating an additional _id field for subdocuments
1234
1345
  );
1235
- var paymentInfoSchema = new MongooseSchema9(
1346
+ var paymentInfoSchema = new MongooseSchema11(
1236
1347
  {
1237
1348
  accountHolderName: { required: false, type: String },
1238
1349
  accountNumber: { required: false, type: String },
1239
1350
  link: { required: false, type: String },
1240
1351
  paymentMethod: {
1241
- enum: Object.values(import_cluemart_shared11.EnumPaymentMethod),
1352
+ enum: Object.values(import_cluemart_shared12.EnumPaymentMethod),
1242
1353
  required: true,
1243
1354
  type: String
1244
1355
  }
@@ -1246,7 +1357,7 @@ var paymentInfoSchema = new MongooseSchema9(
1246
1357
  { _id: false }
1247
1358
  // Prevents Mongoose from creating an additional _id field
1248
1359
  );
1249
- var requirementsSchema = new MongooseSchema9(
1360
+ var requirementsSchema = new MongooseSchema11(
1250
1361
  {
1251
1362
  category: { required: true, type: String },
1252
1363
  label: { required: true, type: String },
@@ -1257,7 +1368,7 @@ var requirementsSchema = new MongooseSchema9(
1257
1368
  // Prevents Mongoose from creating an additional _id field for
1258
1369
  }
1259
1370
  );
1260
- var refundPolicySchema = new MongooseSchema9(
1371
+ var refundPolicySchema = new MongooseSchema11(
1261
1372
  {
1262
1373
  category: { required: true, type: String },
1263
1374
  label: { required: true, type: String },
@@ -1265,7 +1376,7 @@ var refundPolicySchema = new MongooseSchema9(
1265
1376
  },
1266
1377
  { _id: false }
1267
1378
  );
1268
- var schema10 = new MongooseSchema9(
1379
+ var schema12 = new MongooseSchema11(
1269
1380
  {
1270
1381
  active: { default: true, type: Boolean },
1271
1382
  applicationDeadlineHours: { required: true, type: Number },
@@ -1273,7 +1384,7 @@ var schema10 = new MongooseSchema9(
1273
1384
  eventId: {
1274
1385
  ref: "Event",
1275
1386
  required: true,
1276
- type: import_mongoose13.default.Schema.Types.ObjectId
1387
+ type: import_mongoose15.default.Schema.Types.ObjectId
1277
1388
  },
1278
1389
  packInTime: { required: true, type: Number },
1279
1390
  paymentDueHours: { required: true, type: Number },
@@ -1283,15 +1394,15 @@ var schema10 = new MongooseSchema9(
1283
1394
  },
1284
1395
  { timestamps: true }
1285
1396
  );
1286
- schema10.index({ eventId: 1 });
1287
- var EventInfoModel = import_mongoose13.default.models.EventInfo || import_mongoose13.default.model("EventInfo", schema10);
1397
+ schema12.index({ eventId: 1 });
1398
+ var EventInfoModel = import_mongoose15.default.models.EventInfo || import_mongoose15.default.model("EventInfo", schema12);
1288
1399
 
1289
1400
  // src/mongoose/Relation.ts
1290
- var MongooseSchema10 = import_mongoose14.default.Schema;
1291
- var relationDateTimeSchema = new MongooseSchema10(
1401
+ var MongooseSchema12 = import_mongoose16.default.Schema;
1402
+ var relationDateTimeSchema = new MongooseSchema12(
1292
1403
  {
1293
1404
  dateStatus: {
1294
- enum: Object.values(import_cluemart_shared12.EnumEventDateStatus),
1405
+ enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
1295
1406
  required: true,
1296
1407
  type: String
1297
1408
  },
@@ -1303,7 +1414,7 @@ var relationDateTimeSchema = new MongooseSchema10(
1303
1414
  },
1304
1415
  { _id: false }
1305
1416
  );
1306
- var relationDatesSchema = new MongooseSchema10(
1417
+ var relationDatesSchema = new MongooseSchema12(
1307
1418
  {
1308
1419
  dateTime: {
1309
1420
  required: true,
@@ -1315,42 +1426,42 @@ var relationDatesSchema = new MongooseSchema10(
1315
1426
  },
1316
1427
  paymentReference: { required: false, type: String },
1317
1428
  status: {
1318
- enum: Object.values(import_cluemart_shared12.EnumInviteStatus),
1429
+ enum: Object.values(import_cluemart_shared13.EnumInviteStatus),
1319
1430
  required: false,
1320
1431
  type: String
1321
1432
  }
1322
1433
  },
1323
1434
  { _id: false }
1324
1435
  );
1325
- var RelationTypeSchema = new MongooseSchema10(
1436
+ var RelationTypeSchema = new MongooseSchema12(
1326
1437
  {
1327
1438
  active: { default: true, required: true, type: Boolean },
1328
1439
  chatId: {
1329
1440
  ref: "Chat",
1330
1441
  required: true,
1331
- type: import_mongoose14.default.Schema.Types.ObjectId
1442
+ type: import_mongoose16.default.Schema.Types.ObjectId
1332
1443
  },
1333
1444
  deletedAt: { default: null, required: false, type: Date },
1334
1445
  eventId: {
1335
1446
  ref: "Event",
1336
1447
  required: true,
1337
- type: import_mongoose14.default.Schema.Types.ObjectId
1448
+ type: import_mongoose16.default.Schema.Types.ObjectId
1338
1449
  },
1339
1450
  lastUpdateBy: {
1340
- enum: Object.values(import_cluemart_shared12.EnumResourceType),
1451
+ enum: Object.values(import_cluemart_shared13.EnumResourceType),
1341
1452
  required: true,
1342
1453
  type: String
1343
1454
  },
1344
1455
  relationDates: [relationDatesSchema],
1345
1456
  relationType: {
1346
- enum: Object.values(import_cluemart_shared12.EnumRelationResource),
1457
+ enum: Object.values(import_cluemart_shared13.EnumRelationResource),
1347
1458
  required: true,
1348
1459
  type: String
1349
1460
  },
1350
1461
  vendorId: {
1351
1462
  ref: "Vendor",
1352
1463
  required: true,
1353
- type: import_mongoose14.default.Schema.Types.ObjectId
1464
+ type: import_mongoose16.default.Schema.Types.ObjectId
1354
1465
  }
1355
1466
  },
1356
1467
  { timestamps: true }
@@ -1362,21 +1473,21 @@ RelationTypeSchema.index({
1362
1473
  "relationDates.status": 1,
1363
1474
  vendorId: 1
1364
1475
  });
1365
- var RelationModel = import_mongoose14.default.models.Relation || import_mongoose14.default.model("Relation", RelationTypeSchema);
1476
+ var RelationModel = import_mongoose16.default.models.Relation || import_mongoose16.default.model("Relation", RelationTypeSchema);
1366
1477
 
1367
1478
  // src/mongoose/ResourceActivity.ts
1368
- var import_cluemart_shared13 = require("@timardex/cluemart-shared");
1369
- var import_mongoose15 = __toESM(require("mongoose"));
1370
- var MongooseSchema11 = import_mongoose15.default.Schema;
1371
- var ActivitySchema = new MongooseSchema11(
1479
+ var import_cluemart_shared14 = require("@timardex/cluemart-shared");
1480
+ var import_mongoose17 = __toESM(require("mongoose"));
1481
+ var MongooseSchema13 = import_mongoose17.default.Schema;
1482
+ var ActivitySchema = new MongooseSchema13(
1372
1483
  {
1373
1484
  activityType: {
1374
- enum: Object.values(import_cluemart_shared13.EnumActivity),
1485
+ enum: Object.values(import_cluemart_shared14.EnumActivity),
1375
1486
  required: true,
1376
1487
  type: String
1377
1488
  },
1378
1489
  dateStatus: {
1379
- enum: Object.values(import_cluemart_shared13.EnumEventDateStatus),
1490
+ enum: Object.values(import_cluemart_shared14.EnumEventDateStatus),
1380
1491
  required: false,
1381
1492
  type: String
1382
1493
  },
@@ -1388,7 +1499,7 @@ var ActivitySchema = new MongooseSchema11(
1388
1499
  startTime: { required: false, type: String },
1389
1500
  timestamp: { default: Date.now, type: Date },
1390
1501
  userAgent: {
1391
- enum: Object.values(import_cluemart_shared13.EnumOSPlatform),
1502
+ enum: Object.values(import_cluemart_shared14.EnumOSPlatform),
1392
1503
  required: true,
1393
1504
  type: String
1394
1505
  },
@@ -1396,61 +1507,61 @@ var ActivitySchema = new MongooseSchema11(
1396
1507
  },
1397
1508
  { _id: false }
1398
1509
  );
1399
- var schema11 = new MongooseSchema11(
1510
+ var schema13 = new MongooseSchema13(
1400
1511
  {
1401
1512
  activity: { default: [], type: [ActivitySchema] },
1402
1513
  resourceId: { required: true, type: String },
1403
1514
  resourceType: {
1404
- enum: Object.values(import_cluemart_shared13.EnumResourceType),
1515
+ enum: Object.values(import_cluemart_shared14.EnumResourceType),
1405
1516
  required: true,
1406
1517
  type: String
1407
1518
  }
1408
1519
  },
1409
1520
  { timestamps: true }
1410
1521
  );
1411
- schema11.index({ resourceId: 1, resourceType: 1 }, { unique: true });
1412
- schema11.index({ "views.location": "2dsphere" });
1413
- var ResourceActivityModel = import_mongoose15.default.models.ResourceActivity || import_mongoose15.default.model("ResourceActivity", schema11);
1522
+ schema13.index({ resourceId: 1, resourceType: 1 }, { unique: true });
1523
+ schema13.index({ "views.location": "2dsphere" });
1524
+ var ResourceActivityModel = import_mongoose17.default.models.ResourceActivity || import_mongoose17.default.model("ResourceActivity", schema13);
1414
1525
 
1415
1526
  // src/mongoose/User.ts
1416
- var import_cluemart_shared14 = require("@timardex/cluemart-shared");
1417
- var import_mongoose16 = __toESM(require("mongoose"));
1418
- var MongooseSchema12 = import_mongoose16.default.Schema;
1419
- var userActivityEventSchema = new MongooseSchema12(
1527
+ var import_cluemart_shared15 = require("@timardex/cluemart-shared");
1528
+ var import_mongoose18 = __toESM(require("mongoose"));
1529
+ var MongooseSchema14 = import_mongoose18.default.Schema;
1530
+ var userActivityEventSchema = new MongooseSchema14(
1420
1531
  {
1421
1532
  dateTime: dateTimeSchema,
1422
1533
  resourceId: {
1423
1534
  ref: "Event",
1424
1535
  required: false,
1425
- type: import_mongoose16.default.Schema.Types.ObjectId
1536
+ type: import_mongoose18.default.Schema.Types.ObjectId
1426
1537
  }
1427
1538
  },
1428
1539
  { _id: false }
1429
1540
  );
1430
- var userActivityFavouritesSchema = new MongooseSchema12(
1541
+ var userActivityFavouritesSchema = new MongooseSchema14(
1431
1542
  {
1432
1543
  events: {
1433
1544
  ref: "Event",
1434
1545
  required: false,
1435
- type: [import_mongoose16.default.Schema.Types.ObjectId]
1546
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1436
1547
  },
1437
1548
  partners: {
1438
1549
  ref: "Partner",
1439
1550
  required: false,
1440
- type: [import_mongoose16.default.Schema.Types.ObjectId]
1551
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1441
1552
  },
1442
1553
  vendors: {
1443
1554
  ref: "Vendor",
1444
1555
  required: false,
1445
- type: [import_mongoose16.default.Schema.Types.ObjectId]
1556
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1446
1557
  }
1447
1558
  },
1448
1559
  { _id: false }
1449
1560
  );
1450
- var stripeSchema = new MongooseSchema12(
1561
+ var stripeSchema = new MongooseSchema14(
1451
1562
  {
1452
1563
  billingPeriod: {
1453
- enum: Object.values(import_cluemart_shared14.EnumBillingPeriod),
1564
+ enum: Object.values(import_cluemart_shared15.EnumBillingPeriod),
1454
1565
  required: false,
1455
1566
  type: String
1456
1567
  },
@@ -1459,7 +1570,7 @@ var stripeSchema = new MongooseSchema12(
1459
1570
  type: Boolean
1460
1571
  },
1461
1572
  currentPlan: {
1462
- enum: Object.values(import_cluemart_shared14.EnumUserLicence),
1573
+ enum: Object.values(import_cluemart_shared15.EnumUserLicence),
1463
1574
  required: false,
1464
1575
  type: String
1465
1576
  },
@@ -1484,7 +1595,7 @@ var stripeSchema = new MongooseSchema12(
1484
1595
  type: String
1485
1596
  },
1486
1597
  pendingBillingPeriod: {
1487
- enum: Object.values(import_cluemart_shared14.EnumBillingPeriod),
1598
+ enum: Object.values(import_cluemart_shared15.EnumBillingPeriod),
1488
1599
  required: false,
1489
1600
  type: String
1490
1601
  },
@@ -1493,7 +1604,7 @@ var stripeSchema = new MongooseSchema12(
1493
1604
  type: Date
1494
1605
  },
1495
1606
  pendingPlan: {
1496
- enum: Object.values(import_cluemart_shared14.EnumUserLicence),
1607
+ enum: Object.values(import_cluemart_shared15.EnumUserLicence),
1497
1608
  required: false,
1498
1609
  type: String
1499
1610
  },
@@ -1510,7 +1621,7 @@ var stripeSchema = new MongooseSchema12(
1510
1621
  type: Date
1511
1622
  },
1512
1623
  status: {
1513
- enum: Object.values(import_cluemart_shared14.EnumSubscriptionStatus),
1624
+ enum: Object.values(import_cluemart_shared15.EnumSubscriptionStatus),
1514
1625
  required: false,
1515
1626
  type: String
1516
1627
  },
@@ -1529,10 +1640,10 @@ var stripeSchema = new MongooseSchema12(
1529
1640
  },
1530
1641
  { _id: false }
1531
1642
  );
1532
- var redeemedRewardSchema = new MongooseSchema12(
1643
+ var redeemedRewardSchema = new MongooseSchema14(
1533
1644
  {
1534
1645
  name: {
1535
- enum: Object.values(import_cluemart_shared14.EnumReward),
1646
+ enum: Object.values(import_cluemart_shared15.EnumReward),
1536
1647
  required: true,
1537
1648
  type: String
1538
1649
  },
@@ -1541,12 +1652,12 @@ var redeemedRewardSchema = new MongooseSchema12(
1541
1652
  },
1542
1653
  { _id: false }
1543
1654
  );
1544
- var userOverallPointsSchema = new MongooseSchema12(
1655
+ var userOverallPointsSchema = new MongooseSchema14(
1545
1656
  {
1546
1657
  createdAt: { required: true, type: Date },
1547
1658
  points: { default: 0, required: true, type: Number },
1548
1659
  pointType: {
1549
- enum: Object.values(import_cluemart_shared14.EnumPointType),
1660
+ enum: Object.values(import_cluemart_shared15.EnumPointType),
1550
1661
  required: true,
1551
1662
  type: String
1552
1663
  },
@@ -1554,13 +1665,13 @@ var userOverallPointsSchema = new MongooseSchema12(
1554
1665
  },
1555
1666
  { _id: false }
1556
1667
  );
1557
- var schema12 = new MongooseSchema12(
1668
+ var schema14 = new MongooseSchema14(
1558
1669
  {
1559
1670
  active: { default: false, required: true, type: Boolean },
1560
1671
  affiliate: {
1561
1672
  ref: "Affiliate",
1562
1673
  required: false,
1563
- type: import_mongoose16.default.Schema.Types.ObjectId
1674
+ type: import_mongoose18.default.Schema.Types.ObjectId
1564
1675
  },
1565
1676
  avatar: {
1566
1677
  required: false,
@@ -1569,28 +1680,28 @@ var schema12 = new MongooseSchema12(
1569
1680
  coupon: {
1570
1681
  ref: "Coupon",
1571
1682
  required: false,
1572
- type: import_mongoose16.default.Schema.Types.ObjectId
1683
+ type: import_mongoose18.default.Schema.Types.ObjectId
1573
1684
  },
1574
1685
  deletedAt: { default: null, required: false, type: Date },
1575
1686
  email: { required: true, type: String },
1576
1687
  emailSentFor: {
1577
- enum: Object.values(import_cluemart_shared14.EnumNotificationResourceType),
1688
+ enum: Object.values(import_cluemart_shared15.EnumNotificationResourceType),
1578
1689
  required: false,
1579
1690
  type: [String]
1580
1691
  },
1581
1692
  events: {
1582
1693
  ref: "Event",
1583
1694
  required: false,
1584
- type: [import_mongoose16.default.Schema.Types.ObjectId]
1695
+ type: [import_mongoose18.default.Schema.Types.ObjectId]
1585
1696
  },
1586
1697
  firstName: { required: true, type: String },
1587
1698
  game: {
1588
1699
  ref: "Game",
1589
1700
  required: false,
1590
- type: import_mongoose16.default.Schema.Types.ObjectId
1701
+ type: import_mongoose18.default.Schema.Types.ObjectId
1591
1702
  },
1592
1703
  interests: {
1593
- enum: Object.values(import_cluemart_shared14.EnumResourceType),
1704
+ enum: Object.values(import_cluemart_shared15.EnumResourceType),
1594
1705
  required: false,
1595
1706
  type: [String]
1596
1707
  },
@@ -1613,11 +1724,11 @@ var schema12 = new MongooseSchema12(
1613
1724
  partner: {
1614
1725
  ref: "Partner",
1615
1726
  required: false,
1616
- type: import_mongoose16.default.Schema.Types.ObjectId
1727
+ type: import_mongoose18.default.Schema.Types.ObjectId
1617
1728
  },
1618
1729
  password: { required: true, type: String },
1619
1730
  platform: {
1620
- enum: Object.values(import_cluemart_shared14.EnumOSPlatform),
1731
+ enum: Object.values(import_cluemart_shared15.EnumOSPlatform),
1621
1732
  required: false,
1622
1733
  type: String
1623
1734
  },
@@ -1646,15 +1757,15 @@ var schema12 = new MongooseSchema12(
1646
1757
  type: String
1647
1758
  },
1648
1759
  roles: {
1649
- default: [import_cluemart_shared14.EnumUserRole.CUSTOMER],
1650
- enum: Object.values(import_cluemart_shared14.EnumUserRole),
1760
+ default: [import_cluemart_shared15.EnumUserRole.CUSTOMER],
1761
+ enum: Object.values(import_cluemart_shared15.EnumUserRole),
1651
1762
  required: true,
1652
1763
  type: [String]
1653
1764
  },
1654
1765
  school: {
1655
1766
  ref: "School",
1656
1767
  required: false,
1657
- type: import_mongoose16.default.Schema.Types.ObjectId
1768
+ type: import_mongoose18.default.Schema.Types.ObjectId
1658
1769
  },
1659
1770
  stripe: {
1660
1771
  required: false,
@@ -1679,21 +1790,21 @@ var schema12 = new MongooseSchema12(
1679
1790
  vendor: {
1680
1791
  ref: "Vendor",
1681
1792
  required: false,
1682
- type: import_mongoose16.default.Schema.Types.ObjectId
1793
+ type: import_mongoose18.default.Schema.Types.ObjectId
1683
1794
  }
1684
1795
  },
1685
1796
  { strict: false, timestamps: true }
1686
1797
  );
1687
- schema12.index({ "licences.expiryDate": 1 });
1688
- schema12.index({ "licences.licenceType": 1 });
1689
- schema12.index({ promoCodes: 1, active: 1, deletedAt: 1 });
1690
- schema12.index({ email: "text", firstName: "text", lastName: "text" });
1691
- var UserModel = import_mongoose16.default.models.User || import_mongoose16.default.model("User", schema12);
1798
+ schema14.index({ "licences.expiryDate": 1 });
1799
+ schema14.index({ "licences.licenceType": 1 });
1800
+ schema14.index({ promoCodes: 1, active: 1, deletedAt: 1 });
1801
+ schema14.index({ email: "text", firstName: "text", lastName: "text" });
1802
+ var UserModel = import_mongoose18.default.models.User || import_mongoose18.default.model("User", schema14);
1692
1803
 
1693
1804
  // src/mongoose/VerificationToken.ts
1694
- var import_mongoose17 = __toESM(require("mongoose"));
1695
- var MongooseSchema13 = import_mongoose17.default.Schema;
1696
- var schema13 = new MongooseSchema13(
1805
+ var import_mongoose19 = __toESM(require("mongoose"));
1806
+ var MongooseSchema15 = import_mongoose19.default.Schema;
1807
+ var schema15 = new MongooseSchema15(
1697
1808
  {
1698
1809
  createdAt: {
1699
1810
  default: Date.now,
@@ -1708,13 +1819,13 @@ var schema13 = new MongooseSchema13(
1708
1819
  },
1709
1820
  { timestamps: true }
1710
1821
  );
1711
- var VerificationTokenModel = import_mongoose17.default.models.VerificationToken || import_mongoose17.default.model("VerificationToken", schema13);
1822
+ var VerificationTokenModel = import_mongoose19.default.models.VerificationToken || import_mongoose19.default.model("VerificationToken", schema15);
1712
1823
 
1713
1824
  // src/mongoose/vendor/Vendor.ts
1714
- var import_cluemart_shared15 = require("@timardex/cluemart-shared");
1715
- var import_mongoose18 = __toESM(require("mongoose"));
1716
- var MongooseSchema14 = import_mongoose18.default.Schema;
1717
- var vendorProductTypeSchema = new MongooseSchema14(
1825
+ var import_cluemart_shared16 = require("@timardex/cluemart-shared");
1826
+ var import_mongoose20 = __toESM(require("mongoose"));
1827
+ var MongooseSchema16 = import_mongoose20.default.Schema;
1828
+ var vendorProductTypeSchema = new MongooseSchema16(
1718
1829
  {
1719
1830
  description: { required: false, type: String },
1720
1831
  name: { required: true, type: String },
@@ -1725,18 +1836,18 @@ var vendorProductTypeSchema = new MongooseSchema14(
1725
1836
  },
1726
1837
  { timestamps: true }
1727
1838
  );
1728
- var productWrapperSchema = new MongooseSchema14(
1839
+ var productWrapperSchema = new MongooseSchema16(
1729
1840
  {
1730
1841
  active: { default: false, required: false, type: Boolean },
1731
1842
  productsList: { required: false, type: [vendorProductTypeSchema] }
1732
1843
  },
1733
1844
  { _id: false }
1734
1845
  );
1735
- var calendarSchema = new MongooseSchema14(
1846
+ var calendarSchema = new MongooseSchema16(
1736
1847
  {
1737
1848
  dateTime: {
1738
1849
  dateStatus: {
1739
- enum: Object.values(import_cluemart_shared15.EnumEventDateStatus),
1850
+ enum: Object.values(import_cluemart_shared16.EnumEventDateStatus),
1740
1851
  required: false,
1741
1852
  type: String
1742
1853
  },
@@ -1753,14 +1864,14 @@ var calendarSchema = new MongooseSchema14(
1753
1864
  },
1754
1865
  { _id: false }
1755
1866
  );
1756
- var calendarWrapperSchema = new MongooseSchema14(
1867
+ var calendarWrapperSchema = new MongooseSchema16(
1757
1868
  {
1758
1869
  active: { default: false, required: true, type: Boolean },
1759
1870
  calendarData: { required: false, type: [calendarSchema] }
1760
1871
  },
1761
1872
  { _id: false }
1762
1873
  );
1763
- var vendorAvailabilitySchema = new MongooseSchema14(
1874
+ var vendorAvailabilitySchema = new MongooseSchema16(
1764
1875
  {
1765
1876
  corporate: { default: false, required: false, type: Boolean },
1766
1877
  private: { default: false, required: false, type: Boolean },
@@ -1768,7 +1879,7 @@ var vendorAvailabilitySchema = new MongooseSchema14(
1768
1879
  },
1769
1880
  { _id: false }
1770
1881
  );
1771
- var downgradeSnapshotSchema = new MongooseSchema14(
1882
+ var downgradeSnapshotSchema = new MongooseSchema16(
1772
1883
  {
1773
1884
  availability: { required: false, type: vendorAvailabilitySchema },
1774
1885
  calendarActive: { required: false, type: Boolean },
@@ -1776,7 +1887,7 @@ var downgradeSnapshotSchema = new MongooseSchema14(
1776
1887
  },
1777
1888
  { _id: false }
1778
1889
  );
1779
- var schema14 = new MongooseSchema14(
1890
+ var schema16 = new MongooseSchema16(
1780
1891
  {
1781
1892
  ...baseResourceFields,
1782
1893
  // Importing base resource fields from global.ts
@@ -1795,47 +1906,47 @@ var schema14 = new MongooseSchema14(
1795
1906
  unregisteredVendorId: {
1796
1907
  ref: "UnregisteredVendor",
1797
1908
  required: false,
1798
- type: import_mongoose18.default.Schema.Types.ObjectId
1909
+ type: import_mongoose20.default.Schema.Types.ObjectId
1799
1910
  },
1800
1911
  vendorInfoId: {
1801
1912
  ref: "VendorInfo",
1802
1913
  required: false,
1803
- type: import_mongoose18.default.Schema.Types.ObjectId
1914
+ type: import_mongoose20.default.Schema.Types.ObjectId
1804
1915
  },
1805
1916
  vendorType: {
1806
- enum: Object.values(import_cluemart_shared15.EnumVendorType),
1917
+ enum: Object.values(import_cluemart_shared16.EnumVendorType),
1807
1918
  required: true,
1808
1919
  type: String
1809
1920
  }
1810
1921
  },
1811
1922
  { timestamps: true }
1812
1923
  );
1813
- schema14.index({ name: 1 });
1814
- schema14.index({ description: 1 });
1815
- schema14.index({ region: 1 });
1816
- schema14.index({ "categories.name": 1 });
1817
- schema14.index({ slug: 1 });
1818
- schema14.index({
1924
+ schema16.index({ name: 1 });
1925
+ schema16.index({ description: 1 });
1926
+ schema16.index({ region: 1 });
1927
+ schema16.index({ "categories.name": 1 });
1928
+ schema16.index({ slug: 1 });
1929
+ schema16.index({
1819
1930
  categoriesNames: "text",
1820
1931
  description: "text",
1821
1932
  name: "text"
1822
1933
  });
1823
- schema14.index({ deletedAt: 1, "owner.userId": 1 });
1824
- schema14.plugin(searchNamePlugin);
1825
- var VendorModel = import_mongoose18.default.models.Vendor || import_mongoose18.default.model("Vendor", schema14);
1934
+ schema16.index({ deletedAt: 1, "owner.userId": 1 });
1935
+ schema16.plugin(searchNamePlugin);
1936
+ var VendorModel = import_mongoose20.default.models.Vendor || import_mongoose20.default.model("Vendor", schema16);
1826
1937
 
1827
1938
  // src/mongoose/vendor/VendorInfo.ts
1828
- var import_cluemart_shared16 = require("@timardex/cluemart-shared");
1829
- var import_mongoose19 = __toESM(require("mongoose"));
1830
- var MongooseSchema15 = import_mongoose19.default.Schema;
1831
- var AttributesSchema = new MongooseSchema15(
1939
+ var import_cluemart_shared17 = require("@timardex/cluemart-shared");
1940
+ var import_mongoose21 = __toESM(require("mongoose"));
1941
+ var MongooseSchema17 = import_mongoose21.default.Schema;
1942
+ var AttributesSchema = new MongooseSchema17(
1832
1943
  {
1833
1944
  details: { required: false, type: String },
1834
1945
  isRequired: { default: false, required: true, type: Boolean }
1835
1946
  },
1836
1947
  { _id: false }
1837
1948
  );
1838
- var schema15 = new MongooseSchema15(
1949
+ var schema17 = new MongooseSchema17(
1839
1950
  {
1840
1951
  active: { default: true, type: Boolean },
1841
1952
  compliance: {
@@ -1845,7 +1956,7 @@ var schema15 = new MongooseSchema15(
1845
1956
  documents: [ResourceImageTypeSchema],
1846
1957
  product: {
1847
1958
  foodFlavors: {
1848
- enum: Object.values(import_cluemart_shared16.EnumFoodFlavor),
1959
+ enum: Object.values(import_cluemart_shared17.EnumFoodFlavor),
1849
1960
  required: true,
1850
1961
  type: [String]
1851
1962
  },
@@ -1870,29 +1981,29 @@ var schema15 = new MongooseSchema15(
1870
1981
  vendorId: {
1871
1982
  ref: "Vendor",
1872
1983
  required: true,
1873
- type: import_mongoose19.default.Schema.Types.ObjectId
1984
+ type: import_mongoose21.default.Schema.Types.ObjectId
1874
1985
  }
1875
1986
  },
1876
1987
  { timestamps: true }
1877
1988
  );
1878
- schema15.index({ vendorId: 1 });
1879
- var VendorInfoModel = import_mongoose19.default.models.VendorInfo || import_mongoose19.default.model("VendorInfo", schema15);
1989
+ schema17.index({ vendorId: 1 });
1990
+ var VendorInfoModel = import_mongoose21.default.models.VendorInfo || import_mongoose21.default.model("VendorInfo", schema17);
1880
1991
 
1881
1992
  // src/mongoose/vendor/UnregisteredVendor.ts
1882
- var import_mongoose20 = __toESM(require("mongoose"));
1883
- var MongooseSchema16 = import_mongoose20.default.Schema;
1884
- var invitationSchema = new MongooseSchema16(
1993
+ var import_mongoose22 = __toESM(require("mongoose"));
1994
+ var MongooseSchema18 = import_mongoose22.default.Schema;
1995
+ var invitationSchema = new MongooseSchema18(
1885
1996
  {
1886
1997
  dateTime: { required: true, type: [dateTimeSchema] },
1887
1998
  inviterId: {
1888
1999
  ref: "Event",
1889
2000
  required: true,
1890
- type: import_mongoose20.default.Schema.Types.ObjectId
2001
+ type: import_mongoose22.default.Schema.Types.ObjectId
1891
2002
  }
1892
2003
  },
1893
2004
  { _id: false }
1894
2005
  );
1895
- var schema16 = new MongooseSchema16(
2006
+ var schema18 = new MongooseSchema18(
1896
2007
  {
1897
2008
  active: { default: true, required: true, type: Boolean },
1898
2009
  categoryIds: { required: true, type: [String] },
@@ -1901,7 +2012,7 @@ var schema16 = new MongooseSchema16(
1901
2012
  claimedByUserId: {
1902
2013
  ref: "User",
1903
2014
  required: false,
1904
- type: import_mongoose20.default.Schema.Types.ObjectId
2015
+ type: import_mongoose22.default.Schema.Types.ObjectId
1905
2016
  },
1906
2017
  claimInitiatedAt: { default: null, required: false, type: Date },
1907
2018
  claimToken: { default: null, required: false, type: String },
@@ -1914,15 +2025,15 @@ var schema16 = new MongooseSchema16(
1914
2025
  },
1915
2026
  { timestamps: true }
1916
2027
  );
1917
- schema16.index({ name: 1 });
1918
- schema16.index({ email: 1 });
1919
- var UnregisteredVendorModel = import_mongoose20.default.models.UnregisteredVendor || import_mongoose20.default.model("UnregisteredVendor", schema16);
2028
+ schema18.index({ name: 1 });
2029
+ schema18.index({ email: 1 });
2030
+ var UnregisteredVendorModel = import_mongoose22.default.models.UnregisteredVendor || import_mongoose22.default.model("UnregisteredVendor", schema18);
1920
2031
 
1921
2032
  // src/mongoose/event/Event.ts
1922
- var import_cluemart_shared17 = require("@timardex/cluemart-shared");
1923
- var import_mongoose21 = __toESM(require("mongoose"));
1924
- var MongooseSchema17 = import_mongoose21.default.Schema;
1925
- var schema17 = new MongooseSchema17(
2033
+ var import_cluemart_shared18 = require("@timardex/cluemart-shared");
2034
+ var import_mongoose23 = __toESM(require("mongoose"));
2035
+ var MongooseSchema19 = import_mongoose23.default.Schema;
2036
+ var schema19 = new MongooseSchema19(
1926
2037
  {
1927
2038
  ...baseResourceFields,
1928
2039
  // Importing base resource fields from global.ts
@@ -1931,10 +2042,10 @@ var schema17 = new MongooseSchema17(
1931
2042
  eventInfoId: {
1932
2043
  ref: "EventInfo",
1933
2044
  required: false,
1934
- type: import_mongoose21.default.Schema.Types.ObjectId
2045
+ type: import_mongoose23.default.Schema.Types.ObjectId
1935
2046
  },
1936
2047
  eventType: {
1937
- enum: Object.values(import_cluemart_shared17.EnumEventType),
2048
+ enum: Object.values(import_cluemart_shared18.EnumEventType),
1938
2049
  required: true,
1939
2050
  type: String
1940
2051
  },
@@ -1955,40 +2066,40 @@ var schema17 = new MongooseSchema17(
1955
2066
  },
1956
2067
  { timestamps: true }
1957
2068
  );
1958
- schema17.index({ name: 1 });
1959
- schema17.index({ description: 1 });
1960
- schema17.index({ region: 1 });
1961
- schema17.index({ "location.geo": "2dsphere" });
1962
- schema17.index({ tags: 1 });
1963
- schema17.index({ deletedAt: 1 });
1964
- schema17.index({ "dateTime.dateStatus": 1 });
1965
- schema17.index({ slug: 1 });
1966
- schema17.index({ description: "text", name: "text", tags: "text" });
1967
- schema17.index({ deletedAt: 1, "owner.userId": 1 });
1968
- schema17.plugin(searchNamePlugin);
1969
- var EventModel = import_mongoose21.default.models.Event || import_mongoose21.default.model("Event", schema17);
2069
+ schema19.index({ name: 1 });
2070
+ schema19.index({ description: 1 });
2071
+ schema19.index({ region: 1 });
2072
+ schema19.index({ "location.geo": "2dsphere" });
2073
+ schema19.index({ tags: 1 });
2074
+ schema19.index({ deletedAt: 1 });
2075
+ schema19.index({ "dateTime.dateStatus": 1 });
2076
+ schema19.index({ slug: 1 });
2077
+ schema19.index({ description: "text", name: "text", tags: "text" });
2078
+ schema19.index({ deletedAt: 1, "owner.userId": 1 });
2079
+ schema19.plugin(searchNamePlugin);
2080
+ var EventModel = import_mongoose23.default.models.Event || import_mongoose23.default.model("Event", schema19);
1970
2081
 
1971
2082
  // src/mongoose/event/EventDateArchive.ts
1972
- var import_mongoose22 = __toESM(require("mongoose"));
1973
- var schema18 = new import_mongoose22.default.Schema(
2083
+ var import_mongoose24 = __toESM(require("mongoose"));
2084
+ var schema20 = new import_mongoose24.default.Schema(
1974
2085
  {
1975
2086
  dateTime: { required: true, type: [dateTimeSchema] },
1976
2087
  eventId: {
1977
2088
  ref: "Event",
1978
2089
  required: true,
1979
- type: import_mongoose22.default.Schema.Types.ObjectId
2090
+ type: import_mongoose24.default.Schema.Types.ObjectId
1980
2091
  }
1981
2092
  },
1982
2093
  { timestamps: true }
1983
2094
  );
1984
- schema18.index({ eventId: 1 }, { unique: true });
1985
- var EventDateArchiveModel = import_mongoose22.default.models.EventDateArchive || import_mongoose22.default.model("EventDateArchive", schema18);
2095
+ schema20.index({ eventId: 1 }, { unique: true });
2096
+ var EventDateArchiveModel = import_mongoose24.default.models.EventDateArchive || import_mongoose24.default.model("EventDateArchive", schema20);
1986
2097
 
1987
2098
  // src/mongoose/Partner.ts
1988
- var import_cluemart_shared18 = require("@timardex/cluemart-shared");
1989
- var import_mongoose23 = __toESM(require("mongoose"));
1990
- var MongooseSchema18 = import_mongoose23.default.Schema;
1991
- var schema19 = new MongooseSchema18(
2099
+ var import_cluemart_shared19 = require("@timardex/cluemart-shared");
2100
+ var import_mongoose25 = __toESM(require("mongoose"));
2101
+ var MongooseSchema20 = import_mongoose25.default.Schema;
2102
+ var schema21 = new MongooseSchema20(
1992
2103
  {
1993
2104
  ...baseResourceFields,
1994
2105
  location: {
@@ -1997,53 +2108,53 @@ var schema19 = new MongooseSchema18(
1997
2108
  },
1998
2109
  nzbn: { required: true, type: String },
1999
2110
  partnerType: {
2000
- enum: Object.values(import_cluemart_shared18.EnumPartnerType),
2111
+ enum: Object.values(import_cluemart_shared19.EnumPartnerType),
2001
2112
  required: true,
2002
2113
  type: String
2003
2114
  }
2004
2115
  },
2005
2116
  { timestamps: true }
2006
2117
  );
2007
- schema19.index({ name: 1 });
2008
- schema19.index({ description: 1 });
2009
- schema19.index({ region: 1 });
2010
- schema19.index({ "location.geo": "2dsphere" });
2011
- schema19.index({ slug: 1 });
2012
- schema19.index({ name: "text", description: "text" });
2013
- schema19.index({ "owner.userId": 1, deletedAt: 1 });
2014
- schema19.plugin(searchNamePlugin);
2015
- var PartnerModel = import_mongoose23.default.models.Partner || import_mongoose23.default.model("Partner", schema19);
2118
+ schema21.index({ name: 1 });
2119
+ schema21.index({ description: 1 });
2120
+ schema21.index({ region: 1 });
2121
+ schema21.index({ "location.geo": "2dsphere" });
2122
+ schema21.index({ slug: 1 });
2123
+ schema21.index({ name: "text", description: "text" });
2124
+ schema21.index({ "owner.userId": 1, deletedAt: 1 });
2125
+ schema21.plugin(searchNamePlugin);
2126
+ var PartnerModel = import_mongoose25.default.models.Partner || import_mongoose25.default.model("Partner", schema21);
2016
2127
 
2017
2128
  // src/mongoose/Post.ts
2018
- var import_cluemart_shared19 = require("@timardex/cluemart-shared");
2019
- var import_mongoose24 = __toESM(require("mongoose"));
2020
- var MongooseSchema19 = import_mongoose24.default.Schema;
2021
- var contentSchema = new MongooseSchema19(
2129
+ var import_cluemart_shared20 = require("@timardex/cluemart-shared");
2130
+ var import_mongoose26 = __toESM(require("mongoose"));
2131
+ var MongooseSchema21 = import_mongoose26.default.Schema;
2132
+ var contentSchema = new MongooseSchema21(
2022
2133
  {
2023
- contentData: import_mongoose24.Schema.Types.Mixed,
2134
+ contentData: import_mongoose26.Schema.Types.Mixed,
2024
2135
  contentOrder: { required: true, type: Number },
2025
2136
  contentType: {
2026
- enum: Object.values(import_cluemart_shared19.EnumPostContentType),
2137
+ enum: Object.values(import_cluemart_shared20.EnumPostContentType),
2027
2138
  required: true,
2028
2139
  type: String
2029
2140
  }
2030
2141
  },
2031
2142
  { _id: false }
2032
2143
  );
2033
- var resourceSchema = new MongooseSchema19(
2144
+ var resourceSchema = new MongooseSchema21(
2034
2145
  {
2035
2146
  resourceId: { required: true, type: String },
2036
2147
  resourceRegion: { required: true, type: String },
2037
2148
  resourceSlug: { required: true, type: String },
2038
2149
  resourceType: {
2039
- enum: Object.values(import_cluemart_shared19.EnumResourceType),
2150
+ enum: Object.values(import_cluemart_shared20.EnumResourceType),
2040
2151
  required: true,
2041
2152
  type: String
2042
2153
  }
2043
2154
  },
2044
2155
  { _id: false }
2045
2156
  );
2046
- var schema20 = new MongooseSchema19(
2157
+ var schema22 = new MongooseSchema21(
2047
2158
  {
2048
2159
  active: { default: false, required: true, type: Boolean },
2049
2160
  approvedAt: { default: null, required: false, type: Date },
@@ -2059,7 +2170,7 @@ var schema20 = new MongooseSchema19(
2059
2170
  },
2060
2171
  deletedAt: { default: null, required: false, type: Date },
2061
2172
  postType: {
2062
- enum: Object.values(import_cluemart_shared19.EnumPostType),
2173
+ enum: Object.values(import_cluemart_shared20.EnumPostType),
2063
2174
  required: true,
2064
2175
  type: String
2065
2176
  },
@@ -2074,16 +2185,16 @@ var schema20 = new MongooseSchema19(
2074
2185
  },
2075
2186
  { timestamps: true }
2076
2187
  );
2077
- schema20.index({ title: 1 });
2078
- schema20.index({ tags: 1 });
2079
- schema20.index({ postType: 1, slug: 1 }, { unique: true });
2080
- var PostModel = import_mongoose24.default.models.Post || import_mongoose24.default.model("Post", schema20);
2188
+ schema22.index({ title: 1 });
2189
+ schema22.index({ tags: 1 });
2190
+ schema22.index({ postType: 1, slug: 1 }, { unique: true });
2191
+ var PostModel = import_mongoose26.default.models.Post || import_mongoose26.default.model("Post", schema22);
2081
2192
 
2082
2193
  // src/mongoose/AppSetting.ts
2083
- var import_mongoose25 = __toESM(require("mongoose"));
2084
- var MongooseSchema20 = import_mongoose25.default.Schema;
2194
+ var import_mongoose27 = __toESM(require("mongoose"));
2195
+ var MongooseSchema22 = import_mongoose27.default.Schema;
2085
2196
  var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
2086
- var AppSettingSchema = new MongooseSchema20(
2197
+ var AppSettingSchema = new MongooseSchema22(
2087
2198
  {
2088
2199
  activeSchoolsStudentCountTotal: {
2089
2200
  default: 0,
@@ -2105,8 +2216,8 @@ var AppSettingSchema = new MongooseSchema20(
2105
2216
  validate: Number.isInteger
2106
2217
  },
2107
2218
  mobileDisplayEnabled: { default: false, required: true, type: Boolean },
2108
- purchasePricing: { type: MongooseSchema20.Types.Mixed },
2109
- regionPricing: { type: MongooseSchema20.Types.Mixed },
2219
+ purchasePricing: { type: MongooseSchema22.Types.Mixed },
2220
+ regionPricing: { type: MongooseSchema22.Types.Mixed },
2110
2221
  paidSlotsPerPlacement: { enum: [30], type: Number },
2111
2222
  reservedSlotsPerPlacement: { enum: [7], type: Number },
2112
2223
  rotationSeconds: { enum: [8], type: Number },
@@ -2131,12 +2242,12 @@ var AppSettingSchema = new MongooseSchema20(
2131
2242
  },
2132
2243
  { timestamps: true }
2133
2244
  );
2134
- var AppSettingModel = import_mongoose25.default.models.AppSetting || import_mongoose25.default.model("AppSetting", AppSettingSchema);
2245
+ var AppSettingModel = import_mongoose27.default.models.AppSetting || import_mongoose27.default.model("AppSetting", AppSettingSchema);
2135
2246
 
2136
2247
  // src/mongoose/AuthHandoffToken.ts
2137
- var import_mongoose26 = __toESM(require("mongoose"));
2138
- var MongooseSchema21 = import_mongoose26.default.Schema;
2139
- var schema21 = new MongooseSchema21(
2248
+ var import_mongoose28 = __toESM(require("mongoose"));
2249
+ var MongooseSchema23 = import_mongoose28.default.Schema;
2250
+ var schema23 = new MongooseSchema23(
2140
2251
  {
2141
2252
  expiresAt: { required: true, type: Date },
2142
2253
  jti: { index: true, required: true, type: String, unique: true },
@@ -2145,25 +2256,25 @@ var schema21 = new MongooseSchema21(
2145
2256
  index: true,
2146
2257
  ref: "User",
2147
2258
  required: true,
2148
- type: import_mongoose26.default.Schema.Types.ObjectId
2259
+ type: import_mongoose28.default.Schema.Types.ObjectId
2149
2260
  }
2150
2261
  },
2151
2262
  { timestamps: true }
2152
2263
  );
2153
- schema21.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
2154
- var AuthHandoffTokenModel = import_mongoose26.default.models.AuthHandoffToken || import_mongoose26.default.model("AuthHandoffToken", schema21);
2264
+ schema23.index({ expiresAt: 1 }, { expireAfterSeconds: 0 });
2265
+ var AuthHandoffTokenModel = import_mongoose28.default.models.AuthHandoffToken || import_mongoose28.default.model("AuthHandoffToken", schema23);
2155
2266
 
2156
2267
  // src/mongoose/game/Game.ts
2157
- var import_cluemart_shared20 = require("@timardex/cluemart-shared");
2158
- var import_mongoose30 = __toESM(require("mongoose"));
2268
+ var import_cluemart_shared21 = require("@timardex/cluemart-shared");
2269
+ var import_mongoose32 = __toESM(require("mongoose"));
2159
2270
 
2160
2271
  // src/mongoose/game/DailyClue.ts
2161
- var import_mongoose28 = __toESM(require("mongoose"));
2272
+ var import_mongoose30 = __toESM(require("mongoose"));
2162
2273
 
2163
2274
  // src/mongoose/game/utils.ts
2164
- var import_mongoose27 = __toESM(require("mongoose"));
2165
- var MongooseSchema22 = import_mongoose27.default.Schema;
2166
- var schemaGameDate = new MongooseSchema22(
2275
+ var import_mongoose29 = __toESM(require("mongoose"));
2276
+ var MongooseSchema24 = import_mongoose29.default.Schema;
2277
+ var schemaGameDate = new MongooseSchema24(
2167
2278
  {
2168
2279
  endDate: { required: true, type: Date },
2169
2280
  startDate: { required: true, type: Date }
@@ -2172,8 +2283,8 @@ var schemaGameDate = new MongooseSchema22(
2172
2283
  );
2173
2284
 
2174
2285
  // src/mongoose/game/DailyClue.ts
2175
- var MongooseSchema23 = import_mongoose28.default.Schema;
2176
- var schemaLetters = new MongooseSchema23(
2286
+ var MongooseSchema25 = import_mongoose30.default.Schema;
2287
+ var schemaLetters = new MongooseSchema25(
2177
2288
  {
2178
2289
  collected: { required: false, type: [String] },
2179
2290
  solutionShuffled: { required: true, type: [String] }
@@ -2181,14 +2292,14 @@ var schemaLetters = new MongooseSchema23(
2181
2292
  },
2182
2293
  { _id: false }
2183
2294
  );
2184
- var schemaDailyClueBaseGame = new MongooseSchema23(
2295
+ var schemaDailyClueBaseGame = new MongooseSchema25(
2185
2296
  {
2186
2297
  gameDate: { required: true, type: schemaGameDate },
2187
2298
  gameSolution: { required: true, type: String }
2188
2299
  },
2189
2300
  { _id: false }
2190
2301
  );
2191
- var schemaDailyClueGameData = new MongooseSchema23(
2302
+ var schemaDailyClueGameData = new MongooseSchema25(
2192
2303
  {
2193
2304
  gameFields: { required: true, type: schemaDailyClueBaseGame },
2194
2305
  lastFoundDate: { default: null, required: false, type: Date },
@@ -2203,9 +2314,9 @@ var schemaDailyClueGameData = new MongooseSchema23(
2203
2314
  );
2204
2315
 
2205
2316
  // src/mongoose/game/PuzzleGame.ts
2206
- var import_mongoose29 = __toESM(require("mongoose"));
2207
- var MongooseSchema24 = import_mongoose29.default.Schema;
2208
- var schemaPuzzleAnswer = new MongooseSchema24(
2317
+ var import_mongoose31 = __toESM(require("mongoose"));
2318
+ var MongooseSchema26 = import_mongoose31.default.Schema;
2319
+ var schemaPuzzleAnswer = new MongooseSchema26(
2209
2320
  {
2210
2321
  answer: { required: true, type: String },
2211
2322
  answerId: { required: true, type: String },
@@ -2213,7 +2324,7 @@ var schemaPuzzleAnswer = new MongooseSchema24(
2213
2324
  },
2214
2325
  { _id: false }
2215
2326
  );
2216
- var schemaPuzzleQuestion = new MongooseSchema24(
2327
+ var schemaPuzzleQuestion = new MongooseSchema26(
2217
2328
  {
2218
2329
  answers: { required: true, type: [schemaPuzzleAnswer] },
2219
2330
  question: { required: true, type: String },
@@ -2221,20 +2332,20 @@ var schemaPuzzleQuestion = new MongooseSchema24(
2221
2332
  },
2222
2333
  { _id: false }
2223
2334
  );
2224
- var schemaPuzzleBaseGame = new MongooseSchema24(
2335
+ var schemaPuzzleBaseGame = new MongooseSchema26(
2225
2336
  {
2226
2337
  questions: { required: true, type: [schemaPuzzleQuestion] }
2227
2338
  },
2228
2339
  { _id: false }
2229
2340
  );
2230
- var schemaPuzzleAnsweredQuestion = new MongooseSchema24(
2341
+ var schemaPuzzleAnsweredQuestion = new MongooseSchema26(
2231
2342
  {
2232
2343
  questionId: { required: true, type: String },
2233
2344
  selectedAnswerId: { required: true, type: String }
2234
2345
  },
2235
2346
  { _id: false }
2236
2347
  );
2237
- var schemaPuzzleGameData = new MongooseSchema24(
2348
+ var schemaPuzzleGameData = new MongooseSchema26(
2238
2349
  {
2239
2350
  answeredQuestions: {
2240
2351
  default: null,
@@ -2249,30 +2360,30 @@ var schemaPuzzleGameData = new MongooseSchema24(
2249
2360
  );
2250
2361
 
2251
2362
  // src/mongoose/game/Game.ts
2252
- var MongooseSchema25 = import_mongoose30.default.Schema;
2363
+ var MongooseSchema27 = import_mongoose32.default.Schema;
2253
2364
  var gameDataSchemas = {
2254
- [import_cluemart_shared20.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
2255
- [import_cluemart_shared20.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
2256
- [import_cluemart_shared20.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
2365
+ [import_cluemart_shared21.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
2366
+ [import_cluemart_shared21.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
2367
+ [import_cluemart_shared21.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
2257
2368
  };
2258
2369
  var gameDataDefinition = Object.fromEntries(
2259
- Object.entries(gameDataSchemas).map(([key, schema26]) => [
2370
+ Object.entries(gameDataSchemas).map(([key, schema28]) => [
2260
2371
  key,
2261
- { default: null, required: false, type: schema26 }
2372
+ { default: null, required: false, type: schema28 }
2262
2373
  ])
2263
2374
  );
2264
- var gameHistorySchema = new MongooseSchema25(
2375
+ var gameHistorySchema = new MongooseSchema27(
2265
2376
  {
2266
2377
  createdAt: { required: true, type: Date },
2267
2378
  gameDate: { required: true, type: schemaGameDate },
2268
2379
  gameStatus: {
2269
- enum: Object.values(import_cluemart_shared20.EnumGameStatus),
2380
+ enum: Object.values(import_cluemart_shared21.EnumGameStatus),
2270
2381
  required: true,
2271
2382
  type: String
2272
2383
  },
2273
2384
  gameTitle: { required: true, type: String },
2274
2385
  gameType: {
2275
- enum: Object.values(import_cluemart_shared20.EnumGameType),
2386
+ enum: Object.values(import_cluemart_shared21.EnumGameType),
2276
2387
  required: true,
2277
2388
  type: String
2278
2389
  },
@@ -2281,14 +2392,14 @@ var gameHistorySchema = new MongooseSchema25(
2281
2392
  },
2282
2393
  { _id: false }
2283
2394
  );
2284
- var gameTypeSchema = new MongooseSchema25(
2395
+ var gameTypeSchema = new MongooseSchema27(
2285
2396
  {
2286
2397
  active: { default: true, required: true, type: Boolean },
2287
2398
  gameData: gameDataDefinition,
2288
2399
  gameHistory: { default: [], required: true, type: [gameHistorySchema] },
2289
2400
  gameTitle: { required: true, type: String },
2290
2401
  gameType: {
2291
- enum: Object.values(import_cluemart_shared20.EnumGameType),
2402
+ enum: Object.values(import_cluemart_shared21.EnumGameType),
2292
2403
  required: true,
2293
2404
  type: String
2294
2405
  },
@@ -2299,7 +2410,7 @@ var gameTypeSchema = new MongooseSchema25(
2299
2410
  },
2300
2411
  { timestamps: true }
2301
2412
  );
2302
- var schema22 = new MongooseSchema25(
2413
+ var schema24 = new MongooseSchema27(
2303
2414
  {
2304
2415
  active: { default: false, required: true, type: Boolean },
2305
2416
  deletedAt: { default: null, required: false, type: Date },
@@ -2312,12 +2423,12 @@ var schema22 = new MongooseSchema25(
2312
2423
  },
2313
2424
  { timestamps: true }
2314
2425
  );
2315
- var GameModel = import_mongoose30.default.models.Game || import_mongoose30.default.model("Game", schema22);
2426
+ var GameModel = import_mongoose32.default.models.Game || import_mongoose32.default.model("Game", schema24);
2316
2427
 
2317
2428
  // src/mongoose/School.ts
2318
- var import_mongoose31 = __toESM(require("mongoose"));
2319
- var MongooseSchema26 = import_mongoose31.default.Schema;
2320
- var campaignsSchema = new MongooseSchema26(
2429
+ var import_mongoose33 = __toESM(require("mongoose"));
2430
+ var MongooseSchema28 = import_mongoose33.default.Schema;
2431
+ var campaignsSchema = new MongooseSchema28(
2321
2432
  {
2322
2433
  endDate: { required: true, type: Date },
2323
2434
  name: { required: true, type: String },
@@ -2325,7 +2436,7 @@ var campaignsSchema = new MongooseSchema26(
2325
2436
  },
2326
2437
  { _id: false }
2327
2438
  );
2328
- var schema23 = new MongooseSchema26(
2439
+ var schema25 = new MongooseSchema28(
2329
2440
  {
2330
2441
  // New schools are active by default
2331
2442
  active: { default: false, required: true, type: Boolean },
@@ -2352,26 +2463,26 @@ var schema23 = new MongooseSchema26(
2352
2463
  },
2353
2464
  { timestamps: true }
2354
2465
  );
2355
- schema23.index(
2466
+ schema25.index(
2356
2467
  { schoolCode: 1 },
2357
2468
  {
2358
2469
  partialFilterExpression: { active: true, deletedAt: null },
2359
2470
  unique: true
2360
2471
  }
2361
2472
  );
2362
- var SchoolModel = import_mongoose31.default.models.School || import_mongoose31.default.model("School", schema23);
2473
+ var SchoolModel = import_mongoose33.default.models.School || import_mongoose33.default.model("School", schema25);
2363
2474
 
2364
2475
  // src/mongoose/Affiliate.ts
2365
- var import_cluemart_shared21 = require("@timardex/cluemart-shared");
2366
- var import_mongoose32 = __toESM(require("mongoose"));
2367
- var MongooseSchema27 = import_mongoose32.default.Schema;
2368
- var affiliateRewardSchema = new MongooseSchema27(
2476
+ var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2477
+ var import_mongoose34 = __toESM(require("mongoose"));
2478
+ var MongooseSchema29 = import_mongoose34.default.Schema;
2479
+ var affiliateRewardSchema = new MongooseSchema29(
2369
2480
  {
2370
2481
  createdAt: { required: true, type: Date },
2371
2482
  redeemedAt: { default: null, required: false, type: Date },
2372
2483
  rewardDescription: { required: true, type: String },
2373
2484
  rewardType: {
2374
- enum: Object.values(import_cluemart_shared21.EnumAffiliateRewardType),
2485
+ enum: Object.values(import_cluemart_shared22.EnumAffiliateRewardType),
2375
2486
  required: true,
2376
2487
  type: String
2377
2488
  },
@@ -2379,13 +2490,13 @@ var affiliateRewardSchema = new MongooseSchema27(
2379
2490
  },
2380
2491
  { _id: false }
2381
2492
  );
2382
- var affiliateResourceSchema = new MongooseSchema27(
2493
+ var affiliateResourceSchema = new MongooseSchema29(
2383
2494
  {
2384
2495
  resourceActive: { default: true, required: true, type: Boolean },
2385
2496
  resourceDeletedAt: { default: null, required: false, type: Date },
2386
2497
  resourceId: {
2387
2498
  required: true,
2388
- type: import_mongoose32.default.Schema.Types.ObjectId
2499
+ type: import_mongoose34.default.Schema.Types.ObjectId
2389
2500
  },
2390
2501
  resourceName: { required: true, type: String },
2391
2502
  resourceOwner: {
@@ -2393,7 +2504,7 @@ var affiliateResourceSchema = new MongooseSchema27(
2393
2504
  type: OwnerTypeSchema
2394
2505
  },
2395
2506
  resourceType: {
2396
- enum: Object.values(import_cluemart_shared21.EnumResourceType),
2507
+ enum: Object.values(import_cluemart_shared22.EnumResourceType),
2397
2508
  required: true,
2398
2509
  type: String
2399
2510
  },
@@ -2405,20 +2516,20 @@ var affiliateResourceSchema = new MongooseSchema27(
2405
2516
  },
2406
2517
  { _id: false }
2407
2518
  );
2408
- var affiliateContactDetailsSchema = new MongooseSchema27(
2519
+ var affiliateContactDetailsSchema = new MongooseSchema29(
2409
2520
  {
2410
2521
  mobilePhone: { required: true, type: String }
2411
2522
  },
2412
2523
  { _id: false }
2413
2524
  );
2414
- var affiliateBankAccountDetailsSchema = new MongooseSchema27(
2525
+ var affiliateBankAccountDetailsSchema = new MongooseSchema29(
2415
2526
  {
2416
2527
  accountHolderName: { required: true, type: String },
2417
2528
  accountNumber: { required: true, type: String }
2418
2529
  },
2419
2530
  { _id: false }
2420
2531
  );
2421
- var affiliateDetailsSchema = new MongooseSchema27(
2532
+ var affiliateDetailsSchema = new MongooseSchema29(
2422
2533
  {
2423
2534
  bankAccountDetails: {
2424
2535
  required: true,
@@ -2431,7 +2542,7 @@ var affiliateDetailsSchema = new MongooseSchema27(
2431
2542
  lastName: { required: true, type: String },
2432
2543
  location: { required: true, type: locationsSchema },
2433
2544
  participantType: {
2434
- enum: Object.values(import_cluemart_shared21.EnumAffiliateParticipantType),
2545
+ enum: Object.values(import_cluemart_shared22.EnumAffiliateParticipantType),
2435
2546
  required: true,
2436
2547
  type: String
2437
2548
  },
@@ -2440,7 +2551,7 @@ var affiliateDetailsSchema = new MongooseSchema27(
2440
2551
  },
2441
2552
  { _id: false }
2442
2553
  );
2443
- var redeemHistorySchema = new MongooseSchema27(
2554
+ var redeemHistorySchema = new MongooseSchema29(
2444
2555
  {
2445
2556
  paidAt: { default: null, required: false, type: Date },
2446
2557
  redeemedAt: { required: true, type: Date },
@@ -2448,7 +2559,7 @@ var redeemHistorySchema = new MongooseSchema27(
2448
2559
  },
2449
2560
  { _id: false }
2450
2561
  );
2451
- var schema24 = new MongooseSchema27(
2562
+ var schema26 = new MongooseSchema29(
2452
2563
  {
2453
2564
  active: { default: false, required: true, type: Boolean },
2454
2565
  affiliateBonusRewards: {
@@ -2478,26 +2589,26 @@ var schema24 = new MongooseSchema27(
2478
2589
  },
2479
2590
  { timestamps: true }
2480
2591
  );
2481
- schema24.index(
2592
+ schema26.index(
2482
2593
  { affiliateCode: 1 },
2483
2594
  {
2484
2595
  partialFilterExpression: { active: true, deletedAt: null },
2485
2596
  unique: true
2486
2597
  }
2487
2598
  );
2488
- var AffiliateModel = import_mongoose32.default.models.Affiliate || import_mongoose32.default.model("Affiliate", schema24);
2599
+ var AffiliateModel = import_mongoose34.default.models.Affiliate || import_mongoose34.default.model("Affiliate", schema26);
2489
2600
 
2490
2601
  // src/mongoose/Coupon.ts
2491
- var import_cluemart_shared22 = require("@timardex/cluemart-shared");
2492
- var import_mongoose33 = __toESM(require("mongoose"));
2493
- var MongooseSchema28 = import_mongoose33.default.Schema;
2494
- var couponOptionSchema = new MongooseSchema28(
2602
+ var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2603
+ var import_mongoose35 = __toESM(require("mongoose"));
2604
+ var MongooseSchema30 = import_mongoose35.default.Schema;
2605
+ var couponOptionSchema = new MongooseSchema30(
2495
2606
  {
2496
2607
  buy: { required: false, type: Number },
2497
2608
  get: { required: false, type: Number },
2498
2609
  maxRewardCount: { required: false, type: Number },
2499
2610
  type: {
2500
- enum: Object.values(import_cluemart_shared22.EnumCouponQualificationType),
2611
+ enum: Object.values(import_cluemart_shared23.EnumCouponQualificationType),
2501
2612
  required: true,
2502
2613
  type: String
2503
2614
  },
@@ -2506,29 +2617,29 @@ var couponOptionSchema = new MongooseSchema28(
2506
2617
  },
2507
2618
  { _id: false }
2508
2619
  );
2509
- var couponVendorProductSchema = new MongooseSchema28(
2620
+ var couponVendorProductSchema = new MongooseSchema30(
2510
2621
  {
2511
2622
  couponId: {
2512
2623
  required: true,
2513
- type: import_mongoose33.default.Schema.Types.ObjectId
2624
+ type: import_mongoose35.default.Schema.Types.ObjectId
2514
2625
  },
2515
2626
  productId: {
2516
2627
  required: true,
2517
- type: import_mongoose33.default.Schema.Types.ObjectId
2628
+ type: import_mongoose35.default.Schema.Types.ObjectId
2518
2629
  },
2519
2630
  vendorCouponId: {
2520
2631
  required: false,
2521
- type: import_mongoose33.default.Schema.Types.ObjectId
2632
+ type: import_mongoose35.default.Schema.Types.ObjectId
2522
2633
  },
2523
2634
  vendorId: {
2524
2635
  ref: "Vendor",
2525
2636
  required: true,
2526
- type: import_mongoose33.default.Schema.Types.ObjectId
2637
+ type: import_mongoose35.default.Schema.Types.ObjectId
2527
2638
  }
2528
2639
  },
2529
2640
  { _id: false }
2530
2641
  );
2531
- var couponCodeSchema = new MongooseSchema28(
2642
+ var couponCodeSchema = new MongooseSchema30(
2532
2643
  {
2533
2644
  code: { required: true, type: String },
2534
2645
  qrCode: { required: true, type: ResourceImageTypeSchema },
@@ -2536,7 +2647,7 @@ var couponCodeSchema = new MongooseSchema28(
2536
2647
  },
2537
2648
  { _id: false }
2538
2649
  );
2539
- var couponParticipantUserSchema = new MongooseSchema28(
2650
+ var couponParticipantUserSchema = new MongooseSchema30(
2540
2651
  {
2541
2652
  couponCollectedCount: { default: 0, required: true, type: Number },
2542
2653
  couponCycleRedeemed: { default: false, required: true, type: Boolean },
@@ -2545,12 +2656,12 @@ var couponParticipantUserSchema = new MongooseSchema28(
2545
2656
  userId: {
2546
2657
  ref: "User",
2547
2658
  required: true,
2548
- type: import_mongoose33.default.Schema.Types.ObjectId
2659
+ type: import_mongoose35.default.Schema.Types.ObjectId
2549
2660
  }
2550
2661
  },
2551
2662
  { timestamps: true }
2552
2663
  );
2553
- var couponDataSchema = new MongooseSchema28(
2664
+ var couponDataSchema = new MongooseSchema30(
2554
2665
  {
2555
2666
  active: { default: true, required: true, type: Boolean },
2556
2667
  couponCode: { required: false, type: couponCodeSchema },
@@ -2569,7 +2680,7 @@ var couponDataSchema = new MongooseSchema28(
2569
2680
  },
2570
2681
  resourceId: { required: true, type: String },
2571
2682
  resourceType: {
2572
- enum: Object.values(import_cluemart_shared22.EnumResourceType),
2683
+ enum: Object.values(import_cluemart_shared23.EnumResourceType),
2573
2684
  required: true,
2574
2685
  type: String
2575
2686
  },
@@ -2577,7 +2688,7 @@ var couponDataSchema = new MongooseSchema28(
2577
2688
  },
2578
2689
  { timestamps: true }
2579
2690
  );
2580
- var schema25 = new MongooseSchema28(
2691
+ var schema27 = new MongooseSchema30(
2581
2692
  {
2582
2693
  active: { default: true, required: true, type: Boolean },
2583
2694
  couponData: { default: [], required: false, type: [couponDataSchema] },
@@ -2589,62 +2700,62 @@ var schema25 = new MongooseSchema28(
2589
2700
  },
2590
2701
  { timestamps: true }
2591
2702
  );
2592
- schema25.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2593
- schema25.index({ "couponData.participantUsers.userId": 1 });
2594
- var CouponModel = import_mongoose33.default.models.Coupon || import_mongoose33.default.model("Coupon", schema25);
2703
+ schema27.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2704
+ schema27.index({ "couponData.participantUsers.userId": 1 });
2705
+ var CouponModel = import_mongoose35.default.models.Coupon || import_mongoose35.default.model("Coupon", schema27);
2595
2706
 
2596
2707
  // src/mongoose/Impersonation.ts
2597
- var import_cluemart_shared23 = require("@timardex/cluemart-shared");
2598
- var import_mongoose34 = __toESM(require("mongoose"));
2599
- var MongooseSchema29 = import_mongoose34.default.Schema;
2600
- var impersonationSessionSchema = new MongooseSchema29(
2708
+ var import_cluemart_shared24 = require("@timardex/cluemart-shared");
2709
+ var import_mongoose36 = __toESM(require("mongoose"));
2710
+ var MongooseSchema31 = import_mongoose36.default.Schema;
2711
+ var impersonationSessionSchema = new MongooseSchema31(
2601
2712
  {
2602
2713
  expiresAt: { expires: 0, required: true, type: Date },
2603
2714
  impersonatedUserId: {
2604
2715
  index: true,
2605
2716
  ref: "User",
2606
2717
  required: true,
2607
- type: import_mongoose34.default.Schema.Types.ObjectId
2718
+ type: import_mongoose36.default.Schema.Types.ObjectId
2608
2719
  },
2609
2720
  impersonatorUserId: {
2610
2721
  index: true,
2611
2722
  ref: "User",
2612
2723
  required: true,
2613
- type: import_mongoose34.default.Schema.Types.ObjectId
2724
+ type: import_mongoose36.default.Schema.Types.ObjectId
2614
2725
  },
2615
2726
  refreshToken: { required: true, type: String }
2616
2727
  },
2617
2728
  { timestamps: true }
2618
2729
  );
2619
- var ImpersonationSessionModel = import_mongoose34.default.models.ImpersonationSession || import_mongoose34.default.model(
2730
+ var ImpersonationSessionModel = import_mongoose36.default.models.ImpersonationSession || import_mongoose36.default.model(
2620
2731
  "ImpersonationSession",
2621
2732
  impersonationSessionSchema
2622
2733
  );
2623
- var impersonationAuditSchema = new MongooseSchema29(
2734
+ var impersonationAuditSchema = new MongooseSchema31(
2624
2735
  {
2625
2736
  action: { enum: ["start", "end"], required: true, type: String },
2626
2737
  endReason: { type: String },
2627
2738
  impersonatedUserId: {
2628
2739
  ref: "User",
2629
2740
  required: true,
2630
- type: import_mongoose34.default.Schema.Types.ObjectId
2741
+ type: import_mongoose36.default.Schema.Types.ObjectId
2631
2742
  },
2632
2743
  impersonatorUserId: {
2633
2744
  ref: "User",
2634
2745
  required: true,
2635
- type: import_mongoose34.default.Schema.Types.ObjectId
2746
+ type: import_mongoose36.default.Schema.Types.ObjectId
2636
2747
  },
2637
- resourceId: { type: import_mongoose34.default.Schema.Types.ObjectId },
2638
- resourceType: { enum: Object.values(import_cluemart_shared23.EnumResourceType), type: String },
2748
+ resourceId: { type: import_mongoose36.default.Schema.Types.ObjectId },
2749
+ resourceType: { enum: Object.values(import_cluemart_shared24.EnumResourceType), type: String },
2639
2750
  sessionId: {
2640
2751
  ref: "ImpersonationSession",
2641
2752
  required: true,
2642
- type: import_mongoose34.default.Schema.Types.ObjectId
2753
+ type: import_mongoose36.default.Schema.Types.ObjectId
2643
2754
  }
2644
2755
  },
2645
2756
  { timestamps: true }
2646
2757
  );
2647
- var ImpersonationAuditModel = import_mongoose34.default.models.ImpersonationAudit || import_mongoose34.default.model(
2758
+ var ImpersonationAuditModel = import_mongoose36.default.models.ImpersonationAudit || import_mongoose36.default.model(
2648
2759
  "ImpersonationAudit",
2649
2760
  impersonationAuditSchema
2650
2761
  );
@@ -2665,7 +2776,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
2665
2776
  }
2666
2777
 
2667
2778
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2668
- var import_cluemart_shared25 = require("@timardex/cluemart-shared");
2779
+ var import_cluemart_shared26 = require("@timardex/cluemart-shared");
2669
2780
  var import_utils3 = require("@timardex/cluemart-shared/utils");
2670
2781
 
2671
2782
  // src/service/saveNotificationsInDb.ts
@@ -2800,7 +2911,7 @@ async function sendPushNotifications({
2800
2911
  }
2801
2912
 
2802
2913
  // src/service/affiliate/vendorSubscriptionRewards.ts
2803
- var import_cluemart_shared24 = require("@timardex/cluemart-shared");
2914
+ var import_cluemart_shared25 = require("@timardex/cluemart-shared");
2804
2915
  var import_dayjs = __toESM(require("dayjs"));
2805
2916
  var import_timezone = __toESM(require("dayjs/plugin/timezone"));
2806
2917
  var import_utc = __toESM(require("dayjs/plugin/utc"));
@@ -2858,17 +2969,17 @@ async function getPayingEventStripeSubscriptionPlan(userId, now = /* @__PURE__ *
2858
2969
  // src/service/affiliate/vendorSubscriptionRewards.ts
2859
2970
  import_dayjs.default.extend(import_utc.default);
2860
2971
  import_dayjs.default.extend(import_timezone.default);
2861
- var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared24.NZ_TZ;
2972
+ var SUBSCRIPTION_REWARD_TIMEZONE = import_cluemart_shared25.NZ_TZ;
2862
2973
  async function mapVendorLicenceToSubscriptionRewardType(userId, now = /* @__PURE__ */ new Date()) {
2863
2974
  const { hasSubscription, validTypes } = await getVendorStripeSubscriptionPlanForRewards(userId, now);
2864
- if (validTypes.has(import_cluemart_shared24.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared24.EnumUserLicence.PRO_PLUS_VENDOR)) {
2975
+ if (validTypes.has(import_cluemart_shared25.EnumUserLicence.PRO_VENDOR) || validTypes.has(import_cluemart_shared25.EnumUserLicence.PRO_PLUS_VENDOR)) {
2865
2976
  if (hasSubscription) {
2866
- return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
2977
+ return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_PRO_SUBSCRIPTION;
2867
2978
  }
2868
- return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2979
+ return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2869
2980
  }
2870
- if (validTypes.has(import_cluemart_shared24.EnumUserLicence.STANDARD_VENDOR)) {
2871
- return import_cluemart_shared24.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2981
+ if (validTypes.has(import_cluemart_shared25.EnumUserLicence.STANDARD_VENDOR)) {
2982
+ return import_cluemart_shared25.EnumAffiliateRewardType.ACTIVE_VENDOR_STANDARD_SUBSCRIPTION;
2872
2983
  }
2873
2984
  return null;
2874
2985
  }
@@ -2880,7 +2991,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
2880
2991
 
2881
2992
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2882
2993
  function isEligibleVendorResource(resource) {
2883
- return resource.resourceType === import_cluemart_shared25.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2994
+ return resource.resourceType === import_cluemart_shared26.EnumResourceType.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2884
2995
  }
2885
2996
  async function findAffiliatesWithActiveVendorReferrals() {
2886
2997
  return await AffiliateModel.find({
@@ -2889,7 +3000,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
2889
3000
  $elemMatch: {
2890
3001
  resourceActive: true,
2891
3002
  resourceDeletedAt: null,
2892
- resourceType: import_cluemart_shared25.EnumResourceType.VENDOR
3003
+ resourceType: import_cluemart_shared26.EnumResourceType.VENDOR
2893
3004
  }
2894
3005
  },
2895
3006
  deletedAt: null
@@ -2923,11 +3034,11 @@ async function notifyAffiliateOwnerOfSubscriptionReward({
2923
3034
  data: {
2924
3035
  resourceId: String(affiliateId),
2925
3036
  resourceName: resourceNames.join(", "),
2926
- resourceType: import_cluemart_shared25.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
3037
+ resourceType: import_cluemart_shared26.EnumNotificationResourceType.AFFILIATE_REWARD_RECEIVED
2927
3038
  },
2928
3039
  message,
2929
3040
  title: "Affiliate points earned",
2930
- type: import_cluemart_shared25.EnumNotificationType.SYSTEM,
3041
+ type: import_cluemart_shared26.EnumNotificationType.SYSTEM,
2931
3042
  userIds: [affiliateOwnerUserId]
2932
3043
  };
2933
3044
  try {
@@ -2956,7 +3067,7 @@ async function tryAwardSubscriptionReward({
2956
3067
  resourceActive: true,
2957
3068
  resourceDeletedAt: null,
2958
3069
  resourceId: resource.resourceId,
2959
- resourceType: import_cluemart_shared25.EnumResourceType.VENDOR,
3070
+ resourceType: import_cluemart_shared26.EnumResourceType.VENDOR,
2960
3071
  rewards: {
2961
3072
  $not: {
2962
3073
  $elemMatch: {
@@ -3077,7 +3188,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
3077
3188
  }
3078
3189
 
3079
3190
  // src/service/database.ts
3080
- var import_mongoose38 = __toESM(require("mongoose"));
3191
+ var import_mongoose40 = __toESM(require("mongoose"));
3081
3192
  var connectToDatabase = async ({
3082
3193
  appName,
3083
3194
  dbName,
@@ -3090,7 +3201,7 @@ var connectToDatabase = async ({
3090
3201
  // Fallback to MongoDB Atlas connection string
3091
3202
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
3092
3203
  );
3093
- await import_mongoose38.default.connect(mongoUri);
3204
+ await import_mongoose40.default.connect(mongoUri);
3094
3205
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
3095
3206
  console.log(
3096
3207
  `${connectionType} connected from server/src/service/database.ts`
@@ -3103,7 +3214,7 @@ var connectToDatabase = async ({
3103
3214
 
3104
3215
  // src/types/index.ts
3105
3216
  var import_express = __toESM(require("express"));
3106
- var import_mongoose39 = __toESM(require("mongoose"));
3217
+ var import_mongoose41 = __toESM(require("mongoose"));
3107
3218
 
3108
3219
  // src/service/notifyUsers.ts
3109
3220
  async function publishNotificationEvents(userId, pubsub) {
@@ -3151,9 +3262,9 @@ async function notifyUsers({
3151
3262
  }
3152
3263
 
3153
3264
  // src/service/updateAdStatus.ts
3154
- var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3265
+ var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3155
3266
  async function updateAdStatuses() {
3156
- const now = (0, import_cluemart_shared26.nzDayKey)();
3267
+ const now = (0, import_cluemart_shared27.nzDayKey)();
3157
3268
  const invalidResult = await AdModel.updateMany(
3158
3269
  {
3159
3270
  $or: [
@@ -3161,50 +3272,50 @@ async function updateAdStatuses() {
3161
3272
  { end: { $exists: false } },
3162
3273
  { $expr: { $gt: ["$start", "$end"] } }
3163
3274
  ],
3164
- status: { $ne: import_cluemart_shared26.EnumAdStatus.PAUSED }
3275
+ status: { $ne: import_cluemart_shared27.EnumAdStatus.PAUSED }
3165
3276
  },
3166
- { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3277
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
3167
3278
  );
3168
3279
  const expiredResult = await AdModel.updateMany(
3169
- { end: { $lte: now }, status: { $ne: import_cluemart_shared26.EnumAdStatus.EXPIRED } },
3170
- { $set: { status: import_cluemart_shared26.EnumAdStatus.EXPIRED } }
3280
+ { end: { $lte: now }, status: { $ne: import_cluemart_shared27.EnumAdStatus.EXPIRED } },
3281
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.EXPIRED } }
3171
3282
  );
3172
3283
  const eligibleBooking = {
3173
3284
  $or: [
3174
3285
  { bookingKind: { $exists: false } },
3175
3286
  { bookingKind: null },
3176
3287
  {
3177
- approvalStatus: import_cluemart_shared26.EnumAdApprovalStatus.APPROVED,
3178
- bookingKind: import_cluemart_shared26.EnumAdBookingSlotKind.RESERVED
3288
+ approvalStatus: import_cluemart_shared27.EnumAdApprovalStatus.APPROVED,
3289
+ bookingKind: import_cluemart_shared27.EnumAdBookingSlotKind.RESERVED
3179
3290
  },
3180
3291
  {
3181
- approvalStatus: import_cluemart_shared26.EnumAdApprovalStatus.APPROVED,
3182
- bookingKind: import_cluemart_shared26.EnumAdBookingSlotKind.PAID,
3183
- paymentStatus: import_cluemart_shared26.EnumAdPaymentStatus.PAID
3292
+ approvalStatus: import_cluemart_shared27.EnumAdApprovalStatus.APPROVED,
3293
+ bookingKind: import_cluemart_shared27.EnumAdBookingSlotKind.PAID,
3294
+ paymentStatus: import_cluemart_shared27.EnumAdPaymentStatus.PAID
3184
3295
  }
3185
3296
  ]
3186
3297
  };
3187
3298
  const awaitingApprovalResult = await AdModel.updateMany(
3188
3299
  {
3189
3300
  $nor: eligibleBooking.$or,
3190
- bookingKind: { $in: Object.values(import_cluemart_shared26.EnumAdBookingSlotKind) },
3301
+ bookingKind: { $in: Object.values(import_cluemart_shared27.EnumAdBookingSlotKind) },
3191
3302
  end: { $gt: now },
3192
- status: import_cluemart_shared26.EnumAdStatus.ACTIVE
3303
+ status: import_cluemart_shared27.EnumAdStatus.ACTIVE
3193
3304
  },
3194
- { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3305
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
3195
3306
  );
3196
3307
  const activeResult = await AdModel.updateMany(
3197
3308
  {
3198
3309
  end: { $gt: now },
3199
3310
  start: { $lte: now },
3200
- status: { $ne: import_cluemart_shared26.EnumAdStatus.ACTIVE },
3311
+ status: { $ne: import_cluemart_shared27.EnumAdStatus.ACTIVE },
3201
3312
  ...eligibleBooking
3202
3313
  },
3203
- { $set: { status: import_cluemart_shared26.EnumAdStatus.ACTIVE } }
3314
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.ACTIVE } }
3204
3315
  );
3205
3316
  const pausedResult = await AdModel.updateMany(
3206
- { start: { $gt: now }, status: { $ne: import_cluemart_shared26.EnumAdStatus.PAUSED } },
3207
- { $set: { status: import_cluemart_shared26.EnumAdStatus.PAUSED } }
3317
+ { start: { $gt: now }, status: { $ne: import_cluemart_shared27.EnumAdStatus.PAUSED } },
3318
+ { $set: { status: import_cluemart_shared27.EnumAdStatus.PAUSED } }
3208
3319
  );
3209
3320
  console.log(
3210
3321
  `\u2705 Ad statuses updated: invalid=${invalidResult.modifiedCount}, expired=${expiredResult.modifiedCount}, awaitingApproval=${awaitingApprovalResult.modifiedCount}, active=${activeResult.modifiedCount}, paused=${pausedResult.modifiedCount}`
@@ -3212,15 +3323,15 @@ async function updateAdStatuses() {
3212
3323
  }
3213
3324
 
3214
3325
  // src/service/objectIdToString.ts
3215
- var import_mongoose41 = __toESM(require("mongoose"));
3326
+ var import_mongoose43 = __toESM(require("mongoose"));
3216
3327
  function isValidObjectId(value) {
3217
- return import_mongoose41.default.Types.ObjectId.isValid(value);
3328
+ return import_mongoose43.default.Types.ObjectId.isValid(value);
3218
3329
  }
3219
3330
  function convertObjectIdsToStrings(obj) {
3220
3331
  if (obj === null || obj === void 0) {
3221
3332
  return obj;
3222
3333
  }
3223
- if (obj instanceof import_mongoose41.default.Types.ObjectId) {
3334
+ if (obj instanceof import_mongoose43.default.Types.ObjectId) {
3224
3335
  return obj.toString();
3225
3336
  }
3226
3337
  if (obj instanceof Date) {
@@ -3414,19 +3525,19 @@ function buildUserPointEntryRemovalPipeline(pointType, sourceId) {
3414
3525
  }
3415
3526
 
3416
3527
  // src/service/event/updateAllEventDateTimeStatuses.ts
3417
- var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3528
+ var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3418
3529
  var import_dayjs4 = __toESM(require("dayjs"));
3419
3530
 
3420
3531
  // src/service/event/archiveEndedEventDates.ts
3421
- var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3532
+ var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3422
3533
  var import_dayjs3 = __toESM(require("dayjs"));
3423
3534
  var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
3424
3535
  import_dayjs3.default.extend(import_customParseFormat.default);
3425
3536
  var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
3426
- import_cluemart_shared27.EnumEventDateStatus.ENDED
3537
+ import_cluemart_shared28.EnumEventDateStatus.ENDED
3427
3538
  ]);
3428
3539
  var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
3429
- import_cluemart_shared27.EnumEventDateStatus.INVALID
3540
+ import_cluemart_shared28.EnumEventDateStatus.INVALID
3430
3541
  ]);
3431
3542
  function splitEventDatesForArchive(dateTime) {
3432
3543
  return {
@@ -3449,12 +3560,12 @@ function dedupeArchivedSlotsByStartDateTime(slots) {
3449
3560
  });
3450
3561
  }
3451
3562
  function isPastCanceledEventDate(slot, now) {
3452
- if (slot.dateStatus !== import_cluemart_shared27.EnumEventDateStatus.CANCELED) {
3563
+ if (slot.dateStatus !== import_cluemart_shared28.EnumEventDateStatus.CANCELED) {
3453
3564
  return false;
3454
3565
  }
3455
3566
  const endDateTime = (0, import_dayjs3.default)(
3456
3567
  `${slot.endDate} ${slot.endTime}`,
3457
- `${import_cluemart_shared27.dateFormat} ${import_cluemart_shared27.timeFormat}`,
3568
+ `${import_cluemart_shared28.dateFormat} ${import_cluemart_shared28.timeFormat}`,
3458
3569
  true
3459
3570
  );
3460
3571
  return endDateTime.isValid() && endDateTime.isBefore(now);
@@ -3500,7 +3611,7 @@ async function updateModelDateTimeStatuses(model, now) {
3500
3611
  try {
3501
3612
  for await (const doc of cursor) {
3502
3613
  const dateTime = doc.dateTime.map(
3503
- (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3614
+ (slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
3504
3615
  );
3505
3616
  if (!hasDateTimeStatusChanges(doc.dateTime, dateTime)) {
3506
3617
  continue;
@@ -3524,9 +3635,9 @@ async function updateModelDateTimeStatuses(model, now) {
3524
3635
  var ARCHIVABLE_EVENT_FILTER = {
3525
3636
  "dateTime.dateStatus": {
3526
3637
  $in: [
3527
- import_cluemart_shared28.EnumEventDateStatus.ENDED,
3528
- import_cluemart_shared28.EnumEventDateStatus.INVALID,
3529
- import_cluemart_shared28.EnumEventDateStatus.CANCELED
3638
+ import_cluemart_shared29.EnumEventDateStatus.ENDED,
3639
+ import_cluemart_shared29.EnumEventDateStatus.INVALID,
3640
+ import_cluemart_shared29.EnumEventDateStatus.CANCELED
3530
3641
  ]
3531
3642
  },
3532
3643
  deletedAt: null
@@ -3551,7 +3662,7 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3551
3662
  try {
3552
3663
  for await (const doc of cursor) {
3553
3664
  const updated = doc.dateTime.map(
3554
- (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3665
+ (slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
3555
3666
  );
3556
3667
  const { archive, discard } = splitEventDatesForArchive(updated);
3557
3668
  const pastCanceled = updated.filter(
@@ -3575,13 +3686,13 @@ async function archiveEndedAndDiscardInvalidEventDates(now) {
3575
3686
  if (archive.length > 0 || discard.length > 0) {
3576
3687
  pullConditions.push({
3577
3688
  dateStatus: {
3578
- $in: [import_cluemart_shared28.EnumEventDateStatus.ENDED, import_cluemart_shared28.EnumEventDateStatus.INVALID]
3689
+ $in: [import_cluemart_shared29.EnumEventDateStatus.ENDED, import_cluemart_shared29.EnumEventDateStatus.INVALID]
3579
3690
  }
3580
3691
  });
3581
3692
  }
3582
3693
  for (const slot of pastCanceled) {
3583
3694
  pullConditions.push({
3584
- dateStatus: import_cluemart_shared28.EnumEventDateStatus.CANCELED,
3695
+ dateStatus: import_cluemart_shared29.EnumEventDateStatus.CANCELED,
3585
3696
  startDate: slot.startDate,
3586
3697
  startTime: slot.startTime
3587
3698
  });
@@ -3623,9 +3734,9 @@ async function cleanEventInfoDates(now) {
3623
3734
  try {
3624
3735
  for await (const doc of cursor) {
3625
3736
  const updated = doc.dateTime.map(
3626
- (slot) => (0, import_cluemart_shared28.updateSingleDateTimeStatus)(slot, now)
3737
+ (slot) => (0, import_cluemart_shared29.updateSingleDateTimeStatus)(slot, now)
3627
3738
  );
3628
- const kept = (0, import_cluemart_shared28.filterDatesByFutureStatus)(updated);
3739
+ const kept = (0, import_cluemart_shared29.filterDatesByFutureStatus)(updated);
3629
3740
  if (kept.length === updated.length) {
3630
3741
  continue;
3631
3742
  }
@@ -3648,15 +3759,19 @@ async function cleanEventInfoDates(now) {
3648
3759
  }
3649
3760
  async function updateAllEventDateTimeStatuses() {
3650
3761
  const now = (0, import_dayjs4.default)();
3651
- const [eventCount, marketCount] = await Promise.all([
3762
+ const [eventCount, marketCount, aiMarketCount] = await Promise.all([
3652
3763
  updateModelDateTimeStatuses(EventModel, now),
3653
3764
  updateModelDateTimeStatuses(
3654
3765
  GoogleImportedMarketModel,
3655
3766
  now
3767
+ ),
3768
+ updateModelDateTimeStatuses(
3769
+ AiImportedMarketModel,
3770
+ now
3656
3771
  )
3657
3772
  ]);
3658
3773
  console.log(
3659
- `\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed`
3774
+ `\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed, ai imported markets=${aiMarketCount} changed`
3660
3775
  );
3661
3776
  const archivedCount = await archiveEndedAndDiscardInvalidEventDates(now);
3662
3777
  if (archivedCount > 0) {
@@ -3671,7 +3786,7 @@ async function updateAllEventDateTimeStatuses() {
3671
3786
  }
3672
3787
 
3673
3788
  // src/service/index.ts
3674
- var import_cluemart_shared36 = require("@timardex/cluemart-shared");
3789
+ var import_cluemart_shared37 = require("@timardex/cluemart-shared");
3675
3790
 
3676
3791
  // src/service/event/findEventOrImportedMarketById.ts
3677
3792
  async function findEventOrImportedMarketById(resourceId) {
@@ -3679,15 +3794,16 @@ async function findEventOrImportedMarketById(resourceId) {
3679
3794
  return null;
3680
3795
  }
3681
3796
  const normalizedId = convertObjectIdsToStrings(resourceId);
3682
- const [eventDoc, googleImportedDoc] = await Promise.all([
3797
+ const [eventDoc, googleImportedDoc, aiImportedDoc] = await Promise.all([
3683
3798
  EventModel.findById(normalizedId).select("_id name dateTime owner").lean().exec(),
3684
- GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
3799
+ GoogleImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec(),
3800
+ AiImportedMarketModel.findById(normalizedId).select("_id name dateTime").lean().exec()
3685
3801
  ]);
3686
- return eventDoc ?? googleImportedDoc;
3802
+ return eventDoc ?? googleImportedDoc ?? aiImportedDoc;
3687
3803
  }
3688
3804
 
3689
3805
  // src/service/relations.ts
3690
- var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3806
+ var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3691
3807
  function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
3692
3808
  if (!previousDateTime?.length) {
3693
3809
  return false;
@@ -3703,8 +3819,8 @@ function didRemoveAnyStartedDates(previousDateTime, nextDateTime) {
3703
3819
  return false;
3704
3820
  }
3705
3821
  return previousDateTime.some(
3706
- (prev) => prev.dateStatus === import_cluemart_shared29.EnumEventDateStatus.STARTED && !nextDateTime?.some(
3707
- (next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared29.EnumEventDateStatus.STARTED
3822
+ (prev) => prev.dateStatus === import_cluemart_shared30.EnumEventDateStatus.STARTED && !nextDateTime?.some(
3823
+ (next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === import_cluemart_shared30.EnumEventDateStatus.STARTED
3708
3824
  )
3709
3825
  );
3710
3826
  }
@@ -3715,7 +3831,7 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
3715
3831
  ) ?? false;
3716
3832
  return {
3717
3833
  ...relationDate,
3718
- status: existsInEvent ? relationDate.status : import_cluemart_shared29.EnumInviteStatus.CANCELED
3834
+ status: existsInEvent ? relationDate.status : import_cluemart_shared30.EnumInviteStatus.CANCELED
3719
3835
  };
3720
3836
  });
3721
3837
  }
@@ -3724,15 +3840,15 @@ function updateRelationDatesToCanceled(relationDates, eventDateTime) {
3724
3840
  var import_dayjs8 = __toESM(require("dayjs"));
3725
3841
 
3726
3842
  // src/service/license/compliance/utils.ts
3727
- var import_cluemart_shared34 = require("@timardex/cluemart-shared");
3843
+ var import_cluemart_shared35 = require("@timardex/cluemart-shared");
3728
3844
  var import_dayjs7 = __toESM(require("dayjs"));
3729
3845
 
3730
3846
  // src/service/license/compliance/event.ts
3731
- var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3847
+ var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3732
3848
  var eventLicences = [
3733
- import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT,
3734
- import_cluemart_shared30.EnumUserLicence.PRO_EVENT,
3735
- import_cluemart_shared30.EnumUserLicence.PRO_PLUS_EVENT
3849
+ import_cluemart_shared31.EnumUserLicence.STANDARD_EVENT,
3850
+ import_cluemart_shared31.EnumUserLicence.PRO_EVENT,
3851
+ import_cluemart_shared31.EnumUserLicence.PRO_PLUS_EVENT
3736
3852
  ];
3737
3853
  async function handleEventLicenceCompliance(user, now) {
3738
3854
  if (!user.licences || !user.events?.length) {
@@ -3944,9 +4060,9 @@ function buildLicenceExpiryPipeline(params) {
3944
4060
  }
3945
4061
 
3946
4062
  // src/service/license/compliance/partner.ts
3947
- var import_cluemart_shared31 = require("@timardex/cluemart-shared");
4063
+ var import_cluemart_shared32 = require("@timardex/cluemart-shared");
3948
4064
  var partnerLicences = [
3949
- import_cluemart_shared31.EnumUserLicence.STANDARD_PARTNER
4065
+ import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER
3950
4066
  ];
3951
4067
  async function handlePartnerLicenceCompliance(user, now) {
3952
4068
  if (!user.licences || !user.partner) {
@@ -3956,11 +4072,11 @@ async function handlePartnerLicenceCompliance(user, now) {
3956
4072
  }
3957
4073
 
3958
4074
  // src/service/license/compliance/vendor.ts
3959
- var import_cluemart_shared33 = require("@timardex/cluemart-shared");
4075
+ var import_cluemart_shared34 = require("@timardex/cluemart-shared");
3960
4076
  var import_dayjs6 = __toESM(require("dayjs"));
3961
4077
 
3962
4078
  // src/service/license/models.ts
3963
- var import_cluemart_shared32 = require("@timardex/cluemart-shared");
4079
+ var import_cluemart_shared33 = require("@timardex/cluemart-shared");
3964
4080
  var import_dayjs5 = __toESM(require("dayjs"));
3965
4081
  var import_graphql = require("graphql");
3966
4082
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
@@ -3972,31 +4088,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
3972
4088
  return LicenceCategory2;
3973
4089
  })(LicenceCategory || {});
3974
4090
  var licenceCategoryMapping = {
3975
- [import_cluemart_shared32.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
3976
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
3977
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
3978
- [import_cluemart_shared32.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
3979
- [import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
3980
- [import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
3981
- [import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
3982
- [import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
3983
- [import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
4091
+ [import_cluemart_shared33.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
4092
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
4093
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
4094
+ [import_cluemart_shared33.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
4095
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
4096
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
4097
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
4098
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
4099
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
3984
4100
  };
3985
4101
  var licencePriority = {
3986
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_EVENT]: 3,
3987
- [import_cluemart_shared32.EnumUserLicence.PRO_EVENT]: 2,
3988
- [import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT]: 1,
3989
- [import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
3990
- [import_cluemart_shared32.EnumUserLicence.PRO_VENDOR]: 2,
3991
- [import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR]: 1,
3992
- [import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER]: 1,
3993
- [import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE]: 1,
3994
- [import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL]: 1
4102
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_EVENT]: 3,
4103
+ [import_cluemart_shared33.EnumUserLicence.PRO_EVENT]: 2,
4104
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT]: 1,
4105
+ [import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
4106
+ [import_cluemart_shared33.EnumUserLicence.PRO_VENDOR]: 2,
4107
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR]: 1,
4108
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER]: 1,
4109
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE]: 1,
4110
+ [import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL]: 1
3995
4111
  };
3996
4112
  var standardLicences = [
3997
- import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR,
3998
- import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
3999
- import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER
4113
+ import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR,
4114
+ import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT,
4115
+ import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER
4000
4116
  ];
4001
4117
  var standardLicenceSet = new Set(standardLicences);
4002
4118
  function isStandardLicence(licence) {
@@ -4010,11 +4126,11 @@ var categoryRegexMapping = {
4010
4126
  ["school" /* SCHOOL */]: /_school$/
4011
4127
  };
4012
4128
  var categoryFallbackLicence = {
4013
- ["event" /* EVENT */]: import_cluemart_shared32.EnumUserLicence.STANDARD_EVENT,
4014
- ["partner" /* PARTNER */]: import_cluemart_shared32.EnumUserLicence.STANDARD_PARTNER,
4015
- ["vendor" /* VENDOR */]: import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR,
4016
- ["affiliate" /* AFFILIATE */]: import_cluemart_shared32.EnumUserLicence.STANDARD_AFFILIATE,
4017
- ["school" /* SCHOOL */]: import_cluemart_shared32.EnumUserLicence.STANDARD_SCHOOL
4129
+ ["event" /* EVENT */]: import_cluemart_shared33.EnumUserLicence.STANDARD_EVENT,
4130
+ ["partner" /* PARTNER */]: import_cluemart_shared33.EnumUserLicence.STANDARD_PARTNER,
4131
+ ["vendor" /* VENDOR */]: import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR,
4132
+ ["affiliate" /* AFFILIATE */]: import_cluemart_shared33.EnumUserLicence.STANDARD_AFFILIATE,
4133
+ ["school" /* SCHOOL */]: import_cluemart_shared33.EnumUserLicence.STANDARD_SCHOOL
4018
4134
  };
4019
4135
  var LicenceFilterInput = {
4020
4136
  INPUT_USER_LICENCES: "$licences"
@@ -4044,11 +4160,11 @@ function getHighestLicenceForCategory(licences, category) {
4044
4160
  function createLicenceObject(expiryDate, licenceType) {
4045
4161
  const today = (0, import_dayjs5.default)();
4046
4162
  const expiryDateMapping = {
4047
- [import_cluemart_shared32.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
4048
- [import_cluemart_shared32.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
4049
- [import_cluemart_shared32.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
4050
- [import_cluemart_shared32.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
4051
- [import_cluemart_shared32.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
4163
+ [import_cluemart_shared33.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
4164
+ [import_cluemart_shared33.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
4165
+ [import_cluemart_shared33.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
4166
+ [import_cluemart_shared33.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
4167
+ [import_cluemart_shared33.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
4052
4168
  };
4053
4169
  const licenceObject = {
4054
4170
  expiryDate: expiryDateMapping[expiryDate],
@@ -4152,13 +4268,13 @@ async function checkOwnerHasLicence({
4152
4268
  const owner = await UserModel.findById(userId);
4153
4269
  if (!owner) throw new import_graphql.GraphQLError("Owner not found");
4154
4270
  const categoryByResource = {
4155
- [import_cluemart_shared32.EnumResourceType.EVENT]: "event" /* EVENT */,
4156
- [import_cluemart_shared32.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
4157
- [import_cluemart_shared32.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
4158
- [import_cluemart_shared32.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
4159
- [import_cluemart_shared32.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
4271
+ [import_cluemart_shared33.EnumResourceType.EVENT]: "event" /* EVENT */,
4272
+ [import_cluemart_shared33.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
4273
+ [import_cluemart_shared33.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
4274
+ [import_cluemart_shared33.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
4275
+ [import_cluemart_shared33.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
4160
4276
  };
4161
- if (!(0, import_cluemart_shared32.isNonVisitorResourceType)(resourceType)) {
4277
+ if (!(0, import_cluemart_shared33.isNonVisitorResourceType)(resourceType)) {
4162
4278
  throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
4163
4279
  }
4164
4280
  const requiredCategory = categoryByResource[resourceType];
@@ -4238,7 +4354,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
4238
4354
  return (result?.matchedCount ?? 0) > 0;
4239
4355
  }
4240
4356
  async function downgradeVendorProFeatures(userId, licenceType) {
4241
- const isStandardVendor = licenceType === import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR;
4357
+ const isStandardVendor = licenceType === import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR;
4242
4358
  if (!isStandardVendor) {
4243
4359
  return;
4244
4360
  }
@@ -4285,7 +4401,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
4285
4401
  return (result?.matchedCount ?? 0) > 0;
4286
4402
  }
4287
4403
  async function restoreVendorProFeatures(userId, licenceType) {
4288
- const isProVendor = licenceType === import_cluemart_shared33.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR;
4404
+ const isProVendor = licenceType === import_cluemart_shared34.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR;
4289
4405
  if (!isProVendor) {
4290
4406
  return;
4291
4407
  }
@@ -4306,14 +4422,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
4306
4422
  return false;
4307
4423
  }
4308
4424
  const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs6.default)(stripe.paymentGracePeriodEndsAt) : null;
4309
- const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared33.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared33.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
4425
+ 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);
4310
4426
  if (hasActivePaymentGracePeriod) {
4311
4427
  return true;
4312
4428
  }
4313
4429
  if (!stripe.subscriptionId) {
4314
4430
  return false;
4315
4431
  }
4316
- if (stripe.status !== import_cluemart_shared33.EnumSubscriptionStatus.ACTIVE) {
4432
+ if (stripe.status !== import_cluemart_shared34.EnumSubscriptionStatus.ACTIVE) {
4317
4433
  return false;
4318
4434
  }
4319
4435
  if (!stripe.endDate) {
@@ -4333,7 +4449,7 @@ async function handleVendorLicenceCompliance(user, now) {
4333
4449
  return;
4334
4450
  }
4335
4451
  const proLicences = vendorLicencesOfUser.filter(
4336
- (licence) => licence.licenceType !== import_cluemart_shared33.EnumUserLicence.STANDARD_VENDOR
4452
+ (licence) => licence.licenceType !== import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4337
4453
  );
4338
4454
  const expiredProLicences = proLicences.filter(
4339
4455
  (licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now)
@@ -4346,7 +4462,7 @@ async function handleVendorLicenceCompliance(user, now) {
4346
4462
  const expiredProLicence = expiredProLicences.some(
4347
4463
  (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
4348
4464
  );
4349
- const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared33.vendorLicences, now);
4465
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared34.vendorLicences, now);
4350
4466
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
4351
4467
  (licence) => !(0, import_dayjs6.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
4352
4468
  );
@@ -4362,7 +4478,7 @@ async function handleVendorLicenceCompliance(user, now) {
4362
4478
  "owner.userId": user._id
4363
4479
  }).lean().exec();
4364
4480
  }
4365
- const licencesToSync = import_cluemart_shared33.vendorLicences.filter(
4481
+ const licencesToSync = import_cluemart_shared34.vendorLicences.filter(
4366
4482
  (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
4367
4483
  );
4368
4484
  await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
@@ -4377,11 +4493,11 @@ async function handleVendorLicenceCompliance(user, now) {
4377
4493
  data: {
4378
4494
  resourceId: String(vendor._id),
4379
4495
  resourceName: vendor.name,
4380
- resourceType: import_cluemart_shared33.EnumNotificationResourceType.DOWNGRADED_VENDOR
4496
+ resourceType: import_cluemart_shared34.EnumNotificationResourceType.DOWNGRADED_VENDOR
4381
4497
  },
4382
4498
  message: `Your Vendor licence has been downgraded due to licence expiration.`,
4383
4499
  title: `Vendor Licence Downgraded`,
4384
- type: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4500
+ type: import_cluemart_shared34.EnumNotificationType.SYSTEM,
4385
4501
  userIds: [user._id]
4386
4502
  };
4387
4503
  await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
@@ -4414,7 +4530,7 @@ async function vendorOwnerHasProLicence(vendorId) {
4414
4530
  effectiveVendorLicences,
4415
4531
  "vendor" /* VENDOR */
4416
4532
  );
4417
- return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared33.EnumUserLicence.PRO_VENDOR];
4533
+ return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared34.EnumUserLicence.PRO_VENDOR];
4418
4534
  }
4419
4535
 
4420
4536
  // src/service/license/compliance/utils.ts
@@ -4424,12 +4540,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
4424
4540
  const pipeline = buildLicenceExpiryPipeline({
4425
4541
  downgradeBranches: [
4426
4542
  {
4427
- case: import_cluemart_shared34.EnumUserLicence.PRO_PLUS_VENDOR,
4428
- then: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4543
+ case: import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR,
4544
+ then: import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
4429
4545
  },
4430
4546
  {
4431
- case: import_cluemart_shared34.EnumUserLicence.PRO_VENDOR,
4432
- then: import_cluemart_shared34.EnumUserLicence.STANDARD_VENDOR
4547
+ case: import_cluemart_shared35.EnumUserLicence.PRO_VENDOR,
4548
+ then: import_cluemart_shared35.EnumUserLicence.STANDARD_VENDOR
4433
4549
  }
4434
4550
  ],
4435
4551
  licenceTypes,
@@ -4558,7 +4674,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
4558
4674
  var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
4559
4675
 
4560
4676
  // src/service/license/reminder/utils.ts
4561
- var import_cluemart_shared35 = require("@timardex/cluemart-shared");
4677
+ var import_cluemart_shared36 = require("@timardex/cluemart-shared");
4562
4678
  var import_utils8 = require("@timardex/cluemart-shared/utils");
4563
4679
  var import_dayjs9 = __toESM(require("dayjs"));
4564
4680
 
@@ -4624,28 +4740,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
4624
4740
  return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
4625
4741
  }
4626
4742
  function getLicenseName(licenceType) {
4627
- return import_cluemart_shared35.licenseNiceNames[licenceType] || licenceType;
4743
+ return import_cluemart_shared36.licenseNiceNames[licenceType] || licenceType;
4628
4744
  }
4629
4745
  function getNotificationTypes(isVendorLicense, isPartnerLicense) {
4630
4746
  if (isVendorLicense) {
4631
4747
  return {
4632
- notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4633
- resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4748
+ notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
4749
+ resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4634
4750
  };
4635
4751
  }
4636
4752
  if (isPartnerLicense) {
4637
4753
  return {
4638
- notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4639
- resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4754
+ notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
4755
+ resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4640
4756
  };
4641
4757
  }
4642
4758
  return {
4643
- notificationType: import_cluemart_shared35.EnumNotificationType.SYSTEM,
4644
- resourceType: import_cluemart_shared35.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4759
+ notificationType: import_cluemart_shared36.EnumNotificationType.SYSTEM,
4760
+ resourceType: import_cluemart_shared36.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4645
4761
  };
4646
4762
  }
4647
4763
  async function getLicenseResourceInfo(user, licence) {
4648
- const isVendorLicense = import_cluemart_shared35.vendorLicences.includes(licence.licenceType);
4764
+ const isVendorLicense = import_cluemart_shared36.vendorLicences.includes(licence.licenceType);
4649
4765
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
4650
4766
  const licenceName = getLicenseName(licence.licenceType);
4651
4767
  const { notificationType, resourceType } = getNotificationTypes(
@@ -4693,11 +4809,11 @@ async function getLicenseResourceInfo(user, licence) {
4693
4809
  };
4694
4810
  }
4695
4811
  function getLicenceExpiryMode(licenceType) {
4696
- return licenceType === import_cluemart_shared35.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared35.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4812
+ return licenceType === import_cluemart_shared36.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared36.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4697
4813
  }
4698
4814
  async function sendLicenseReminder(user, licence) {
4699
4815
  const licenceName = getLicenseName(licence.licenceType);
4700
- const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared35.dateFormat);
4816
+ const expiryDate = (0, import_dayjs9.default)(licence.expiryDate).format(import_cluemart_shared36.dateFormat);
4701
4817
  const userId = String(user._id);
4702
4818
  const resourceInfo = await getLicenseResourceInfo(user, licence);
4703
4819
  if (!resourceInfo) {