@timardex/cluemart-server-shared 4.0.8 → 4.2.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.
@@ -43,6 +43,7 @@ __export(mongoose_exports, {
43
43
  AiImportRunModel: () => AiImportRunModel,
44
44
  AiImportedMarketModel: () => AiImportedMarketModel,
45
45
  AppSettingModel: () => AppSettingModel,
46
+ AssociateTypeSchema: () => AssociateTypeSchema,
46
47
  AuthHandoffTokenModel: () => AuthHandoffTokenModel,
47
48
  BILLING_CATALOG_COLLECTION_NAME: () => BILLING_CATALOG_COLLECTION_NAME,
48
49
  BillingCatalogModel: () => BillingCatalogModel,
@@ -776,6 +777,25 @@ var OwnerTypeSchema = new MongooseSchema5(
776
777
  { _id: false }
777
778
  // Prevents Mongoose from creating an additional _id field for subdocuments
778
779
  );
780
+ var AssociateTypeSchema = new MongooseSchema5(
781
+ {
782
+ addedAt: { default: Date.now, required: false, type: Date },
783
+ email: { lowercase: true, required: true, trim: true, type: String },
784
+ respondedAt: { default: null, required: false, type: Date },
785
+ status: {
786
+ default: import_cluemart_shared8.EnumAssociateStatus.PENDING,
787
+ enum: Object.values(import_cluemart_shared8.EnumAssociateStatus),
788
+ required: true,
789
+ type: String
790
+ },
791
+ userId: {
792
+ ref: "User",
793
+ required: true,
794
+ type: import_mongoose9.default.Schema.Types.ObjectId
795
+ }
796
+ },
797
+ { _id: false }
798
+ );
779
799
  var SocialMediaTypeSchema = new MongooseSchema5(
780
800
  {
781
801
  link: { required: true, type: String },
@@ -941,6 +961,7 @@ var baseResourceFields = {
941
961
  type: [import_mongoose9.default.Schema.Types.ObjectId]
942
962
  },
943
963
  approvedAt: { default: null, required: false, type: Date },
964
+ associates: { default: [], required: false, type: [AssociateTypeSchema] },
944
965
  contactDetails: { required: false, type: ContactDetailsSchema },
945
966
  cover: {
946
967
  required: true,
@@ -1207,6 +1228,8 @@ var schema8 = new MongooseSchema7(
1207
1228
  missingFields: { required: false, type: [String] },
1208
1229
  name: { required: true, type: String },
1209
1230
  openingHours: { required: false, type: [String] },
1231
+ publicationCityUnknown: { default: false, required: false, type: Boolean },
1232
+ publicationKey: { required: false, type: String },
1210
1233
  rainOrShine: { required: true, type: Boolean },
1211
1234
  rating: { required: false, type: Number },
1212
1235
  region: { required: false, type: String },
@@ -1218,6 +1241,7 @@ var schema8 = new MongooseSchema7(
1218
1241
  required: false,
1219
1242
  type: import_mongoose11.default.Schema.Types.ObjectId
1220
1243
  },
1244
+ reviewerEditedAt: { default: null, required: false, type: Date },
1221
1245
  reviewStatus: {
1222
1246
  default: import_cluemart_shared10.EnumImportedMarketReviewStatus.PENDING,
1223
1247
  enum: Object.values(import_cluemart_shared10.EnumImportedMarketReviewStatus),
@@ -1254,6 +1278,16 @@ schema8.index({
1254
1278
  _id: 1
1255
1279
  });
1256
1280
  schema8.index({ region: 1, searchName: 1 });
1281
+ schema8.index(
1282
+ { publicationKey: 1 },
1283
+ {
1284
+ name: "ai_market_publication_key",
1285
+ partialFilterExpression: {
1286
+ publicationKey: { $exists: true, $type: "string" }
1287
+ },
1288
+ unique: true
1289
+ }
1290
+ );
1257
1291
  schema8.index({ slug: 1 });
1258
1292
  schema8.index({ reviewStatus: 1 });
1259
1293
  schema8.index({ description: "text", name: "text" });
@@ -1809,6 +1843,29 @@ var userOverallPointsSchema = new MongooseSchema16(
1809
1843
  },
1810
1844
  { _id: false }
1811
1845
  );
1846
+ var userAssociatedResourcesSchema = new MongooseSchema16(
1847
+ {
1848
+ events: {
1849
+ default: [],
1850
+ ref: "Event",
1851
+ required: false,
1852
+ type: [import_mongoose20.default.Schema.Types.ObjectId]
1853
+ },
1854
+ partners: {
1855
+ default: [],
1856
+ ref: "Partner",
1857
+ required: false,
1858
+ type: [import_mongoose20.default.Schema.Types.ObjectId]
1859
+ },
1860
+ vendors: {
1861
+ default: [],
1862
+ ref: "Vendor",
1863
+ required: false,
1864
+ type: [import_mongoose20.default.Schema.Types.ObjectId]
1865
+ }
1866
+ },
1867
+ { _id: false }
1868
+ );
1812
1869
  var schema15 = new MongooseSchema16(
1813
1870
  {
1814
1871
  active: { default: false, required: true, type: Boolean },
@@ -1817,6 +1874,11 @@ var schema15 = new MongooseSchema16(
1817
1874
  required: false,
1818
1875
  type: import_mongoose20.default.Schema.Types.ObjectId
1819
1876
  },
1877
+ associatedResources: {
1878
+ default: () => ({ events: [], partners: [], vendors: [] }),
1879
+ required: false,
1880
+ type: userAssociatedResourcesSchema
1881
+ },
1820
1882
  avatar: {
1821
1883
  required: false,
1822
1884
  type: ResourceImageTypeSchema
@@ -1827,7 +1889,10 @@ var schema15 = new MongooseSchema16(
1827
1889
  type: import_mongoose20.default.Schema.Types.ObjectId
1828
1890
  },
1829
1891
  deletedAt: { default: null, required: false, type: Date },
1830
- email: { required: true, type: String },
1892
+ // `normalizeEmail` (`cluemart-shared`) is trim + lower-case; keeping the same
1893
+ // rule here means every write path — resolvers, seeds, scripts — stores the
1894
+ // comparable form, not only the clients that validate through `emailRequiredSchema`.
1895
+ email: { lowercase: true, required: true, trim: true, type: String },
1831
1896
  emailSentFor: {
1832
1897
  enum: Object.values(import_cluemart_shared16.EnumNotificationResourceType),
1833
1898
  required: false,
@@ -1942,6 +2007,9 @@ schema15.index({ "licences.expiryDate": 1 });
1942
2007
  schema15.index({ "licences.licenceType": 1 });
1943
2008
  schema15.index({ promoCodes: 1, active: 1, deletedAt: 1 });
1944
2009
  schema15.index({ email: "text", firstName: "text", lastName: "text" });
2010
+ schema15.index({ "associatedResources.events": 1 });
2011
+ schema15.index({ "associatedResources.partners": 1 });
2012
+ schema15.index({ "associatedResources.vendors": 1 });
1945
2013
  var UserModel = import_mongoose20.default.models.User || import_mongoose20.default.model("User", schema15);
1946
2014
 
1947
2015
  // src/mongoose/VerificationToken.ts
@@ -2075,6 +2143,7 @@ schema17.index({
2075
2143
  name: "text"
2076
2144
  });
2077
2145
  schema17.index({ deletedAt: 1, "owner.userId": 1 });
2146
+ schema17.index({ "associates.userId": 1, deletedAt: 1 });
2078
2147
  schema17.plugin(searchNamePlugin);
2079
2148
  var VendorModel = import_mongoose22.default.models.Vendor || import_mongoose22.default.model("Vendor", schema17);
2080
2149
 
@@ -2180,6 +2249,13 @@ var schema20 = new MongooseSchema21(
2180
2249
  {
2181
2250
  ...baseResourceFields,
2182
2251
  // Importing base resource fields from global.ts
2252
+ // Claim link of the AI-imported market this event was created from, the
2253
+ // counterpart of `googlePlaceId`. Written once by `createEvent`.
2254
+ aiImportedMarketSourceKey: {
2255
+ default: null,
2256
+ required: false,
2257
+ type: String
2258
+ },
2183
2259
  claimed: { default: true, required: false, type: Boolean },
2184
2260
  dateTime: { required: true, type: [dateTimeSchema] },
2185
2261
  eventInfoId: {
@@ -2219,6 +2295,7 @@ schema20.index({ "dateTime.dateStatus": 1 });
2219
2295
  schema20.index({ slug: 1 });
2220
2296
  schema20.index({ description: "text", name: "text", tags: "text" });
2221
2297
  schema20.index({ deletedAt: 1, "owner.userId": 1 });
2298
+ schema20.index({ "associates.userId": 1, deletedAt: 1 });
2222
2299
  schema20.plugin(searchNamePlugin);
2223
2300
  var EventModel = import_mongoose25.default.models.Event || import_mongoose25.default.model("Event", schema20);
2224
2301
 
@@ -2265,6 +2342,7 @@ schema22.index({ "location.geo": "2dsphere" });
2265
2342
  schema22.index({ slug: 1 });
2266
2343
  schema22.index({ name: "text", description: "text" });
2267
2344
  schema22.index({ "owner.userId": 1, deletedAt: 1 });
2345
+ schema22.index({ "associates.userId": 1, deletedAt: 1 });
2268
2346
  schema22.plugin(searchNamePlugin);
2269
2347
  var PartnerModel = import_mongoose27.default.models.Partner || import_mongoose27.default.model("Partner", schema22);
2270
2348
 
@@ -2917,6 +2995,7 @@ var ImpersonationAuditModel = import_mongoose38.default.models.ImpersonationAudi
2917
2995
  AiImportRunModel,
2918
2996
  AiImportedMarketModel,
2919
2997
  AppSettingModel,
2998
+ AssociateTypeSchema,
2920
2999
  AuthHandoffTokenModel,
2921
3000
  BILLING_CATALOG_COLLECTION_NAME,
2922
3001
  BillingCatalogModel,