@timardex/cluemart-server-shared 1.0.142 → 1.0.145

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,
@@ -6813,22 +6813,24 @@ var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceTyp
6813
6813
  EnumNotificationResourceType22["CREATED_EVENT"] = "created_event";
6814
6814
  EnumNotificationResourceType22["CREATED_PARTNER"] = "created_partner";
6815
6815
  EnumNotificationResourceType22["CREATED_VENDOR"] = "created_vendor";
6816
+ EnumNotificationResourceType22["DAILY_CLUE_GAME"] = "daily_clue_game";
6816
6817
  EnumNotificationResourceType22["DEACTIVATED_EVENT"] = "deactivated_event";
6817
6818
  EnumNotificationResourceType22["DEACTIVATED_PARTNER"] = "deactivated_partner";
6818
6819
  EnumNotificationResourceType22["DEACTIVATED_VENDOR"] = "deactivated_vendor";
6819
- EnumNotificationResourceType22["DOWNGRADED_EVENT"] = "downgraded_event";
6820
- EnumNotificationResourceType22["DOWNGRADED_PARTNER"] = "downgraded_partner";
6821
- EnumNotificationResourceType22["DOWNGRADED_VENDOR"] = "downgraded_vendor";
6822
6820
  EnumNotificationResourceType22["DECLINED_EVENT"] = "declined_event";
6823
6821
  EnumNotificationResourceType22["DECLINED_PARTNER"] = "declined_partner";
6824
6822
  EnumNotificationResourceType22["DECLINED_VENDOR"] = "declined_vendor";
6825
- EnumNotificationResourceType22["DAILY_CLUE_GAME"] = "daily_clue_game";
6823
+ EnumNotificationResourceType22["DOWNGRADED_EVENT"] = "downgraded_event";
6824
+ EnumNotificationResourceType22["DOWNGRADED_PARTNER"] = "downgraded_partner";
6825
+ EnumNotificationResourceType22["DOWNGRADED_VENDOR"] = "downgraded_vendor";
6826
6826
  EnumNotificationResourceType22["EVENT_INVITE_VENDOR"] = "event_invite_vendor";
6827
6827
  EnumNotificationResourceType22["EVENT_STARTING_SOON"] = "event_starting_soon";
6828
6828
  EnumNotificationResourceType22["EXPIRATION_REMINDER_EVENT"] = "expiration_reminder_event";
6829
6829
  EnumNotificationResourceType22["EXPIRATION_REMINDER_PARTNER"] = "expiration_reminder_partner";
6830
6830
  EnumNotificationResourceType22["EXPIRATION_REMINDER_VENDOR"] = "expiration_reminder_vendor";
6831
6831
  EnumNotificationResourceType22["NEW_CHAT_MESSAGE"] = "new_chat_message";
6832
+ EnumNotificationResourceType22["NEW_POST_CREATED"] = "new_post_created";
6833
+ EnumNotificationResourceType22["REGISTERED_USER_BY_SCHOOL_CODE"] = "registered_user_by_school_code";
6832
6834
  EnumNotificationResourceType22["SYSTEM_ALERT"] = "system_alert";
6833
6835
  EnumNotificationResourceType22["VENDOR_APPLICATION_TO_EVENT"] = "vendor_application_to_event";
6834
6836
  return EnumNotificationResourceType22;
@@ -6906,6 +6908,100 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6906
6908
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
6907
6909
  return EnumSubscriptionStatus22;
6908
6910
  })(EnumSubscriptionStatus || {});
6911
+ var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
6912
+ var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
6913
+ var gameScreenIdentifierList = [
6914
+ {
6915
+ clue: "Where your actions turn into a timeline.",
6916
+ id: "activities",
6917
+ match: "/profile/activities"
6918
+ },
6919
+ {
6920
+ clue: "Where conversations happen without speaking.",
6921
+ id: "chat",
6922
+ match: "/profile/chat"
6923
+ },
6924
+ {
6925
+ clue: "The place to redefine who you are.",
6926
+ id: "edit-profile",
6927
+ match: "/profile/edit-profile"
6928
+ },
6929
+ {
6930
+ clue: "A single moment worth showing up for.",
6931
+ id: "single-event",
6932
+ match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`)
6933
+ },
6934
+ {
6935
+ clue: "What\u2019s happening around you, right now.",
6936
+ id: "events-near-me",
6937
+ match: "/events/events-near-me"
6938
+ },
6939
+ {
6940
+ clue: "A collection of things worth attending.",
6941
+ id: "events",
6942
+ match: "/events"
6943
+ },
6944
+ {
6945
+ clue: "What\u2019s happening in a wider area \u2014 not just nearby.",
6946
+ id: "events-region",
6947
+ match: /^\/events\/region\/[^/]+$/
6948
+ },
6949
+ {
6950
+ clue: "Where fun becomes a challenge.",
6951
+ id: "games",
6952
+ match: "/games"
6953
+ },
6954
+ {
6955
+ clue: "Your starting point for everything.",
6956
+ id: "home",
6957
+ match: "/"
6958
+ },
6959
+ {
6960
+ clue: "Where the app whispers what you shouldn\u2019t miss.",
6961
+ id: "notifications",
6962
+ match: "/notifications"
6963
+ },
6964
+ {
6965
+ clue: "Where you fine-tune your experience.",
6966
+ id: "options",
6967
+ match: "/options"
6968
+ },
6969
+ {
6970
+ clue: "An organisation or creator supporting the community.",
6971
+ id: "single-partner",
6972
+ match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`)
6973
+ },
6974
+ {
6975
+ clue: "Organisations and creators supporting the community.",
6976
+ id: "partners",
6977
+ match: "/partners"
6978
+ },
6979
+ {
6980
+ clue: "A single published post in full view.",
6981
+ id: "single-visitor-post",
6982
+ match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`)
6983
+ },
6984
+ {
6985
+ clue: "Your identity, on display.",
6986
+ id: "profile",
6987
+ match: "/profile"
6988
+ },
6989
+ {
6990
+ clue: "One stallholder offering something valuable.",
6991
+ id: "single-vendor",
6992
+ match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`)
6993
+ },
6994
+ {
6995
+ clue: "Where every stallholder waits under the right category.",
6996
+ id: "vendors",
6997
+ match: "/vendors"
6998
+ },
6999
+ {
7000
+ clue: "Where you browse articles and posts from around the platform.",
7001
+ id: "visitors",
7002
+ match: "/visitors"
7003
+ }
7004
+ ];
6909
7005
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6910
7006
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
6911
7007
  return EnumGameType2;
@@ -11704,7 +11800,7 @@ schema4.index({ isRead: 1, userId: 1 });
11704
11800
  schema4.index({ createdAt: -1, userId: 1 });
11705
11801
  var NotificationModel = import_mongoose8.default.models.Notification || import_mongoose8.default.model("Notification", schema4);
11706
11802
 
11707
- // node_modules/@timardex/cluemart-shared/dist/chunk-73ULMQM6.mjs
11803
+ // node_modules/@timardex/cluemart-shared/dist/chunk-ZR4TGWTS.mjs
11708
11804
  var EnumOSPlatform2 = /* @__PURE__ */ ((EnumOSPlatform22) => {
11709
11805
  EnumOSPlatform22["ANDROID"] = "android";
11710
11806
  EnumOSPlatform22["IOS"] = "ios";
@@ -12569,6 +12665,37 @@ async function updateAdStatuses() {
12569
12665
  );
12570
12666
  }
12571
12667
 
12668
+ // src/service/associate.ts
12669
+ async function removeAssociateFromResource(resourceId, resourceType) {
12670
+ const normalizedResourceId = resourceId.toString();
12671
+ try {
12672
+ await UserModel.updateMany(
12673
+ {
12674
+ associates: {
12675
+ $elemMatch: {
12676
+ resourceId: normalizedResourceId,
12677
+ resourceType
12678
+ }
12679
+ }
12680
+ },
12681
+ {
12682
+ $pull: {
12683
+ associates: {
12684
+ resourceId: normalizedResourceId,
12685
+ resourceType
12686
+ }
12687
+ }
12688
+ }
12689
+ ).exec();
12690
+ } catch (error) {
12691
+ console.error(
12692
+ `[removeAssociateFromResource] Failed to remove associates for resourceId=${normalizedResourceId}, resourceType=${resourceType}`,
12693
+ error
12694
+ );
12695
+ throw error;
12696
+ }
12697
+ }
12698
+
12572
12699
  // src/service/vendor.ts
12573
12700
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12574
12701
  try {
@@ -12621,18 +12748,19 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12621
12748
  },
12622
12749
  { new: true }
12623
12750
  );
12751
+ await removeAssociateFromResource(userVendor._id, EnumResourceType.VENDOR);
12624
12752
  } catch (error) {
12625
12753
  console.error("Error updating vendor based on user license:", error);
12626
12754
  }
12627
12755
  }
12628
12756
 
12629
12757
  // src/service/objectIdToString.ts
12630
- var import_mongoose24 = __toESM(require("mongoose"));
12758
+ var import_mongoose25 = __toESM(require("mongoose"));
12631
12759
  function convertObjectIdsToStrings(obj) {
12632
12760
  if (obj === null || obj === void 0) {
12633
12761
  return obj;
12634
12762
  }
12635
- if (obj instanceof import_mongoose24.default.Types.ObjectId) {
12763
+ if (obj instanceof import_mongoose25.default.Types.ObjectId) {
12636
12764
  return obj.toString();
12637
12765
  }
12638
12766
  if (Array.isArray(obj)) {
@@ -12663,7 +12791,7 @@ async function findEventOrImportedMarketById(resourceId) {
12663
12791
 
12664
12792
  // src/types/index.ts
12665
12793
  var import_express = __toESM(require("express"));
12666
- var import_mongoose26 = __toESM(require("mongoose"));
12794
+ var import_mongoose27 = __toESM(require("mongoose"));
12667
12795
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12668
12796
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12669
12797
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";