@timardex/cluemart-server-shared 2.1.7 → 2.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  CouponModel: () => CouponModel,
50
50
  DEFAULT_AD_SETTINGS: () => DEFAULT_AD_SETTINGS,
51
51
  EnumPubSubEvents: () => EnumPubSubEvents,
52
+ EventDateArchiveModel: () => EventDateArchiveModel,
52
53
  EventInfoModel: () => EventInfoModel,
53
54
  EventModel: () => EventModel,
54
55
  GameModel: () => GameModel,
@@ -83,7 +84,8 @@ __export(index_exports, {
83
84
  connectToDatabase: () => connectToDatabase,
84
85
  convertObjectIdsToStrings: () => convertObjectIdsToStrings,
85
86
  createLicenceObject: () => createLicenceObject,
86
- dateTimeSchema: () => dateTimeSchema2,
87
+ dateTimeSchema: () => dateTimeSchema,
88
+ dedupeArchivedSlotsByStartDateTime: () => dedupeArchivedSlotsByStartDateTime,
87
89
  didRemoveAnyEventDates: () => didRemoveAnyEventDates,
88
90
  downgradeVendorProFeatures: () => downgradeVendorProFeatures,
89
91
  ensureUserLicenseCompliance: () => ensureUserLicenseCompliance,
@@ -114,11 +116,12 @@ __export(index_exports, {
114
116
  locationGeoSchema: () => locationGeoSchema,
115
117
  locationsSchema: () => locationsSchema,
116
118
  mapVendorLicenceToSubscriptionRewardType: () => mapVendorLicenceToSubscriptionRewardType,
117
- mongoose: () => import_mongoose36.default,
119
+ mongoose: () => import_mongoose37.default,
118
120
  normalizeAffiliatePromoCodes: () => normalizeAffiliatePromoCodes,
119
121
  normalizePromoCode: () => normalizePromoCode,
120
122
  notifyUsers: () => notifyUsers,
121
123
  partnerLicences: () => partnerLicences,
124
+ persistArchivedEventDates: () => persistArchivedEventDates,
122
125
  processLicenseReminder: () => processLicenseReminder,
123
126
  processUserCompliance: () => processUserCompliance,
124
127
  processUserLicenseReminders: () => processUserLicenseReminders,
@@ -128,7 +131,6 @@ __export(index_exports, {
128
131
  relationDatesSchema: () => relationDatesSchema,
129
132
  remindUsersAboutLicenseExpiration: () => remindUsersAboutLicenseExpiration,
130
133
  replaceUserLicenceWithObject: () => replaceUserLicenceWithObject,
131
- resourceRelationsSchema: () => resourceRelationsSchema,
132
134
  restoreVendorProFeatures: () => restoreVendorProFeatures,
133
135
  saveNotificationsInDb: () => saveNotificationsInDb,
134
136
  schemaAdresource: () => schemaAdresource,
@@ -137,6 +139,7 @@ __export(index_exports, {
137
139
  sendPushNotifications: () => sendPushNotifications,
138
140
  sendReminderSafely: () => sendReminderSafely,
139
141
  socialShareResourceSchema: () => socialShareResourceSchema,
142
+ splitEventDatesForArchive: () => splitEventDatesForArchive,
140
143
  syncUserLicencesAfterExpiry: () => syncUserLicencesAfterExpiry,
141
144
  termsAgreementSchema: () => termsAgreementSchema,
142
145
  updateAdStatuses: () => updateAdStatuses,
@@ -814,191 +817,22 @@ ChatReportSchema.index({ createdAt: -1, reporterUserId: 1 });
814
817
  var ChatReportModel = import_mongoose8.default.models.ChatReport || import_mongoose8.default.model("ChatReport", ChatReportSchema);
815
818
 
816
819
  // src/mongoose/global.ts
817
- var import_cluemart_shared9 = require("@timardex/cluemart-shared");
818
- var import_mongoose11 = __toESM(require("mongoose"));
819
-
820
- // src/mongoose/Relation.ts
821
- var import_cluemart_shared8 = require("@timardex/cluemart-shared");
822
- var import_mongoose10 = __toESM(require("mongoose"));
823
-
824
- // src/mongoose/event/EventInfo.ts
825
820
  var import_cluemart_shared7 = require("@timardex/cluemart-shared");
826
821
  var import_mongoose9 = __toESM(require("mongoose"));
827
822
  var MongooseSchema5 = import_mongoose9.default.Schema;
828
- var StallTypeSchema = new MongooseSchema5(
829
- {
830
- label: { required: false, type: String },
831
- price: { required: false, type: Number },
832
- stallCapacity: { required: false, type: Number }
833
- },
834
- {
835
- _id: false
836
- // Prevents Mongoose from creating an additional _id field for subdocuments
837
- }
838
- );
839
- var dateTimeSchema = new MongooseSchema5(
840
- {
841
- dateStatus: {
842
- enum: Object.values(import_cluemart_shared7.EnumEventDateStatus),
843
- required: false,
844
- type: String
845
- },
846
- endDate: { required: true, type: String },
847
- endTime: { required: true, type: String },
848
- stallTypes: [StallTypeSchema],
849
- startDate: { required: true, type: String },
850
- startTime: { required: true, type: String }
851
- },
852
- { _id: false }
853
- // Prevents Mongoose from creating an additional _id field for subdocuments
854
- );
855
- var paymentInfoSchema = new MongooseSchema5(
856
- {
857
- accountHolderName: { required: false, type: String },
858
- accountNumber: { required: false, type: String },
859
- link: { required: false, type: String },
860
- paymentMethod: {
861
- enum: Object.values(import_cluemart_shared7.EnumPaymentMethod),
862
- required: true,
863
- type: String
864
- }
865
- },
866
- { _id: false }
867
- // Prevents Mongoose from creating an additional _id field
868
- );
869
- var requirementsSchema = new MongooseSchema5(
870
- {
871
- category: { required: true, type: String },
872
- label: { required: true, type: String },
873
- value: { required: true, type: Boolean }
874
- },
875
- {
876
- _id: false
877
- // Prevents Mongoose from creating an additional _id field for
878
- }
879
- );
880
- var refundPolicySchema = new MongooseSchema5(
881
- {
882
- category: { required: true, type: String },
883
- label: { required: true, type: String },
884
- value: { required: true, type: Boolean }
885
- },
886
- { _id: false }
887
- );
888
- var schema7 = new MongooseSchema5(
889
- {
890
- active: { default: true, type: Boolean },
891
- applicationDeadlineHours: { required: true, type: Number },
892
- dateTime: { required: true, type: [dateTimeSchema] },
893
- eventId: {
894
- ref: "Event",
895
- required: true,
896
- type: import_mongoose9.default.Schema.Types.ObjectId
897
- },
898
- packInTime: { required: true, type: Number },
899
- paymentDueHours: { required: true, type: Number },
900
- paymentInfo: { required: true, type: [paymentInfoSchema] },
901
- refundPolicy: { required: true, type: [refundPolicySchema] },
902
- requirements: { required: false, type: [requirementsSchema] }
903
- },
904
- { timestamps: true }
905
- );
906
- schema7.index({ eventId: 1 });
907
- var EventInfoModel = import_mongoose9.default.models.EventInfo || import_mongoose9.default.model("EventInfo", schema7);
908
-
909
- // src/mongoose/Relation.ts
910
- var MongooseSchema6 = import_mongoose10.default.Schema;
911
- var relationDateTimeSchema = new MongooseSchema6(
912
- {
913
- dateStatus: {
914
- enum: Object.values(import_cluemart_shared8.EnumEventDateStatus),
915
- required: true,
916
- type: String
917
- },
918
- endDate: { required: true, type: String },
919
- endTime: { required: true, type: String },
920
- stallType: StallTypeSchema,
921
- startDate: { required: true, type: String },
922
- startTime: { required: true, type: String }
923
- },
924
- { _id: false }
925
- );
926
- var relationDatesSchema = new MongooseSchema6(
927
- {
928
- dateTime: {
929
- required: true,
930
- type: relationDateTimeSchema
931
- },
932
- lastUpdateBy: {
933
- resourceId: { required: false, type: String },
934
- userEmail: { required: false, type: String }
935
- },
936
- paymentReference: { required: false, type: String },
937
- status: {
938
- enum: Object.values(import_cluemart_shared8.EnumInviteStatus),
939
- required: false,
940
- type: String
941
- }
942
- },
943
- { _id: false }
944
- );
945
- var RelationTypeSchema = new MongooseSchema6(
946
- {
947
- active: { default: true, required: true, type: Boolean },
948
- chatId: {
949
- ref: "Chat",
950
- required: true,
951
- type: import_mongoose10.default.Schema.Types.ObjectId
952
- },
953
- deletedAt: { default: null, required: false, type: Date },
954
- eventId: {
955
- ref: "Event",
956
- required: true,
957
- type: import_mongoose10.default.Schema.Types.ObjectId
958
- },
959
- lastUpdateBy: {
960
- enum: Object.values(import_cluemart_shared8.EnumResourceType),
961
- required: true,
962
- type: String
963
- },
964
- relationDates: [relationDatesSchema],
965
- relationType: {
966
- enum: Object.values(import_cluemart_shared8.EnumRelationResource),
967
- required: true,
968
- type: String
969
- },
970
- vendorId: {
971
- ref: "Vendor",
972
- required: true,
973
- type: import_mongoose10.default.Schema.Types.ObjectId
974
- }
975
- },
976
- { timestamps: true }
977
- );
978
- RelationTypeSchema.index({
979
- eventId: 1,
980
- "relationDates.startDate": 1,
981
- "relationDates.startTime": 1,
982
- "relationDates.status": 1,
983
- vendorId: 1
984
- });
985
- var RelationModel = import_mongoose10.default.models.Relation || import_mongoose10.default.model("Relation", RelationTypeSchema);
986
-
987
- // src/mongoose/global.ts
988
- var MongooseSchema7 = import_mongoose11.default.Schema;
989
- var OwnerTypeSchema = new MongooseSchema7(
823
+ var OwnerTypeSchema = new MongooseSchema5(
990
824
  {
991
825
  email: { required: true, type: String },
992
826
  userId: {
993
827
  ref: "User",
994
828
  required: true,
995
- type: import_mongoose11.default.Schema.Types.ObjectId
829
+ type: import_mongoose9.default.Schema.Types.ObjectId
996
830
  }
997
831
  },
998
832
  { _id: false }
999
833
  // Prevents Mongoose from creating an additional _id field for subdocuments
1000
834
  );
1001
- var SocialMediaTypeSchema = new MongooseSchema7(
835
+ var SocialMediaTypeSchema = new MongooseSchema5(
1002
836
  {
1003
837
  link: { required: true, type: String },
1004
838
  name: { required: true, type: String }
@@ -1006,7 +840,7 @@ var SocialMediaTypeSchema = new MongooseSchema7(
1006
840
  { _id: false }
1007
841
  // Prevents Mongoose from creating an additional _id field
1008
842
  );
1009
- var ResourceImageTypeSchema = new MongooseSchema7(
843
+ var ResourceImageTypeSchema = new MongooseSchema5(
1010
844
  {
1011
845
  active: { default: true, required: true, type: Boolean },
1012
846
  source: { required: false, type: String },
@@ -1015,7 +849,7 @@ var ResourceImageTypeSchema = new MongooseSchema7(
1015
849
  { _id: false }
1016
850
  // Prevents Mongoose from creating an additional _id field for subdocuments
1017
851
  );
1018
- var SubCategorySchema = new MongooseSchema7(
852
+ var SubCategorySchema = new MongooseSchema5(
1019
853
  {
1020
854
  id: { required: false, type: String },
1021
855
  items: [
@@ -1029,7 +863,7 @@ var SubCategorySchema = new MongooseSchema7(
1029
863
  { _id: false }
1030
864
  // Prevents Mongoose from creating an additional _id field for subdocuments
1031
865
  );
1032
- var CategorySchema = new MongooseSchema7(
866
+ var CategorySchema = new MongooseSchema5(
1033
867
  {
1034
868
  id: { required: true, type: String },
1035
869
  name: { required: true, type: String },
@@ -1038,7 +872,7 @@ var CategorySchema = new MongooseSchema7(
1038
872
  { _id: false }
1039
873
  // Prevents Mongoose from creating an additional _id field for subdocuments
1040
874
  );
1041
- var PosterUsageTypeSchema = new MongooseSchema7(
875
+ var PosterUsageTypeSchema = new MongooseSchema5(
1042
876
  {
1043
877
  count: { default: 0, required: false, type: Number },
1044
878
  month: { required: false, type: String }
@@ -1046,24 +880,24 @@ var PosterUsageTypeSchema = new MongooseSchema7(
1046
880
  { _id: false }
1047
881
  // Prevents Mongoose from creating an additional _id field for subdocuments
1048
882
  );
1049
- var userLicenseSchema = new MongooseSchema7(
883
+ var userLicenseSchema = new MongooseSchema5(
1050
884
  {
1051
885
  expiryDate: { required: true, type: Date },
1052
886
  issuedDate: { required: true, type: Date },
1053
887
  licenceType: {
1054
- enum: Object.values(import_cluemart_shared9.EnumUserLicence),
888
+ enum: Object.values(import_cluemart_shared7.EnumUserLicence),
1055
889
  required: true,
1056
890
  type: String
1057
891
  },
1058
892
  prevLicenceType: {
1059
- enum: Object.values(import_cluemart_shared9.EnumUserLicence),
893
+ enum: Object.values(import_cluemart_shared7.EnumUserLicence),
1060
894
  required: false,
1061
895
  type: String
1062
896
  }
1063
897
  },
1064
898
  { _id: false, timestamps: false }
1065
899
  );
1066
- var ContactDetailsSchema = new MongooseSchema7(
900
+ var ContactDetailsSchema = new MongooseSchema5(
1067
901
  {
1068
902
  email: { required: false, type: String },
1069
903
  landlinePhone: { required: false, type: String },
@@ -1072,7 +906,7 @@ var ContactDetailsSchema = new MongooseSchema7(
1072
906
  { _id: false }
1073
907
  // Prevents Mongoose from creating an additional _id field for subdocuments
1074
908
  );
1075
- var termsAgreementSchema = new MongooseSchema7(
909
+ var termsAgreementSchema = new MongooseSchema5(
1076
910
  {
1077
911
  appBuildNumber: { required: true, type: String },
1078
912
  appId: { required: true, type: String },
@@ -1089,25 +923,10 @@ var termsAgreementSchema = new MongooseSchema7(
1089
923
  },
1090
924
  { _id: false }
1091
925
  );
1092
- var resourceRelationsSchema = new MongooseSchema7(
1093
- {
1094
- relationDates: {
1095
- default: [],
1096
- required: false,
1097
- type: [relationDatesSchema]
1098
- },
1099
- relationId: {
1100
- ref: "Relation",
1101
- required: false,
1102
- type: import_mongoose11.default.Schema.Types.ObjectId
1103
- }
1104
- },
1105
- { _id: false }
1106
- );
1107
- var dateTimeSchema2 = new MongooseSchema7(
926
+ var dateTimeSchema = new MongooseSchema5(
1108
927
  {
1109
928
  dateStatus: {
1110
- enum: Object.values(import_cluemart_shared9.EnumEventDateStatus),
929
+ enum: Object.values(import_cluemart_shared7.EnumEventDateStatus),
1111
930
  required: false,
1112
931
  type: String
1113
932
  },
@@ -1119,7 +938,7 @@ var dateTimeSchema2 = new MongooseSchema7(
1119
938
  { _id: false }
1120
939
  // Prevents Mongoose from creating an additional _id field for subdocuments
1121
940
  );
1122
- var locationGeoSchema = new MongooseSchema7(
941
+ var locationGeoSchema = new MongooseSchema5(
1123
942
  {
1124
943
  coordinates: { required: true, type: [Number] },
1125
944
  // [longitude, latitude]
@@ -1128,7 +947,7 @@ var locationGeoSchema = new MongooseSchema7(
1128
947
  { _id: false }
1129
948
  // Prevents Mongoose from creating an additional _id field for subdocuments
1130
949
  );
1131
- var locationsSchema = new MongooseSchema7(
950
+ var locationsSchema = new MongooseSchema5(
1132
951
  {
1133
952
  city: { required: true, type: String },
1134
953
  country: { required: true, type: String },
@@ -1144,17 +963,17 @@ var locationsSchema = new MongooseSchema7(
1144
963
  { _id: false }
1145
964
  // Prevents Mongoose from creating an additional _id field for subdocuments
1146
965
  );
1147
- var relatedPostSchema = new MongooseSchema7(
966
+ var relatedPostSchema = new MongooseSchema5(
1148
967
  {
1149
968
  postActive: { default: true, required: true, type: Boolean },
1150
969
  postId: {
1151
970
  ref: "Post",
1152
971
  required: true,
1153
- type: import_mongoose11.default.Schema.Types.ObjectId
972
+ type: import_mongoose9.default.Schema.Types.ObjectId
1154
973
  },
1155
974
  postSlug: { required: true, type: String },
1156
975
  postType: {
1157
- enum: Object.values(import_cluemart_shared9.EnumPostType),
976
+ enum: Object.values(import_cluemart_shared7.EnumPostType),
1158
977
  required: true,
1159
978
  type: String
1160
979
  }
@@ -1162,7 +981,7 @@ var relatedPostSchema = new MongooseSchema7(
1162
981
  { _id: false }
1163
982
  // Prevents Mongoose from creating an additional _id field for subdocuments
1164
983
  );
1165
- var socialShareResourceSchema = new MongooseSchema7(
984
+ var socialShareResourceSchema = new MongooseSchema5(
1166
985
  {
1167
986
  qrCode: { required: true, type: ResourceImageTypeSchema },
1168
987
  socialImage: { required: true, type: ResourceImageTypeSchema }
@@ -1175,7 +994,7 @@ var baseResourceFields = {
1175
994
  adIds: {
1176
995
  ref: "Ad",
1177
996
  required: false,
1178
- type: [import_mongoose11.default.Schema.Types.ObjectId]
997
+ type: [import_mongoose9.default.Schema.Types.ObjectId]
1179
998
  },
1180
999
  approvedAt: { default: null, required: false, type: Date },
1181
1000
  contactDetails: { required: false, type: ContactDetailsSchema },
@@ -1205,8 +1024,8 @@ var baseResourceFields = {
1205
1024
  };
1206
1025
 
1207
1026
  // src/mongoose/GoogleImportedMarket.ts
1208
- var import_cluemart_shared10 = require("@timardex/cluemart-shared");
1209
- var import_mongoose12 = __toESM(require("mongoose"));
1027
+ var import_cluemart_shared8 = require("@timardex/cluemart-shared");
1028
+ var import_mongoose10 = __toESM(require("mongoose"));
1210
1029
 
1211
1030
  // src/mongoose/searchNamePlugin.ts
1212
1031
  function deriveSearchName(name) {
@@ -1252,15 +1071,15 @@ function syncSearchNameInUpdate(update) {
1252
1071
  }
1253
1072
  return null;
1254
1073
  }
1255
- function searchNamePlugin(schema24) {
1256
- schema24.add({ searchName: { default: "", required: false, type: String } });
1257
- schema24.index({ searchName: 1 });
1258
- schema24.pre("save", function syncSearchNameOnSave(next) {
1074
+ function searchNamePlugin(schema25) {
1075
+ schema25.add({ searchName: { default: "", required: false, type: String } });
1076
+ schema25.index({ searchName: 1 });
1077
+ schema25.pre("save", function syncSearchNameOnSave(next) {
1259
1078
  const doc = this;
1260
1079
  doc.searchName = deriveSearchName(doc.name);
1261
1080
  next();
1262
1081
  });
1263
- schema24.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
1082
+ schema25.pre("insertMany", function syncSearchNameOnInsertMany(next, docs) {
1264
1083
  const list = Array.isArray(docs) ? docs : [docs];
1265
1084
  for (const doc of list) {
1266
1085
  if (doc && typeof doc.name === "string") {
@@ -1269,7 +1088,7 @@ function searchNamePlugin(schema24) {
1269
1088
  }
1270
1089
  next();
1271
1090
  });
1272
- schema24.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
1091
+ schema25.pre("bulkWrite", function syncSearchNameOnBulkWrite(next, ops) {
1273
1092
  for (const op of ops) {
1274
1093
  const doc = op.insertOne?.document ?? op.replaceOne?.replacement;
1275
1094
  if (doc && typeof doc.name === "string") {
@@ -1295,15 +1114,15 @@ function searchNamePlugin(schema24) {
1295
1114
  }
1296
1115
  next();
1297
1116
  };
1298
- schema24.pre(
1117
+ schema25.pre(
1299
1118
  ["findOneAndUpdate", "updateOne", "updateMany"],
1300
1119
  syncSearchNameOnUpdate
1301
1120
  );
1302
1121
  }
1303
1122
 
1304
1123
  // src/mongoose/GoogleImportedMarket.ts
1305
- var MongooseSchema8 = import_mongoose12.default.Schema;
1306
- var addressComponentSchema = new MongooseSchema8(
1124
+ var MongooseSchema6 = import_mongoose10.default.Schema;
1125
+ var addressComponentSchema = new MongooseSchema6(
1307
1126
  {
1308
1127
  longName: { required: false, type: String },
1309
1128
  shortName: { required: false, type: String },
@@ -1311,7 +1130,7 @@ var addressComponentSchema = new MongooseSchema8(
1311
1130
  },
1312
1131
  { _id: false }
1313
1132
  );
1314
- var schema8 = new MongooseSchema8(
1133
+ var schema7 = new MongooseSchema6(
1315
1134
  {
1316
1135
  active: { default: false, required: true, type: Boolean },
1317
1136
  address: { required: true, type: String },
@@ -1323,22 +1142,22 @@ var schema8 = new MongooseSchema8(
1323
1142
  claimedByUserId: {
1324
1143
  ref: "User",
1325
1144
  required: false,
1326
- type: import_mongoose12.default.Schema.Types.ObjectId
1145
+ type: import_mongoose10.default.Schema.Types.ObjectId
1327
1146
  },
1328
1147
  cover: {
1329
1148
  required: false,
1330
1149
  type: ResourceImageTypeSchema
1331
1150
  },
1332
- dateTime: [dateTimeSchema2],
1151
+ dateTime: [dateTimeSchema],
1333
1152
  deletedAt: { default: null, required: false, type: Date },
1334
1153
  description: { required: true, type: String },
1335
1154
  eventId: {
1336
1155
  ref: "Event",
1337
1156
  required: false,
1338
- type: import_mongoose12.default.Schema.Types.ObjectId
1157
+ type: import_mongoose10.default.Schema.Types.ObjectId
1339
1158
  },
1340
1159
  eventType: {
1341
- enum: Object.values(import_cluemart_shared10.EnumEventType),
1160
+ enum: Object.values(import_cluemart_shared8.EnumEventType),
1342
1161
  required: true,
1343
1162
  type: String
1344
1163
  },
@@ -1363,38 +1182,33 @@ var schema8 = new MongooseSchema8(
1363
1182
  rainOrShine: { required: true, type: Boolean },
1364
1183
  rating: { required: false, type: Number },
1365
1184
  region: { required: false, type: String },
1366
- relations: {
1367
- default: [],
1368
- required: false,
1369
- type: [resourceRelationsSchema]
1370
- },
1371
1185
  reviewCount: { required: false, type: Number },
1372
1186
  slug: { required: true, type: String },
1373
1187
  website: { required: false, type: String }
1374
1188
  },
1375
1189
  { timestamps: true }
1376
1190
  );
1377
- schema8.index({ "location.geo": "2dsphere" });
1378
- schema8.index({ name: 1 });
1379
- schema8.index({ region: 1 });
1380
- schema8.index({ deletedAt: 1 });
1381
- schema8.index({ "dateTime.dateStatus": 1 });
1382
- schema8.index({ slug: 1 });
1383
- schema8.index({ name: "text", description: "text" });
1384
- schema8.plugin(searchNamePlugin);
1385
- var GoogleImportedMarketModel = import_mongoose12.default.models.GoogleImportedMarket || import_mongoose12.default.model("GoogleImportedMarket", schema8);
1191
+ schema7.index({ "location.geo": "2dsphere" });
1192
+ schema7.index({ name: 1 });
1193
+ schema7.index({ region: 1 });
1194
+ schema7.index({ deletedAt: 1 });
1195
+ schema7.index({ "dateTime.dateStatus": 1 });
1196
+ schema7.index({ slug: 1 });
1197
+ schema7.index({ description: "text", name: "text" });
1198
+ schema7.plugin(searchNamePlugin);
1199
+ var GoogleImportedMarketModel = import_mongoose10.default.models.GoogleImportedMarket || import_mongoose10.default.model("GoogleImportedMarket", schema7);
1386
1200
 
1387
1201
  // src/mongoose/Notification.ts
1388
- var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1389
- var import_mongoose13 = __toESM(require("mongoose"));
1390
- var MongooseSchema9 = import_mongoose13.default.Schema;
1391
- var schema9 = new MongooseSchema9(
1202
+ var import_cluemart_shared9 = require("@timardex/cluemart-shared");
1203
+ var import_mongoose11 = __toESM(require("mongoose"));
1204
+ var MongooseSchema7 = import_mongoose11.default.Schema;
1205
+ var schema8 = new MongooseSchema7(
1392
1206
  {
1393
1207
  data: {
1394
1208
  resourceId: { required: true, type: String },
1395
1209
  resourceName: { required: true, type: String },
1396
1210
  resourceType: {
1397
- enum: Object.values(import_cluemart_shared11.EnumNotificationResourceType),
1211
+ enum: Object.values(import_cluemart_shared9.EnumNotificationResourceType),
1398
1212
  required: true,
1399
1213
  type: String
1400
1214
  }
@@ -1403,28 +1217,28 @@ var schema9 = new MongooseSchema9(
1403
1217
  message: { required: true, type: String },
1404
1218
  title: { required: true, type: String },
1405
1219
  type: {
1406
- default: import_cluemart_shared11.EnumNotificationType.SYSTEM,
1407
- enum: Object.values(import_cluemart_shared11.EnumNotificationType),
1220
+ default: import_cluemart_shared9.EnumNotificationType.SYSTEM,
1221
+ enum: Object.values(import_cluemart_shared9.EnumNotificationType),
1408
1222
  required: true,
1409
1223
  type: String
1410
1224
  },
1411
1225
  userId: {
1412
1226
  ref: "User",
1413
1227
  required: true,
1414
- type: import_mongoose13.default.Schema.Types.ObjectId
1228
+ type: import_mongoose11.default.Schema.Types.ObjectId
1415
1229
  }
1416
1230
  },
1417
1231
  { timestamps: true }
1418
1232
  );
1419
- schema9.index({ isRead: 1, userId: 1 });
1420
- schema9.index({ createdAt: -1, userId: 1 });
1421
- var NotificationModel = import_mongoose13.default.models.Notification || import_mongoose13.default.model("Notification", schema9);
1233
+ schema8.index({ isRead: 1, userId: 1 });
1234
+ schema8.index({ createdAt: -1, userId: 1 });
1235
+ var NotificationModel = import_mongoose11.default.models.Notification || import_mongoose11.default.model("Notification", schema8);
1422
1236
 
1423
1237
  // src/mongoose/PushToken.ts
1424
1238
  var import_enums = require("@timardex/cluemart-shared/enums");
1425
- var import_mongoose14 = __toESM(require("mongoose"));
1426
- var MongooseSchema10 = import_mongoose14.default.Schema;
1427
- var schema10 = new MongooseSchema10(
1239
+ var import_mongoose12 = __toESM(require("mongoose"));
1240
+ var MongooseSchema8 = import_mongoose12.default.Schema;
1241
+ var schema9 = new MongooseSchema8(
1428
1242
  {
1429
1243
  platform: {
1430
1244
  enum: Object.values(import_enums.EnumOSPlatform),
@@ -1435,12 +1249,179 @@ var schema10 = new MongooseSchema10(
1435
1249
  userId: {
1436
1250
  ref: "User",
1437
1251
  required: true,
1252
+ type: import_mongoose12.default.Schema.Types.ObjectId
1253
+ }
1254
+ },
1255
+ { timestamps: true }
1256
+ );
1257
+ var PushTokenModel = import_mongoose12.default.models.PushToken || import_mongoose12.default.model("PushToken", schema9);
1258
+
1259
+ // src/mongoose/Relation.ts
1260
+ var import_cluemart_shared11 = require("@timardex/cluemart-shared");
1261
+ var import_mongoose14 = __toESM(require("mongoose"));
1262
+
1263
+ // src/mongoose/event/EventInfo.ts
1264
+ var import_cluemart_shared10 = require("@timardex/cluemart-shared");
1265
+ var import_mongoose13 = __toESM(require("mongoose"));
1266
+ var MongooseSchema9 = import_mongoose13.default.Schema;
1267
+ var StallTypeSchema = new MongooseSchema9(
1268
+ {
1269
+ label: { required: false, type: String },
1270
+ price: { required: false, type: Number },
1271
+ stallCapacity: { required: false, type: Number }
1272
+ },
1273
+ {
1274
+ _id: false
1275
+ // Prevents Mongoose from creating an additional _id field for subdocuments
1276
+ }
1277
+ );
1278
+ var dateTimeSchema2 = new MongooseSchema9(
1279
+ {
1280
+ dateStatus: {
1281
+ enum: Object.values(import_cluemart_shared10.EnumEventDateStatus),
1282
+ required: false,
1283
+ type: String
1284
+ },
1285
+ endDate: { required: true, type: String },
1286
+ endTime: { required: true, type: String },
1287
+ stallTypes: [StallTypeSchema],
1288
+ startDate: { required: true, type: String },
1289
+ startTime: { required: true, type: String }
1290
+ },
1291
+ { _id: false }
1292
+ // Prevents Mongoose from creating an additional _id field for subdocuments
1293
+ );
1294
+ var paymentInfoSchema = new MongooseSchema9(
1295
+ {
1296
+ accountHolderName: { required: false, type: String },
1297
+ accountNumber: { required: false, type: String },
1298
+ link: { required: false, type: String },
1299
+ paymentMethod: {
1300
+ enum: Object.values(import_cluemart_shared10.EnumPaymentMethod),
1301
+ required: true,
1302
+ type: String
1303
+ }
1304
+ },
1305
+ { _id: false }
1306
+ // Prevents Mongoose from creating an additional _id field
1307
+ );
1308
+ var requirementsSchema = new MongooseSchema9(
1309
+ {
1310
+ category: { required: true, type: String },
1311
+ label: { required: true, type: String },
1312
+ value: { required: true, type: Boolean }
1313
+ },
1314
+ {
1315
+ _id: false
1316
+ // Prevents Mongoose from creating an additional _id field for
1317
+ }
1318
+ );
1319
+ var refundPolicySchema = new MongooseSchema9(
1320
+ {
1321
+ category: { required: true, type: String },
1322
+ label: { required: true, type: String },
1323
+ value: { required: true, type: Boolean }
1324
+ },
1325
+ { _id: false }
1326
+ );
1327
+ var schema10 = new MongooseSchema9(
1328
+ {
1329
+ active: { default: true, type: Boolean },
1330
+ applicationDeadlineHours: { required: true, type: Number },
1331
+ dateTime: { required: true, type: [dateTimeSchema2] },
1332
+ eventId: {
1333
+ ref: "Event",
1334
+ required: true,
1335
+ type: import_mongoose13.default.Schema.Types.ObjectId
1336
+ },
1337
+ packInTime: { required: true, type: Number },
1338
+ paymentDueHours: { required: true, type: Number },
1339
+ paymentInfo: { required: true, type: [paymentInfoSchema] },
1340
+ refundPolicy: { required: true, type: [refundPolicySchema] },
1341
+ requirements: { required: false, type: [requirementsSchema] }
1342
+ },
1343
+ { timestamps: true }
1344
+ );
1345
+ schema10.index({ eventId: 1 });
1346
+ var EventInfoModel = import_mongoose13.default.models.EventInfo || import_mongoose13.default.model("EventInfo", schema10);
1347
+
1348
+ // src/mongoose/Relation.ts
1349
+ var MongooseSchema10 = import_mongoose14.default.Schema;
1350
+ var relationDateTimeSchema = new MongooseSchema10(
1351
+ {
1352
+ dateStatus: {
1353
+ enum: Object.values(import_cluemart_shared11.EnumEventDateStatus),
1354
+ required: true,
1355
+ type: String
1356
+ },
1357
+ endDate: { required: true, type: String },
1358
+ endTime: { required: true, type: String },
1359
+ stallType: StallTypeSchema,
1360
+ startDate: { required: true, type: String },
1361
+ startTime: { required: true, type: String }
1362
+ },
1363
+ { _id: false }
1364
+ );
1365
+ var relationDatesSchema = new MongooseSchema10(
1366
+ {
1367
+ dateTime: {
1368
+ required: true,
1369
+ type: relationDateTimeSchema
1370
+ },
1371
+ lastUpdateBy: {
1372
+ resourceId: { required: false, type: String },
1373
+ userEmail: { required: false, type: String }
1374
+ },
1375
+ paymentReference: { required: false, type: String },
1376
+ status: {
1377
+ enum: Object.values(import_cluemart_shared11.EnumInviteStatus),
1378
+ required: false,
1379
+ type: String
1380
+ }
1381
+ },
1382
+ { _id: false }
1383
+ );
1384
+ var RelationTypeSchema = new MongooseSchema10(
1385
+ {
1386
+ active: { default: true, required: true, type: Boolean },
1387
+ chatId: {
1388
+ ref: "Chat",
1389
+ required: true,
1390
+ type: import_mongoose14.default.Schema.Types.ObjectId
1391
+ },
1392
+ deletedAt: { default: null, required: false, type: Date },
1393
+ eventId: {
1394
+ ref: "Event",
1395
+ required: true,
1396
+ type: import_mongoose14.default.Schema.Types.ObjectId
1397
+ },
1398
+ lastUpdateBy: {
1399
+ enum: Object.values(import_cluemart_shared11.EnumResourceType),
1400
+ required: true,
1401
+ type: String
1402
+ },
1403
+ relationDates: [relationDatesSchema],
1404
+ relationType: {
1405
+ enum: Object.values(import_cluemart_shared11.EnumRelationResource),
1406
+ required: true,
1407
+ type: String
1408
+ },
1409
+ vendorId: {
1410
+ ref: "Vendor",
1411
+ required: true,
1438
1412
  type: import_mongoose14.default.Schema.Types.ObjectId
1439
1413
  }
1440
1414
  },
1441
1415
  { timestamps: true }
1442
1416
  );
1443
- var PushTokenModel = import_mongoose14.default.models.PushToken || import_mongoose14.default.model("PushToken", schema10);
1417
+ RelationTypeSchema.index({
1418
+ eventId: 1,
1419
+ "relationDates.startDate": 1,
1420
+ "relationDates.startTime": 1,
1421
+ "relationDates.status": 1,
1422
+ vendorId: 1
1423
+ });
1424
+ var RelationModel = import_mongoose14.default.models.Relation || import_mongoose14.default.model("Relation", RelationTypeSchema);
1444
1425
 
1445
1426
  // src/mongoose/ResourceActivity.ts
1446
1427
  var import_cluemart_shared12 = require("@timardex/cluemart-shared");
@@ -1496,7 +1477,7 @@ var import_mongoose16 = __toESM(require("mongoose"));
1496
1477
  var MongooseSchema12 = import_mongoose16.default.Schema;
1497
1478
  var userActivityEventSchema = new MongooseSchema12(
1498
1479
  {
1499
- dateTime: dateTimeSchema2,
1480
+ dateTime: dateTimeSchema,
1500
1481
  resourceId: {
1501
1482
  ref: "Event",
1502
1483
  required: false,
@@ -1844,11 +1825,6 @@ var schema14 = new MongooseSchema14(
1844
1825
  downgradeSnapshot: { required: false, type: downgradeSnapshotSchema },
1845
1826
  foodTruck: { required: true, type: Boolean },
1846
1827
  products: { required: false, type: productWrapperSchema },
1847
- relations: {
1848
- default: [],
1849
- required: false,
1850
- type: [resourceRelationsSchema]
1851
- },
1852
1828
  shareRelation: { required: false, type: socialShareResourceSchema },
1853
1829
  unregisteredVendorId: {
1854
1830
  ref: "UnregisteredVendor",
@@ -1941,7 +1917,7 @@ var import_mongoose20 = __toESM(require("mongoose"));
1941
1917
  var MongooseSchema16 = import_mongoose20.default.Schema;
1942
1918
  var invitationSchema = new MongooseSchema16(
1943
1919
  {
1944
- dateTime: { required: true, type: [dateTimeSchema2] },
1920
+ dateTime: { required: true, type: [dateTimeSchema] },
1945
1921
  inviterId: {
1946
1922
  ref: "Event",
1947
1923
  required: true,
@@ -1985,7 +1961,7 @@ var schema17 = new MongooseSchema17(
1985
1961
  ...baseResourceFields,
1986
1962
  // Importing base resource fields from global.ts
1987
1963
  claimed: { default: true, required: false, type: Boolean },
1988
- dateTime: { required: true, type: [dateTimeSchema2] },
1964
+ dateTime: { required: true, type: [dateTimeSchema] },
1989
1965
  eventInfoId: {
1990
1966
  ref: "EventInfo",
1991
1967
  required: false,
@@ -2008,11 +1984,6 @@ var schema17 = new MongooseSchema17(
2008
1984
  nzbn: { required: true, type: String },
2009
1985
  provider: { required: false, type: String },
2010
1986
  rainOrShine: { required: true, type: Boolean },
2011
- relations: {
2012
- default: [],
2013
- required: false,
2014
- type: [resourceRelationsSchema]
2015
- },
2016
1987
  shareRelation: { required: false, type: socialShareResourceSchema },
2017
1988
  tags: { required: true, type: [String] }
2018
1989
  },
@@ -2026,16 +1997,32 @@ schema17.index({ tags: 1 });
2026
1997
  schema17.index({ deletedAt: 1 });
2027
1998
  schema17.index({ "dateTime.dateStatus": 1 });
2028
1999
  schema17.index({ slug: 1 });
2029
- schema17.index({ name: "text", description: "text", tags: "text" });
2030
- schema17.index({ "owner.userId": 1, deletedAt: 1 });
2000
+ schema17.index({ description: "text", name: "text", tags: "text" });
2001
+ schema17.index({ deletedAt: 1, "owner.userId": 1 });
2031
2002
  schema17.plugin(searchNamePlugin);
2032
2003
  var EventModel = import_mongoose21.default.models.Event || import_mongoose21.default.model("Event", schema17);
2033
2004
 
2005
+ // src/mongoose/event/EventDateArchive.ts
2006
+ var import_mongoose22 = __toESM(require("mongoose"));
2007
+ var schema18 = new import_mongoose22.default.Schema(
2008
+ {
2009
+ dateTime: { required: true, type: [dateTimeSchema] },
2010
+ eventId: {
2011
+ ref: "Event",
2012
+ required: true,
2013
+ type: import_mongoose22.default.Schema.Types.ObjectId
2014
+ }
2015
+ },
2016
+ { timestamps: true }
2017
+ );
2018
+ schema18.index({ eventId: 1 }, { unique: true });
2019
+ var EventDateArchiveModel = import_mongoose22.default.models.EventDateArchive || import_mongoose22.default.model("EventDateArchive", schema18);
2020
+
2034
2021
  // src/mongoose/Partner.ts
2035
2022
  var import_cluemart_shared17 = require("@timardex/cluemart-shared");
2036
- var import_mongoose22 = __toESM(require("mongoose"));
2037
- var MongooseSchema18 = import_mongoose22.default.Schema;
2038
- var schema18 = new MongooseSchema18(
2023
+ var import_mongoose23 = __toESM(require("mongoose"));
2024
+ var MongooseSchema18 = import_mongoose23.default.Schema;
2025
+ var schema19 = new MongooseSchema18(
2039
2026
  {
2040
2027
  ...baseResourceFields,
2041
2028
  location: {
@@ -2051,23 +2038,23 @@ var schema18 = new MongooseSchema18(
2051
2038
  },
2052
2039
  { timestamps: true }
2053
2040
  );
2054
- schema18.index({ name: 1 });
2055
- schema18.index({ description: 1 });
2056
- schema18.index({ region: 1 });
2057
- schema18.index({ "location.geo": "2dsphere" });
2058
- schema18.index({ slug: 1 });
2059
- schema18.index({ name: "text", description: "text" });
2060
- schema18.index({ "owner.userId": 1, deletedAt: 1 });
2061
- schema18.plugin(searchNamePlugin);
2062
- var PartnerModel = import_mongoose22.default.models.Partner || import_mongoose22.default.model("Partner", schema18);
2041
+ schema19.index({ name: 1 });
2042
+ schema19.index({ description: 1 });
2043
+ schema19.index({ region: 1 });
2044
+ schema19.index({ "location.geo": "2dsphere" });
2045
+ schema19.index({ slug: 1 });
2046
+ schema19.index({ name: "text", description: "text" });
2047
+ schema19.index({ "owner.userId": 1, deletedAt: 1 });
2048
+ schema19.plugin(searchNamePlugin);
2049
+ var PartnerModel = import_mongoose23.default.models.Partner || import_mongoose23.default.model("Partner", schema19);
2063
2050
 
2064
2051
  // src/mongoose/Post.ts
2065
2052
  var import_cluemart_shared18 = require("@timardex/cluemart-shared");
2066
- var import_mongoose23 = __toESM(require("mongoose"));
2067
- var MongooseSchema19 = import_mongoose23.default.Schema;
2053
+ var import_mongoose24 = __toESM(require("mongoose"));
2054
+ var MongooseSchema19 = import_mongoose24.default.Schema;
2068
2055
  var contentSchema = new MongooseSchema19(
2069
2056
  {
2070
- contentData: import_mongoose23.Schema.Types.Mixed,
2057
+ contentData: import_mongoose24.Schema.Types.Mixed,
2071
2058
  contentOrder: { required: true, type: Number },
2072
2059
  contentType: {
2073
2060
  enum: Object.values(import_cluemart_shared18.EnumPostContentType),
@@ -2090,7 +2077,7 @@ var resourceSchema = new MongooseSchema19(
2090
2077
  },
2091
2078
  { _id: false }
2092
2079
  );
2093
- var schema19 = new MongooseSchema19(
2080
+ var schema20 = new MongooseSchema19(
2094
2081
  {
2095
2082
  active: { default: false, required: true, type: Boolean },
2096
2083
  approvedAt: { default: null, required: false, type: Date },
@@ -2121,14 +2108,14 @@ var schema19 = new MongooseSchema19(
2121
2108
  },
2122
2109
  { timestamps: true }
2123
2110
  );
2124
- schema19.index({ title: 1 });
2125
- schema19.index({ tags: 1 });
2126
- schema19.index({ postType: 1, slug: 1 }, { unique: true });
2127
- var PostModel = import_mongoose23.default.models.Post || import_mongoose23.default.model("Post", schema19);
2111
+ schema20.index({ title: 1 });
2112
+ schema20.index({ tags: 1 });
2113
+ schema20.index({ postType: 1, slug: 1 }, { unique: true });
2114
+ var PostModel = import_mongoose24.default.models.Post || import_mongoose24.default.model("Post", schema20);
2128
2115
 
2129
2116
  // src/mongoose/AppSetting.ts
2130
- var import_mongoose24 = __toESM(require("mongoose"));
2131
- var MongooseSchema20 = import_mongoose24.default.Schema;
2117
+ var import_mongoose25 = __toESM(require("mongoose"));
2118
+ var MongooseSchema20 = import_mongoose25.default.Schema;
2132
2119
  var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
2133
2120
  var AppSettingSchema = new MongooseSchema20(
2134
2121
  {
@@ -2165,18 +2152,18 @@ var AppSettingSchema = new MongooseSchema20(
2165
2152
  },
2166
2153
  { timestamps: true }
2167
2154
  );
2168
- var AppSettingModel = import_mongoose24.default.models.AppSetting || import_mongoose24.default.model("AppSetting", AppSettingSchema);
2155
+ var AppSettingModel = import_mongoose25.default.models.AppSetting || import_mongoose25.default.model("AppSetting", AppSettingSchema);
2169
2156
 
2170
2157
  // src/mongoose/game/Game.ts
2171
2158
  var import_cluemart_shared19 = require("@timardex/cluemart-shared");
2172
- var import_mongoose28 = __toESM(require("mongoose"));
2159
+ var import_mongoose29 = __toESM(require("mongoose"));
2173
2160
 
2174
2161
  // src/mongoose/game/DailyClue.ts
2175
- var import_mongoose26 = __toESM(require("mongoose"));
2162
+ var import_mongoose27 = __toESM(require("mongoose"));
2176
2163
 
2177
2164
  // src/mongoose/game/utils.ts
2178
- var import_mongoose25 = __toESM(require("mongoose"));
2179
- var MongooseSchema21 = import_mongoose25.default.Schema;
2165
+ var import_mongoose26 = __toESM(require("mongoose"));
2166
+ var MongooseSchema21 = import_mongoose26.default.Schema;
2180
2167
  var schemaGameDate = new MongooseSchema21(
2181
2168
  {
2182
2169
  endDate: { required: true, type: Date },
@@ -2186,7 +2173,7 @@ var schemaGameDate = new MongooseSchema21(
2186
2173
  );
2187
2174
 
2188
2175
  // src/mongoose/game/DailyClue.ts
2189
- var MongooseSchema22 = import_mongoose26.default.Schema;
2176
+ var MongooseSchema22 = import_mongoose27.default.Schema;
2190
2177
  var schemaLetters = new MongooseSchema22(
2191
2178
  {
2192
2179
  collected: { required: false, type: [String] },
@@ -2217,8 +2204,8 @@ var schemaDailyClueGameData = new MongooseSchema22(
2217
2204
  );
2218
2205
 
2219
2206
  // src/mongoose/game/PuzzleGame.ts
2220
- var import_mongoose27 = __toESM(require("mongoose"));
2221
- var MongooseSchema23 = import_mongoose27.default.Schema;
2207
+ var import_mongoose28 = __toESM(require("mongoose"));
2208
+ var MongooseSchema23 = import_mongoose28.default.Schema;
2222
2209
  var schemaPuzzleAnswer = new MongooseSchema23(
2223
2210
  {
2224
2211
  answer: { required: true, type: String },
@@ -2263,16 +2250,16 @@ var schemaPuzzleGameData = new MongooseSchema23(
2263
2250
  );
2264
2251
 
2265
2252
  // src/mongoose/game/Game.ts
2266
- var MongooseSchema24 = import_mongoose28.default.Schema;
2253
+ var MongooseSchema24 = import_mongoose29.default.Schema;
2267
2254
  var gameDataSchemas = {
2268
2255
  [import_cluemart_shared19.EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
2269
2256
  [import_cluemart_shared19.EnumGameType.MINI_QUIZ]: schemaPuzzleGameData,
2270
2257
  [import_cluemart_shared19.EnumGameType.ODD_ONE_OUT]: schemaPuzzleGameData
2271
2258
  };
2272
2259
  var gameDataDefinition = Object.fromEntries(
2273
- Object.entries(gameDataSchemas).map(([key, schema24]) => [
2260
+ Object.entries(gameDataSchemas).map(([key, schema25]) => [
2274
2261
  key,
2275
- { default: null, required: false, type: schema24 }
2262
+ { default: null, required: false, type: schema25 }
2276
2263
  ])
2277
2264
  );
2278
2265
  var gameHistorySchema = new MongooseSchema24(
@@ -2310,7 +2297,7 @@ var gameTypeSchema = new MongooseSchema24(
2310
2297
  },
2311
2298
  { timestamps: true }
2312
2299
  );
2313
- var schema20 = new MongooseSchema24(
2300
+ var schema21 = new MongooseSchema24(
2314
2301
  {
2315
2302
  active: { default: false, required: true, type: Boolean },
2316
2303
  deletedAt: { default: null, required: false, type: Date },
@@ -2323,11 +2310,11 @@ var schema20 = new MongooseSchema24(
2323
2310
  },
2324
2311
  { timestamps: true }
2325
2312
  );
2326
- var GameModel = import_mongoose28.default.models.Game || import_mongoose28.default.model("Game", schema20);
2313
+ var GameModel = import_mongoose29.default.models.Game || import_mongoose29.default.model("Game", schema21);
2327
2314
 
2328
2315
  // src/mongoose/School.ts
2329
- var import_mongoose29 = __toESM(require("mongoose"));
2330
- var MongooseSchema25 = import_mongoose29.default.Schema;
2316
+ var import_mongoose30 = __toESM(require("mongoose"));
2317
+ var MongooseSchema25 = import_mongoose30.default.Schema;
2331
2318
  var campaignsSchema = new MongooseSchema25(
2332
2319
  {
2333
2320
  endDate: { required: true, type: Date },
@@ -2336,7 +2323,7 @@ var campaignsSchema = new MongooseSchema25(
2336
2323
  },
2337
2324
  { _id: false }
2338
2325
  );
2339
- var schema21 = new MongooseSchema25(
2326
+ var schema22 = new MongooseSchema25(
2340
2327
  {
2341
2328
  // New schools are active by default
2342
2329
  active: { default: false, required: true, type: Boolean },
@@ -2363,19 +2350,19 @@ var schema21 = new MongooseSchema25(
2363
2350
  },
2364
2351
  { timestamps: true }
2365
2352
  );
2366
- schema21.index(
2353
+ schema22.index(
2367
2354
  { schoolCode: 1 },
2368
2355
  {
2369
2356
  partialFilterExpression: { active: true, deletedAt: null },
2370
2357
  unique: true
2371
2358
  }
2372
2359
  );
2373
- var SchoolModel = import_mongoose29.default.models.School || import_mongoose29.default.model("School", schema21);
2360
+ var SchoolModel = import_mongoose30.default.models.School || import_mongoose30.default.model("School", schema22);
2374
2361
 
2375
2362
  // src/mongoose/Affiliate.ts
2376
2363
  var import_cluemart_shared20 = require("@timardex/cluemart-shared");
2377
- var import_mongoose30 = __toESM(require("mongoose"));
2378
- var MongooseSchema26 = import_mongoose30.default.Schema;
2364
+ var import_mongoose31 = __toESM(require("mongoose"));
2365
+ var MongooseSchema26 = import_mongoose31.default.Schema;
2379
2366
  var affiliateRewardSchema = new MongooseSchema26(
2380
2367
  {
2381
2368
  createdAt: { required: true, type: Date },
@@ -2396,7 +2383,7 @@ var affiliateResourceSchema = new MongooseSchema26(
2396
2383
  resourceDeletedAt: { default: null, required: false, type: Date },
2397
2384
  resourceId: {
2398
2385
  required: true,
2399
- type: import_mongoose30.default.Schema.Types.ObjectId
2386
+ type: import_mongoose31.default.Schema.Types.ObjectId
2400
2387
  },
2401
2388
  resourceName: { required: true, type: String },
2402
2389
  resourceOwner: {
@@ -2459,7 +2446,7 @@ var redeemHistorySchema = new MongooseSchema26(
2459
2446
  },
2460
2447
  { _id: false }
2461
2448
  );
2462
- var schema22 = new MongooseSchema26(
2449
+ var schema23 = new MongooseSchema26(
2463
2450
  {
2464
2451
  active: { default: false, required: true, type: Boolean },
2465
2452
  affiliateBonusRewards: {
@@ -2489,19 +2476,19 @@ var schema22 = new MongooseSchema26(
2489
2476
  },
2490
2477
  { timestamps: true }
2491
2478
  );
2492
- schema22.index(
2479
+ schema23.index(
2493
2480
  { affiliateCode: 1 },
2494
2481
  {
2495
2482
  partialFilterExpression: { active: true, deletedAt: null },
2496
2483
  unique: true
2497
2484
  }
2498
2485
  );
2499
- var AffiliateModel = import_mongoose30.default.models.Affiliate || import_mongoose30.default.model("Affiliate", schema22);
2486
+ var AffiliateModel = import_mongoose31.default.models.Affiliate || import_mongoose31.default.model("Affiliate", schema23);
2500
2487
 
2501
2488
  // src/mongoose/Coupon.ts
2502
2489
  var import_cluemart_shared21 = require("@timardex/cluemart-shared");
2503
- var import_mongoose31 = __toESM(require("mongoose"));
2504
- var MongooseSchema27 = import_mongoose31.default.Schema;
2490
+ var import_mongoose32 = __toESM(require("mongoose"));
2491
+ var MongooseSchema27 = import_mongoose32.default.Schema;
2505
2492
  var couponOptionSchema = new MongooseSchema27(
2506
2493
  {
2507
2494
  buy: { required: false, type: Number },
@@ -2521,20 +2508,20 @@ var couponVendorProductSchema = new MongooseSchema27(
2521
2508
  {
2522
2509
  couponId: {
2523
2510
  required: true,
2524
- type: import_mongoose31.default.Schema.Types.ObjectId
2511
+ type: import_mongoose32.default.Schema.Types.ObjectId
2525
2512
  },
2526
2513
  productId: {
2527
2514
  required: true,
2528
- type: import_mongoose31.default.Schema.Types.ObjectId
2515
+ type: import_mongoose32.default.Schema.Types.ObjectId
2529
2516
  },
2530
2517
  vendorCouponId: {
2531
2518
  required: false,
2532
- type: import_mongoose31.default.Schema.Types.ObjectId
2519
+ type: import_mongoose32.default.Schema.Types.ObjectId
2533
2520
  },
2534
2521
  vendorId: {
2535
2522
  ref: "Vendor",
2536
2523
  required: true,
2537
- type: import_mongoose31.default.Schema.Types.ObjectId
2524
+ type: import_mongoose32.default.Schema.Types.ObjectId
2538
2525
  }
2539
2526
  },
2540
2527
  { _id: false }
@@ -2556,7 +2543,7 @@ var couponParticipantUserSchema = new MongooseSchema27(
2556
2543
  userId: {
2557
2544
  ref: "User",
2558
2545
  required: true,
2559
- type: import_mongoose31.default.Schema.Types.ObjectId
2546
+ type: import_mongoose32.default.Schema.Types.ObjectId
2560
2547
  }
2561
2548
  },
2562
2549
  { timestamps: true }
@@ -2588,7 +2575,7 @@ var couponDataSchema = new MongooseSchema27(
2588
2575
  },
2589
2576
  { timestamps: true }
2590
2577
  );
2591
- var schema23 = new MongooseSchema27(
2578
+ var schema24 = new MongooseSchema27(
2592
2579
  {
2593
2580
  active: { default: true, required: true, type: Boolean },
2594
2581
  couponData: { default: [], required: false, type: [couponDataSchema] },
@@ -2600,9 +2587,9 @@ var schema23 = new MongooseSchema27(
2600
2587
  },
2601
2588
  { timestamps: true }
2602
2589
  );
2603
- schema23.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2604
- schema23.index({ "couponData.participantUsers.userId": 1 });
2605
- var CouponModel = import_mongoose31.default.models.Coupon || import_mongoose31.default.model("Coupon", schema23);
2590
+ schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2591
+ schema24.index({ "couponData.participantUsers.userId": 1 });
2592
+ var CouponModel = import_mongoose32.default.models.Coupon || import_mongoose32.default.model("Coupon", schema24);
2606
2593
 
2607
2594
  // src/service/promoCode/constants.ts
2608
2595
  var ACTIVE_NOT_DELETED_FILTER = {
@@ -3031,7 +3018,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
3031
3018
  }
3032
3019
 
3033
3020
  // src/service/database.ts
3034
- var import_mongoose35 = __toESM(require("mongoose"));
3021
+ var import_mongoose36 = __toESM(require("mongoose"));
3035
3022
  var connectToDatabase = async ({
3036
3023
  appName,
3037
3024
  dbName,
@@ -3044,7 +3031,7 @@ var connectToDatabase = async ({
3044
3031
  // Fallback to MongoDB Atlas connection string
3045
3032
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
3046
3033
  );
3047
- await import_mongoose35.default.connect(mongoUri);
3034
+ await import_mongoose36.default.connect(mongoUri);
3048
3035
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
3049
3036
  console.log(
3050
3037
  `${connectionType} connected from server/src/service/database.ts`
@@ -3057,7 +3044,7 @@ var connectToDatabase = async ({
3057
3044
 
3058
3045
  // src/types/index.ts
3059
3046
  var import_express = __toESM(require("express"));
3060
- var import_mongoose36 = __toESM(require("mongoose"));
3047
+ var import_mongoose37 = __toESM(require("mongoose"));
3061
3048
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
3062
3049
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
3063
3050
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -3173,15 +3160,15 @@ async function updateAdStatuses() {
3173
3160
  }
3174
3161
 
3175
3162
  // src/service/objectIdToString.ts
3176
- var import_mongoose38 = __toESM(require("mongoose"));
3163
+ var import_mongoose39 = __toESM(require("mongoose"));
3177
3164
  function isValidObjectId(value) {
3178
- return import_mongoose38.default.Types.ObjectId.isValid(value);
3165
+ return import_mongoose39.default.Types.ObjectId.isValid(value);
3179
3166
  }
3180
3167
  function convertObjectIdsToStrings(obj) {
3181
3168
  if (obj === null || obj === void 0) {
3182
3169
  return obj;
3183
3170
  }
3184
- if (obj instanceof import_mongoose38.default.Types.ObjectId) {
3171
+ if (obj instanceof import_mongoose39.default.Types.ObjectId) {
3185
3172
  return obj.toString();
3186
3173
  }
3187
3174
  if (obj instanceof Date) {
@@ -3201,33 +3188,75 @@ function convertObjectIdsToStrings(obj) {
3201
3188
  }
3202
3189
 
3203
3190
  // src/service/event/updateAllEventDateTimeStatuses.ts
3204
- var import_cluemart_shared25 = require("@timardex/cluemart-shared");
3191
+ var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3205
3192
  var import_dayjs2 = __toESM(require("dayjs"));
3206
3193
  var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat"));
3207
3194
  var import_isoWeek = __toESM(require("dayjs/plugin/isoWeek"));
3195
+
3196
+ // src/service/event/archiveEndedEventDates.ts
3197
+ var import_cluemart_shared25 = require("@timardex/cluemart-shared");
3198
+ var ARCHIVED_STATUSES = /* @__PURE__ */ new Set([
3199
+ import_cluemart_shared25.EnumEventDateStatus.ENDED
3200
+ ]);
3201
+ var DISCARDED_STATUSES = /* @__PURE__ */ new Set([
3202
+ import_cluemart_shared25.EnumEventDateStatus.INVALID
3203
+ ]);
3204
+ function splitEventDatesForArchive(dateTime) {
3205
+ return {
3206
+ archive: dateTime.filter((slot) => ARCHIVED_STATUSES.has(slot.dateStatus)),
3207
+ discard: dateTime.filter((slot) => DISCARDED_STATUSES.has(slot.dateStatus)),
3208
+ keep: dateTime.filter(
3209
+ (slot) => !ARCHIVED_STATUSES.has(slot.dateStatus) && !DISCARDED_STATUSES.has(slot.dateStatus)
3210
+ )
3211
+ };
3212
+ }
3213
+ function dedupeArchivedSlotsByStartDateTime(slots) {
3214
+ const seen = /* @__PURE__ */ new Set();
3215
+ return slots.filter((slot) => {
3216
+ const key = `${slot.startDate}_${slot.startTime}`;
3217
+ if (seen.has(key)) {
3218
+ return false;
3219
+ }
3220
+ seen.add(key);
3221
+ return true;
3222
+ });
3223
+ }
3224
+ async function persistArchivedEventDates(eventId, slots) {
3225
+ if (slots.length === 0) {
3226
+ return;
3227
+ }
3228
+ const uniqueSlots = dedupeArchivedSlotsByStartDateTime(slots);
3229
+ await EventDateArchiveModel.updateOne(
3230
+ { eventId },
3231
+ { $addToSet: { dateTime: { $each: uniqueSlots } } },
3232
+ { upsert: true }
3233
+ );
3234
+ }
3235
+
3236
+ // src/service/event/updateAllEventDateTimeStatuses.ts
3208
3237
  import_dayjs2.default.extend(import_customParseFormat.default);
3209
3238
  import_dayjs2.default.extend(import_isoWeek.default);
3210
3239
  function getFutureEventStatus(startDateTime, now) {
3211
3240
  const hoursUntilStart = startDateTime.diff(now, "hour", true);
3212
3241
  if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
3213
- return import_cluemart_shared25.EnumEventDateStatus.STARTING_SOON;
3242
+ return import_cluemart_shared26.EnumEventDateStatus.STARTING_SOON;
3214
3243
  }
3215
3244
  if (startDateTime.isSame(now, "day")) {
3216
- return import_cluemart_shared25.EnumEventDateStatus.TODAY;
3245
+ return import_cluemart_shared26.EnumEventDateStatus.TODAY;
3217
3246
  }
3218
3247
  if (startDateTime.isSame(now.add(1, "day"), "day")) {
3219
- return import_cluemart_shared25.EnumEventDateStatus.TOMORROW;
3248
+ return import_cluemart_shared26.EnumEventDateStatus.TOMORROW;
3220
3249
  }
3221
3250
  if (startDateTime.isSame(now, "isoWeek")) {
3222
- return import_cluemart_shared25.EnumEventDateStatus.THIS_WEEK;
3251
+ return import_cluemart_shared26.EnumEventDateStatus.THIS_WEEK;
3223
3252
  }
3224
3253
  if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
3225
- return import_cluemart_shared25.EnumEventDateStatus.NEXT_WEEK;
3254
+ return import_cluemart_shared26.EnumEventDateStatus.NEXT_WEEK;
3226
3255
  }
3227
- return import_cluemart_shared25.EnumEventDateStatus.UPCOMING;
3256
+ return import_cluemart_shared26.EnumEventDateStatus.UPCOMING;
3228
3257
  }
3229
3258
  function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs2.default)()) {
3230
- const dateTimeFormat = `${import_cluemart_shared25.dateFormat} ${import_cluemart_shared25.timeFormat}`;
3259
+ const dateTimeFormat = `${import_cluemart_shared26.dateFormat} ${import_cluemart_shared26.timeFormat}`;
3231
3260
  const startDateTime = (0, import_dayjs2.default)(
3232
3261
  `${dateTime.startDate} ${dateTime.startTime}`,
3233
3262
  dateTimeFormat,
@@ -3241,13 +3270,13 @@ function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs2.default)()
3241
3270
  if (!startDateTime.isValid() || !endDateTime.isValid()) {
3242
3271
  return {
3243
3272
  ...dateTime,
3244
- dateStatus: import_cluemart_shared25.EnumEventDateStatus.INVALID
3273
+ dateStatus: import_cluemart_shared26.EnumEventDateStatus.INVALID
3245
3274
  };
3246
3275
  }
3247
3276
  if (endDateTime.isBefore(startDateTime)) {
3248
3277
  return {
3249
3278
  ...dateTime,
3250
- dateStatus: import_cluemart_shared25.EnumEventDateStatus.INVALID
3279
+ dateStatus: import_cluemart_shared26.EnumEventDateStatus.INVALID
3251
3280
  };
3252
3281
  }
3253
3282
  let dateStatus;
@@ -3255,10 +3284,10 @@ function updateSingleDateTimeStatus(dateTime, now = (0, import_dayjs2.default)()
3255
3284
  if (startDateTime.isAfter(now)) {
3256
3285
  dateStatus = getFutureEventStatus(startDateTime, now);
3257
3286
  } else {
3258
- dateStatus = import_cluemart_shared25.EnumEventDateStatus.STARTED;
3287
+ dateStatus = import_cluemart_shared26.EnumEventDateStatus.STARTED;
3259
3288
  }
3260
3289
  } else {
3261
- dateStatus = import_cluemart_shared25.EnumEventDateStatus.ENDED;
3290
+ dateStatus = import_cluemart_shared26.EnumEventDateStatus.ENDED;
3262
3291
  }
3263
3292
  return {
3264
3293
  ...dateTime,
@@ -3314,6 +3343,111 @@ async function updateModelDateTimeStatuses(model, now) {
3314
3343
  }
3315
3344
  return updated;
3316
3345
  }
3346
+ var ARCHIVABLE_EVENT_FILTER = {
3347
+ "dateTime.dateStatus": {
3348
+ $in: [import_cluemart_shared26.EnumEventDateStatus.ENDED, import_cluemart_shared26.EnumEventDateStatus.INVALID]
3349
+ },
3350
+ deletedAt: null
3351
+ };
3352
+ async function archiveEndedAndDiscardInvalidEventDates(now) {
3353
+ const cursor = EventModel.find(ARCHIVABLE_EVENT_FILTER).select({ _id: 1, dateTime: 1 }).lean().cursor({ batchSize: CURSOR_BATCH_SIZE });
3354
+ let archivedCount = 0;
3355
+ let archiveOps = [];
3356
+ let eventOps = [];
3357
+ const flushBulkWrites = async () => {
3358
+ if (archiveOps.length) {
3359
+ await EventDateArchiveModel.bulkWrite(archiveOps);
3360
+ archiveOps = [];
3361
+ }
3362
+ if (eventOps.length) {
3363
+ await EventModel.bulkWrite(eventOps);
3364
+ eventOps = [];
3365
+ }
3366
+ };
3367
+ try {
3368
+ for await (const doc of cursor) {
3369
+ const updated = doc.dateTime.map(
3370
+ (slot) => updateSingleDateTimeStatus(slot, now)
3371
+ );
3372
+ const { archive, discard } = splitEventDatesForArchive(updated);
3373
+ if (archive.length === 0 && discard.length === 0) {
3374
+ continue;
3375
+ }
3376
+ if (archive.length > 0) {
3377
+ const uniqueArchive = dedupeArchivedSlotsByStartDateTime(archive);
3378
+ archiveOps.push({
3379
+ updateOne: {
3380
+ filter: { eventId: doc._id },
3381
+ update: { $addToSet: { dateTime: { $each: uniqueArchive } } },
3382
+ upsert: true
3383
+ }
3384
+ });
3385
+ archivedCount += uniqueArchive.length;
3386
+ }
3387
+ eventOps.push({
3388
+ updateOne: {
3389
+ filter: { _id: doc._id },
3390
+ update: {
3391
+ $pull: {
3392
+ dateTime: {
3393
+ dateStatus: {
3394
+ $in: [import_cluemart_shared26.EnumEventDateStatus.ENDED, import_cluemart_shared26.EnumEventDateStatus.INVALID]
3395
+ }
3396
+ }
3397
+ }
3398
+ }
3399
+ }
3400
+ });
3401
+ if (archiveOps.length >= CURSOR_BATCH_SIZE || eventOps.length >= CURSOR_BATCH_SIZE) {
3402
+ await flushBulkWrites();
3403
+ }
3404
+ }
3405
+ await flushBulkWrites();
3406
+ } finally {
3407
+ await cursor.close().catch(() => void 0);
3408
+ }
3409
+ return archivedCount;
3410
+ }
3411
+ var EVENT_INFO_DATE_FILTER = {
3412
+ dateTime: { $ne: [], $type: "array" }
3413
+ };
3414
+ async function cleanEventInfoDates(now) {
3415
+ const cursor = EventInfoModel.find(EVENT_INFO_DATE_FILTER).select({ _id: 1, dateTime: 1 }).lean().cursor({ batchSize: CURSOR_BATCH_SIZE });
3416
+ let removedCount = 0;
3417
+ let bulkOps = [];
3418
+ const flushBulkWrites = async () => {
3419
+ if (!bulkOps.length) {
3420
+ return;
3421
+ }
3422
+ await EventInfoModel.bulkWrite(bulkOps);
3423
+ bulkOps = [];
3424
+ };
3425
+ try {
3426
+ for await (const doc of cursor) {
3427
+ const updated = doc.dateTime.map(
3428
+ (slot) => updateSingleDateTimeStatus(slot, now)
3429
+ );
3430
+ const kept = (0, import_cluemart_shared26.filterDatesByFutureStatus)(updated);
3431
+ if (kept.length === updated.length) {
3432
+ continue;
3433
+ }
3434
+ bulkOps.push({
3435
+ updateOne: {
3436
+ filter: { _id: doc._id },
3437
+ update: { $set: { dateTime: kept } }
3438
+ }
3439
+ });
3440
+ removedCount += updated.length - kept.length;
3441
+ if (bulkOps.length >= CURSOR_BATCH_SIZE) {
3442
+ await flushBulkWrites();
3443
+ }
3444
+ }
3445
+ await flushBulkWrites();
3446
+ } finally {
3447
+ await cursor.close().catch(() => void 0);
3448
+ }
3449
+ return removedCount;
3450
+ }
3317
3451
  async function updateAllEventDateTimeStatuses() {
3318
3452
  const now = (0, import_dayjs2.default)();
3319
3453
  const [eventCount, marketCount] = await Promise.all([
@@ -3326,6 +3460,16 @@ async function updateAllEventDateTimeStatuses() {
3326
3460
  console.log(
3327
3461
  `\u2705 Event dateTime statuses updated: events=${eventCount} changed, google imported markets=${marketCount} changed`
3328
3462
  );
3463
+ const archivedCount = await archiveEndedAndDiscardInvalidEventDates(now);
3464
+ if (archivedCount > 0) {
3465
+ console.log(`\u2705 Archived ${archivedCount} ended event date slot(s)`);
3466
+ }
3467
+ const removedEventInfoCount = await cleanEventInfoDates(now);
3468
+ if (removedEventInfoCount > 0) {
3469
+ console.log(
3470
+ `\u2705 Removed ${removedEventInfoCount} non-future event info date slot(s)`
3471
+ );
3472
+ }
3329
3473
  }
3330
3474
 
3331
3475
  // src/service/event/findEventOrImportedMarketById.ts
@@ -3342,7 +3486,7 @@ async function findEventOrImportedMarketById(resourceId) {
3342
3486
  }
3343
3487
 
3344
3488
  // src/service/relations.ts
3345
- var import_cluemart_shared26 = require("@timardex/cluemart-shared");
3489
+ var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3346
3490
  function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
3347
3491
  if (!previousDateTime?.length) {
3348
3492
  return false;
@@ -3360,7 +3504,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
3360
3504
  ) ?? false;
3361
3505
  return {
3362
3506
  ...relationDate,
3363
- status: existsInEvent ? relationDate.status : import_cluemart_shared26.EnumInviteStatus.UNAVAILABLE
3507
+ status: existsInEvent ? relationDate.status : import_cluemart_shared27.EnumInviteStatus.UNAVAILABLE
3364
3508
  };
3365
3509
  });
3366
3510
  }
@@ -3369,15 +3513,15 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
3369
3513
  var import_dayjs6 = __toESM(require("dayjs"));
3370
3514
 
3371
3515
  // src/service/license/compliance/utils.ts
3372
- var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3516
+ var import_cluemart_shared32 = require("@timardex/cluemart-shared");
3373
3517
  var import_dayjs5 = __toESM(require("dayjs"));
3374
3518
 
3375
3519
  // src/service/license/compliance/event.ts
3376
- var import_cluemart_shared27 = require("@timardex/cluemart-shared");
3520
+ var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3377
3521
  var eventLicences = [
3378
- import_cluemart_shared27.EnumUserLicence.STANDARD_EVENT,
3379
- import_cluemart_shared27.EnumUserLicence.PRO_EVENT,
3380
- import_cluemart_shared27.EnumUserLicence.PRO_PLUS_EVENT
3522
+ import_cluemart_shared28.EnumUserLicence.STANDARD_EVENT,
3523
+ import_cluemart_shared28.EnumUserLicence.PRO_EVENT,
3524
+ import_cluemart_shared28.EnumUserLicence.PRO_PLUS_EVENT
3381
3525
  ];
3382
3526
  async function handleEventLicenceCompliance(user, now) {
3383
3527
  if (!user.licences || !user.events?.length) {
@@ -3589,9 +3733,9 @@ function buildLicenceExpiryPipeline(params) {
3589
3733
  }
3590
3734
 
3591
3735
  // src/service/license/compliance/partner.ts
3592
- var import_cluemart_shared28 = require("@timardex/cluemart-shared");
3736
+ var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3593
3737
  var partnerLicences = [
3594
- import_cluemart_shared28.EnumUserLicence.STANDARD_PARTNER
3738
+ import_cluemart_shared29.EnumUserLicence.STANDARD_PARTNER
3595
3739
  ];
3596
3740
  async function handlePartnerLicenceCompliance(user, now) {
3597
3741
  if (!user.licences || !user.partner) {
@@ -3601,11 +3745,11 @@ async function handlePartnerLicenceCompliance(user, now) {
3601
3745
  }
3602
3746
 
3603
3747
  // src/service/license/compliance/vendor.ts
3604
- var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3748
+ var import_cluemart_shared31 = require("@timardex/cluemart-shared");
3605
3749
  var import_dayjs4 = __toESM(require("dayjs"));
3606
3750
 
3607
3751
  // src/service/license/models.ts
3608
- var import_cluemart_shared29 = require("@timardex/cluemart-shared");
3752
+ var import_cluemart_shared30 = require("@timardex/cluemart-shared");
3609
3753
  var import_dayjs3 = __toESM(require("dayjs"));
3610
3754
  var import_graphql = require("graphql");
3611
3755
  var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
@@ -3617,31 +3761,31 @@ var LicenceCategory = /* @__PURE__ */ ((LicenceCategory2) => {
3617
3761
  return LicenceCategory2;
3618
3762
  })(LicenceCategory || {});
3619
3763
  var licenceCategoryMapping = {
3620
- [import_cluemart_shared29.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
3621
- [import_cluemart_shared29.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
3622
- [import_cluemart_shared29.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
3623
- [import_cluemart_shared29.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
3624
- [import_cluemart_shared29.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
3625
- [import_cluemart_shared29.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
3626
- [import_cluemart_shared29.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
3627
- [import_cluemart_shared29.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
3628
- [import_cluemart_shared29.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
3764
+ [import_cluemart_shared30.EnumUserLicence.PRO_EVENT]: "event" /* EVENT */,
3765
+ [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_EVENT]: "event" /* EVENT */,
3766
+ [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR]: "vendor" /* VENDOR */,
3767
+ [import_cluemart_shared30.EnumUserLicence.PRO_VENDOR]: "vendor" /* VENDOR */,
3768
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT]: "event" /* EVENT */,
3769
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER]: "partner" /* PARTNER */,
3770
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR]: "vendor" /* VENDOR */,
3771
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_AFFILIATE]: "affiliate" /* AFFILIATE */,
3772
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_SCHOOL]: "school" /* SCHOOL */
3629
3773
  };
3630
3774
  var licencePriority = {
3631
- [import_cluemart_shared29.EnumUserLicence.PRO_PLUS_EVENT]: 3,
3632
- [import_cluemart_shared29.EnumUserLicence.PRO_EVENT]: 2,
3633
- [import_cluemart_shared29.EnumUserLicence.STANDARD_EVENT]: 1,
3634
- [import_cluemart_shared29.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
3635
- [import_cluemart_shared29.EnumUserLicence.PRO_VENDOR]: 2,
3636
- [import_cluemart_shared29.EnumUserLicence.STANDARD_VENDOR]: 1,
3637
- [import_cluemart_shared29.EnumUserLicence.STANDARD_PARTNER]: 1,
3638
- [import_cluemart_shared29.EnumUserLicence.STANDARD_AFFILIATE]: 1,
3639
- [import_cluemart_shared29.EnumUserLicence.STANDARD_SCHOOL]: 1
3775
+ [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_EVENT]: 3,
3776
+ [import_cluemart_shared30.EnumUserLicence.PRO_EVENT]: 2,
3777
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT]: 1,
3778
+ [import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR]: 3,
3779
+ [import_cluemart_shared30.EnumUserLicence.PRO_VENDOR]: 2,
3780
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR]: 1,
3781
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER]: 1,
3782
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_AFFILIATE]: 1,
3783
+ [import_cluemart_shared30.EnumUserLicence.STANDARD_SCHOOL]: 1
3640
3784
  };
3641
3785
  var standardLicences = [
3642
- import_cluemart_shared29.EnumUserLicence.STANDARD_VENDOR,
3643
- import_cluemart_shared29.EnumUserLicence.STANDARD_EVENT,
3644
- import_cluemart_shared29.EnumUserLicence.STANDARD_PARTNER
3786
+ import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
3787
+ import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT,
3788
+ import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER
3645
3789
  ];
3646
3790
  var standardLicenceSet = new Set(standardLicences);
3647
3791
  function isStandardLicence(licence) {
@@ -3655,11 +3799,11 @@ var categoryRegexMapping = {
3655
3799
  ["school" /* SCHOOL */]: /_school$/
3656
3800
  };
3657
3801
  var categoryFallbackLicence = {
3658
- ["event" /* EVENT */]: import_cluemart_shared29.EnumUserLicence.STANDARD_EVENT,
3659
- ["partner" /* PARTNER */]: import_cluemart_shared29.EnumUserLicence.STANDARD_PARTNER,
3660
- ["vendor" /* VENDOR */]: import_cluemart_shared29.EnumUserLicence.STANDARD_VENDOR,
3661
- ["affiliate" /* AFFILIATE */]: import_cluemart_shared29.EnumUserLicence.STANDARD_AFFILIATE,
3662
- ["school" /* SCHOOL */]: import_cluemart_shared29.EnumUserLicence.STANDARD_SCHOOL
3802
+ ["event" /* EVENT */]: import_cluemart_shared30.EnumUserLicence.STANDARD_EVENT,
3803
+ ["partner" /* PARTNER */]: import_cluemart_shared30.EnumUserLicence.STANDARD_PARTNER,
3804
+ ["vendor" /* VENDOR */]: import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR,
3805
+ ["affiliate" /* AFFILIATE */]: import_cluemart_shared30.EnumUserLicence.STANDARD_AFFILIATE,
3806
+ ["school" /* SCHOOL */]: import_cluemart_shared30.EnumUserLicence.STANDARD_SCHOOL
3663
3807
  };
3664
3808
  var LicenceFilterInput = {
3665
3809
  INPUT_USER_LICENCES: "$licences"
@@ -3689,11 +3833,11 @@ function getHighestLicenceForCategory(licences, category) {
3689
3833
  function createLicenceObject(expiryDate, licenceType) {
3690
3834
  const today = (0, import_dayjs3.default)();
3691
3835
  const expiryDateMapping = {
3692
- [import_cluemart_shared29.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
3693
- [import_cluemart_shared29.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
3694
- [import_cluemart_shared29.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
3695
- [import_cluemart_shared29.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
3696
- [import_cluemart_shared29.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
3836
+ [import_cluemart_shared30.LicenceExpiryDate.ONE_YEAR]: today.add(1, "year").endOf("day").toDate(),
3837
+ [import_cluemart_shared30.LicenceExpiryDate.ONE_MONTH]: today.add(1, "month").endOf("day").toDate(),
3838
+ [import_cluemart_shared30.LicenceExpiryDate.TWO_MONTHS]: today.add(2, "month").endOf("day").toDate(),
3839
+ [import_cluemart_shared30.LicenceExpiryDate.THREE_MONTHS]: today.add(3, "month").endOf("day").toDate(),
3840
+ [import_cluemart_shared30.LicenceExpiryDate.SIX_MONTHS]: today.add(6, "month").endOf("day").toDate()
3697
3841
  };
3698
3842
  const licenceObject = {
3699
3843
  expiryDate: expiryDateMapping[expiryDate],
@@ -3797,13 +3941,13 @@ async function checkOwnerHasLicence({
3797
3941
  const owner = await UserModel.findById(userId);
3798
3942
  if (!owner) throw new import_graphql.GraphQLError("Owner not found");
3799
3943
  const categoryByResource = {
3800
- [import_cluemart_shared29.EnumResourceType.EVENT]: "event" /* EVENT */,
3801
- [import_cluemart_shared29.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
3802
- [import_cluemart_shared29.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
3803
- [import_cluemart_shared29.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
3804
- [import_cluemart_shared29.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
3944
+ [import_cluemart_shared30.EnumResourceType.EVENT]: "event" /* EVENT */,
3945
+ [import_cluemart_shared30.EnumResourceType.PARTNER]: "partner" /* PARTNER */,
3946
+ [import_cluemart_shared30.EnumResourceType.VENDOR]: "vendor" /* VENDOR */,
3947
+ [import_cluemart_shared30.EnumResourceType.AFFILIATE]: "affiliate" /* AFFILIATE */,
3948
+ [import_cluemart_shared30.EnumResourceType.SCHOOL]: "school" /* SCHOOL */
3805
3949
  };
3806
- if (!(0, import_cluemart_shared29.isNonVisitorResourceType)(resourceType)) {
3950
+ if (!(0, import_cluemart_shared30.isNonVisitorResourceType)(resourceType)) {
3807
3951
  throw new import_graphql.GraphQLError(`Invalid resource type: ${resourceType}.`);
3808
3952
  }
3809
3953
  const requiredCategory = categoryByResource[resourceType];
@@ -3883,7 +4027,7 @@ async function applyVendorDowngrade(vendor, ownerUserId) {
3883
4027
  return (result?.matchedCount ?? 0) > 0;
3884
4028
  }
3885
4029
  async function downgradeVendorProFeatures(userId, licenceType) {
3886
- const isStandardVendor = licenceType === import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR;
4030
+ const isStandardVendor = licenceType === import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR;
3887
4031
  if (!isStandardVendor) {
3888
4032
  return;
3889
4033
  }
@@ -3930,7 +4074,7 @@ async function applyVendorRestore(vendor, ownerUserId) {
3930
4074
  return (result?.matchedCount ?? 0) > 0;
3931
4075
  }
3932
4076
  async function restoreVendorProFeatures(userId, licenceType) {
3933
- const isProVendor = licenceType === import_cluemart_shared30.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared30.EnumUserLicence.PRO_PLUS_VENDOR;
4077
+ const isProVendor = licenceType === import_cluemart_shared31.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR;
3934
4078
  if (!isProVendor) {
3935
4079
  return;
3936
4080
  }
@@ -3951,14 +4095,14 @@ function isProtectedByCurrentStripeSubscription(user, licenceType, now) {
3951
4095
  return false;
3952
4096
  }
3953
4097
  const gracePeriodEndsAt = stripe.paymentGracePeriodEndsAt ? (0, import_dayjs4.default)(stripe.paymentGracePeriodEndsAt) : null;
3954
- const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared30.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared30.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
4098
+ const hasActivePaymentGracePeriod = (stripe.status === import_cluemart_shared31.EnumSubscriptionStatus.PAST_DUE || stripe.status === import_cluemart_shared31.EnumSubscriptionStatus.INACTIVE) && Boolean(stripe.paymentGraceSubscriptionId) && (!stripe.subscriptionId || stripe.subscriptionId === stripe.paymentGraceSubscriptionId) && gracePeriodEndsAt !== null && gracePeriodEndsAt.isValid() && gracePeriodEndsAt.isAfter(now);
3955
4099
  if (hasActivePaymentGracePeriod) {
3956
4100
  return true;
3957
4101
  }
3958
4102
  if (!stripe.subscriptionId) {
3959
4103
  return false;
3960
4104
  }
3961
- if (stripe.status !== import_cluemart_shared30.EnumSubscriptionStatus.ACTIVE) {
4105
+ if (stripe.status !== import_cluemart_shared31.EnumSubscriptionStatus.ACTIVE) {
3962
4106
  return false;
3963
4107
  }
3964
4108
  if (!stripe.endDate) {
@@ -3978,7 +4122,7 @@ async function handleVendorLicenceCompliance(user, now) {
3978
4122
  return;
3979
4123
  }
3980
4124
  const proLicences = vendorLicencesOfUser.filter(
3981
- (licence) => licence.licenceType !== import_cluemart_shared30.EnumUserLicence.STANDARD_VENDOR
4125
+ (licence) => licence.licenceType !== import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR
3982
4126
  );
3983
4127
  const expiredProLicences = proLicences.filter(
3984
4128
  (licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now)
@@ -3991,7 +4135,7 @@ async function handleVendorLicenceCompliance(user, now) {
3991
4135
  const expiredProLicence = expiredProLicences.some(
3992
4136
  (licence) => !stripeProtectedLicenceTypes.has(licence.licenceType)
3993
4137
  );
3994
- const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared30.vendorLicences, now);
4138
+ const hasValidProLicence = stripeProtectedLicenceTypes.size > 0 || hasValidLicence(proLicences, import_cluemart_shared31.vendorLicences, now);
3995
4139
  const hasExpiredVendorLicence = vendorLicencesOfUser.some(
3996
4140
  (licence) => !(0, import_dayjs4.default)(licence.expiryDate).isAfter(now) && !stripeProtectedLicenceTypes.has(licence.licenceType)
3997
4141
  );
@@ -4007,7 +4151,7 @@ async function handleVendorLicenceCompliance(user, now) {
4007
4151
  "owner.userId": user._id
4008
4152
  }).lean().exec();
4009
4153
  }
4010
- const licencesToSync = import_cluemart_shared30.vendorLicences.filter(
4154
+ const licencesToSync = import_cluemart_shared31.vendorLicences.filter(
4011
4155
  (licenceType) => !stripeProtectedLicenceTypes.has(licenceType)
4012
4156
  );
4013
4157
  await syncUserLicencesAfterExpiry(user._id, licencesToSync, now, "downgrade");
@@ -4022,11 +4166,11 @@ async function handleVendorLicenceCompliance(user, now) {
4022
4166
  data: {
4023
4167
  resourceId: String(vendor._id),
4024
4168
  resourceName: vendor.name,
4025
- resourceType: import_cluemart_shared30.EnumNotificationResourceType.DOWNGRADED_VENDOR
4169
+ resourceType: import_cluemart_shared31.EnumNotificationResourceType.DOWNGRADED_VENDOR
4026
4170
  },
4027
4171
  message: `Your Vendor licence has been downgraded due to licence expiration.`,
4028
4172
  title: `Vendor Licence Downgraded`,
4029
- type: import_cluemart_shared30.EnumNotificationType.SYSTEM,
4173
+ type: import_cluemart_shared31.EnumNotificationType.SYSTEM,
4030
4174
  userIds: [user._id]
4031
4175
  };
4032
4176
  await sendDeactivationNotification(payload, user._id, vendor.name, "vendor");
@@ -4059,7 +4203,7 @@ async function vendorOwnerHasProLicence(vendorId) {
4059
4203
  effectiveVendorLicences,
4060
4204
  "vendor" /* VENDOR */
4061
4205
  );
4062
- return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared30.EnumUserLicence.PRO_VENDOR];
4206
+ return highestVendorLicence !== null && licencePriority[highestVendorLicence] >= licencePriority[import_cluemart_shared31.EnumUserLicence.PRO_VENDOR];
4063
4207
  }
4064
4208
 
4065
4209
  // src/service/license/compliance/utils.ts
@@ -4069,12 +4213,12 @@ async function syncUserLicencesAfterExpiry(userId, licenceTypes, now, mode = "do
4069
4213
  const pipeline = buildLicenceExpiryPipeline({
4070
4214
  downgradeBranches: [
4071
4215
  {
4072
- case: import_cluemart_shared31.EnumUserLicence.PRO_PLUS_VENDOR,
4073
- then: import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR
4216
+ case: import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR,
4217
+ then: import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR
4074
4218
  },
4075
4219
  {
4076
- case: import_cluemart_shared31.EnumUserLicence.PRO_VENDOR,
4077
- then: import_cluemart_shared31.EnumUserLicence.STANDARD_VENDOR
4220
+ case: import_cluemart_shared32.EnumUserLicence.PRO_VENDOR,
4221
+ then: import_cluemart_shared32.EnumUserLicence.STANDARD_VENDOR
4078
4222
  }
4079
4223
  ],
4080
4224
  licenceTypes,
@@ -4203,7 +4347,7 @@ var REMINDER_WINDOW_MIN_HOURS = 6.5 * 24;
4203
4347
  var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
4204
4348
 
4205
4349
  // src/service/license/reminder/utils.ts
4206
- var import_cluemart_shared32 = require("@timardex/cluemart-shared");
4350
+ var import_cluemart_shared33 = require("@timardex/cluemart-shared");
4207
4351
  var import_utils8 = require("@timardex/cluemart-shared/utils");
4208
4352
  var import_dayjs7 = __toESM(require("dayjs"));
4209
4353
 
@@ -4269,28 +4413,28 @@ function isLicenseExpiringIn7Days(expiryDate, now) {
4269
4413
  return hoursUntilExpiry >= REMINDER_WINDOW_MIN_HOURS && hoursUntilExpiry <= REMINDER_WINDOW_MAX_HOURS;
4270
4414
  }
4271
4415
  function getLicenseName(licenceType) {
4272
- return import_cluemart_shared32.licenseNiceNames[licenceType] || licenceType;
4416
+ return import_cluemart_shared33.licenseNiceNames[licenceType] || licenceType;
4273
4417
  }
4274
4418
  function getNotificationTypes(isVendorLicense, isPartnerLicense) {
4275
4419
  if (isVendorLicense) {
4276
4420
  return {
4277
- notificationType: import_cluemart_shared32.EnumNotificationType.SYSTEM,
4278
- resourceType: import_cluemart_shared32.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4421
+ notificationType: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4422
+ resourceType: import_cluemart_shared33.EnumNotificationResourceType.EXPIRATION_REMINDER_VENDOR
4279
4423
  };
4280
4424
  }
4281
4425
  if (isPartnerLicense) {
4282
4426
  return {
4283
- notificationType: import_cluemart_shared32.EnumNotificationType.SYSTEM,
4284
- resourceType: import_cluemart_shared32.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4427
+ notificationType: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4428
+ resourceType: import_cluemart_shared33.EnumNotificationResourceType.EXPIRATION_REMINDER_PARTNER
4285
4429
  };
4286
4430
  }
4287
4431
  return {
4288
- notificationType: import_cluemart_shared32.EnumNotificationType.SYSTEM,
4289
- resourceType: import_cluemart_shared32.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4432
+ notificationType: import_cluemart_shared33.EnumNotificationType.SYSTEM,
4433
+ resourceType: import_cluemart_shared33.EnumNotificationResourceType.EXPIRATION_REMINDER_EVENT
4290
4434
  };
4291
4435
  }
4292
4436
  async function getLicenseResourceInfo(user, licence) {
4293
- const isVendorLicense = import_cluemart_shared32.vendorLicences.includes(licence.licenceType);
4437
+ const isVendorLicense = import_cluemart_shared33.vendorLicences.includes(licence.licenceType);
4294
4438
  const isPartnerLicense = partnerLicences.includes(licence.licenceType);
4295
4439
  const licenceName = getLicenseName(licence.licenceType);
4296
4440
  const { notificationType, resourceType } = getNotificationTypes(
@@ -4338,11 +4482,11 @@ async function getLicenseResourceInfo(user, licence) {
4338
4482
  };
4339
4483
  }
4340
4484
  function getLicenceExpiryMode(licenceType) {
4341
- return licenceType === import_cluemart_shared32.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared32.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4485
+ return licenceType === import_cluemart_shared33.EnumUserLicence.PRO_VENDOR || licenceType === import_cluemart_shared33.EnumUserLicence.PRO_PLUS_VENDOR ? "downgrade" : "extend";
4342
4486
  }
4343
4487
  async function sendLicenseReminder(user, licence) {
4344
4488
  const licenceName = getLicenseName(licence.licenceType);
4345
- const expiryDate = (0, import_dayjs7.default)(licence.expiryDate).format(import_cluemart_shared32.dateFormat);
4489
+ const expiryDate = (0, import_dayjs7.default)(licence.expiryDate).format(import_cluemart_shared33.dateFormat);
4346
4490
  const userId = String(user._id);
4347
4491
  const resourceInfo = await getLicenseResourceInfo(user, licence);
4348
4492
  if (!resourceInfo) {
@@ -4486,6 +4630,7 @@ async function remindUsersAboutLicenseExpiration() {
4486
4630
  CouponModel,
4487
4631
  DEFAULT_AD_SETTINGS,
4488
4632
  EnumPubSubEvents,
4633
+ EventDateArchiveModel,
4489
4634
  EventInfoModel,
4490
4635
  EventModel,
4491
4636
  GameModel,
@@ -4521,6 +4666,7 @@ async function remindUsersAboutLicenseExpiration() {
4521
4666
  convertObjectIdsToStrings,
4522
4667
  createLicenceObject,
4523
4668
  dateTimeSchema,
4669
+ dedupeArchivedSlotsByStartDateTime,
4524
4670
  didRemoveAnyEventDates,
4525
4671
  downgradeVendorProFeatures,
4526
4672
  ensureUserLicenseCompliance,
@@ -4556,6 +4702,7 @@ async function remindUsersAboutLicenseExpiration() {
4556
4702
  normalizePromoCode,
4557
4703
  notifyUsers,
4558
4704
  partnerLicences,
4705
+ persistArchivedEventDates,
4559
4706
  processLicenseReminder,
4560
4707
  processUserCompliance,
4561
4708
  processUserLicenseReminders,
@@ -4565,7 +4712,6 @@ async function remindUsersAboutLicenseExpiration() {
4565
4712
  relationDatesSchema,
4566
4713
  remindUsersAboutLicenseExpiration,
4567
4714
  replaceUserLicenceWithObject,
4568
- resourceRelationsSchema,
4569
4715
  restoreVendorProFeatures,
4570
4716
  saveNotificationsInDb,
4571
4717
  schemaAdresource,
@@ -4574,6 +4720,7 @@ async function remindUsersAboutLicenseExpiration() {
4574
4720
  sendPushNotifications,
4575
4721
  sendReminderSafely,
4576
4722
  socialShareResourceSchema,
4723
+ splitEventDatesForArchive,
4577
4724
  syncUserLicencesAfterExpiry,
4578
4725
  termsAgreementSchema,
4579
4726
  updateAdStatuses,