@timardex/cluemart-server-shared 1.0.143 → 1.0.146

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
@@ -1711,7 +1711,7 @@ __export(index_exports, {
1711
1711
  findEventOrImportedMarketById: () => findEventOrImportedMarketById,
1712
1712
  locationGeoSchema: () => locationGeoSchema,
1713
1713
  locationsSchema: () => locationsSchema,
1714
- mongoose: () => import_mongoose26.default,
1714
+ mongoose: () => import_mongoose27.default,
1715
1715
  refundPolicySchema: () => refundPolicySchema,
1716
1716
  relationDatesSchema: () => relationDatesSchema,
1717
1717
  resourceRelationsSchema: () => resourceRelationsSchema,
@@ -8703,8 +8703,8 @@ var GET_EVENTS_BY_REGION = gql`
8703
8703
  ${EVENT_LIST_ITEM}
8704
8704
  `;
8705
8705
  var SEARCH_EVENTS = gql`
8706
- query searchEvents($search: String!, $region: String) {
8707
- eventsSearch(search: $search, region: $region) {
8706
+ query searchEvents($region: String, $search: String,$tags: [String]) {
8707
+ eventsSearch(region: $region, search: $search, tags: $tags) {
8708
8708
  ...EventListItemFields
8709
8709
  }
8710
8710
  }
@@ -10176,6 +10176,7 @@ var POST_FIELDS_FRAGMENT = gql`
10176
10176
  postType
10177
10177
  resource {
10178
10178
  resourceId
10179
+ resourceRegion
10179
10180
  resourceType
10180
10181
  }
10181
10182
  tags
@@ -10916,6 +10917,7 @@ var postSchema = create$3().shape({
10916
10917
  postType: create$8().oneOf(Object.values(EnumPostType)).required(),
10917
10918
  resource: create$3({
10918
10919
  resourceId: create$6().required(),
10920
+ resourceRegion: create$6().required(),
10919
10921
  resourceType: create$8().oneOf(Object.values(EnumResourceType)).required()
10920
10922
  }).nullable().optional(),
10921
10923
  tags: create$2().of(create$6().required()).nullable().optional(),
@@ -12307,6 +12309,7 @@ var schema13 = new MongooseSchema17(
12307
12309
  required: false,
12308
12310
  type: {
12309
12311
  resourceId: { required: true, type: String },
12312
+ resourceRegion: { required: true, type: String },
12310
12313
  resourceType: {
12311
12314
  enum: Object.values(EnumResourceType),
12312
12315
  required: true,
@@ -12665,6 +12668,37 @@ async function updateAdStatuses() {
12665
12668
  );
12666
12669
  }
12667
12670
 
12671
+ // src/service/associate.ts
12672
+ async function removeAssociateFromResource(resourceId, resourceType) {
12673
+ const normalizedResourceId = resourceId.toString();
12674
+ try {
12675
+ await UserModel.updateMany(
12676
+ {
12677
+ associates: {
12678
+ $elemMatch: {
12679
+ resourceId: normalizedResourceId,
12680
+ resourceType
12681
+ }
12682
+ }
12683
+ },
12684
+ {
12685
+ $pull: {
12686
+ associates: {
12687
+ resourceId: normalizedResourceId,
12688
+ resourceType
12689
+ }
12690
+ }
12691
+ }
12692
+ ).exec();
12693
+ } catch (error) {
12694
+ console.error(
12695
+ `[removeAssociateFromResource] Failed to remove associates for resourceId=${normalizedResourceId}, resourceType=${resourceType}`,
12696
+ error
12697
+ );
12698
+ throw error;
12699
+ }
12700
+ }
12701
+
12668
12702
  // src/service/vendor.ts
12669
12703
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12670
12704
  try {
@@ -12717,18 +12751,19 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12717
12751
  },
12718
12752
  { new: true }
12719
12753
  );
12754
+ await removeAssociateFromResource(userVendor._id, EnumResourceType.VENDOR);
12720
12755
  } catch (error) {
12721
12756
  console.error("Error updating vendor based on user license:", error);
12722
12757
  }
12723
12758
  }
12724
12759
 
12725
12760
  // src/service/objectIdToString.ts
12726
- var import_mongoose24 = __toESM(require("mongoose"));
12761
+ var import_mongoose25 = __toESM(require("mongoose"));
12727
12762
  function convertObjectIdsToStrings(obj) {
12728
12763
  if (obj === null || obj === void 0) {
12729
12764
  return obj;
12730
12765
  }
12731
- if (obj instanceof import_mongoose24.default.Types.ObjectId) {
12766
+ if (obj instanceof import_mongoose25.default.Types.ObjectId) {
12732
12767
  return obj.toString();
12733
12768
  }
12734
12769
  if (Array.isArray(obj)) {
@@ -12759,7 +12794,7 @@ async function findEventOrImportedMarketById(resourceId) {
12759
12794
 
12760
12795
  // src/types/index.ts
12761
12796
  var import_express = __toESM(require("express"));
12762
- var import_mongoose26 = __toESM(require("mongoose"));
12797
+ var import_mongoose27 = __toESM(require("mongoose"));
12763
12798
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12764
12799
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12765
12800
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";