@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.
@@ -37,7 +37,7 @@ import {
37
37
  resourceRelationsSchema,
38
38
  termsAgreementSchema,
39
39
  userLicenseSchema
40
- } from "../chunk-D2UFBNH6.mjs";
40
+ } from "../chunk-ZKCRLNCH.mjs";
41
41
  import "../chunk-3QS3WKRC.mjs";
42
42
  export {
43
43
  APP_SETTINGS_ID,
@@ -6797,22 +6797,24 @@ var EnumNotificationResourceType = /* @__PURE__ */ ((EnumNotificationResourceTyp
6797
6797
  EnumNotificationResourceType22["CREATED_EVENT"] = "created_event";
6798
6798
  EnumNotificationResourceType22["CREATED_PARTNER"] = "created_partner";
6799
6799
  EnumNotificationResourceType22["CREATED_VENDOR"] = "created_vendor";
6800
+ EnumNotificationResourceType22["DAILY_CLUE_GAME"] = "daily_clue_game";
6800
6801
  EnumNotificationResourceType22["DEACTIVATED_EVENT"] = "deactivated_event";
6801
6802
  EnumNotificationResourceType22["DEACTIVATED_PARTNER"] = "deactivated_partner";
6802
6803
  EnumNotificationResourceType22["DEACTIVATED_VENDOR"] = "deactivated_vendor";
6803
- EnumNotificationResourceType22["DOWNGRADED_EVENT"] = "downgraded_event";
6804
- EnumNotificationResourceType22["DOWNGRADED_PARTNER"] = "downgraded_partner";
6805
- EnumNotificationResourceType22["DOWNGRADED_VENDOR"] = "downgraded_vendor";
6806
6804
  EnumNotificationResourceType22["DECLINED_EVENT"] = "declined_event";
6807
6805
  EnumNotificationResourceType22["DECLINED_PARTNER"] = "declined_partner";
6808
6806
  EnumNotificationResourceType22["DECLINED_VENDOR"] = "declined_vendor";
6809
- EnumNotificationResourceType22["DAILY_CLUE_GAME"] = "daily_clue_game";
6807
+ EnumNotificationResourceType22["DOWNGRADED_EVENT"] = "downgraded_event";
6808
+ EnumNotificationResourceType22["DOWNGRADED_PARTNER"] = "downgraded_partner";
6809
+ EnumNotificationResourceType22["DOWNGRADED_VENDOR"] = "downgraded_vendor";
6810
6810
  EnumNotificationResourceType22["EVENT_INVITE_VENDOR"] = "event_invite_vendor";
6811
6811
  EnumNotificationResourceType22["EVENT_STARTING_SOON"] = "event_starting_soon";
6812
6812
  EnumNotificationResourceType22["EXPIRATION_REMINDER_EVENT"] = "expiration_reminder_event";
6813
6813
  EnumNotificationResourceType22["EXPIRATION_REMINDER_PARTNER"] = "expiration_reminder_partner";
6814
6814
  EnumNotificationResourceType22["EXPIRATION_REMINDER_VENDOR"] = "expiration_reminder_vendor";
6815
6815
  EnumNotificationResourceType22["NEW_CHAT_MESSAGE"] = "new_chat_message";
6816
+ EnumNotificationResourceType22["NEW_POST_CREATED"] = "new_post_created";
6817
+ EnumNotificationResourceType22["REGISTERED_USER_BY_SCHOOL_CODE"] = "registered_user_by_school_code";
6816
6818
  EnumNotificationResourceType22["SYSTEM_ALERT"] = "system_alert";
6817
6819
  EnumNotificationResourceType22["VENDOR_APPLICATION_TO_EVENT"] = "vendor_application_to_event";
6818
6820
  return EnumNotificationResourceType22;
@@ -6890,6 +6892,100 @@ var EnumSubscriptionStatus = /* @__PURE__ */ ((EnumSubscriptionStatus22) => {
6890
6892
  EnumSubscriptionStatus22["TRIALING"] = "trialing";
6891
6893
  return EnumSubscriptionStatus22;
6892
6894
  })(EnumSubscriptionStatus || {});
6895
+ var OBJECT_ID_PATH_SEGMENT = "[a-f0-9]{24}";
6896
+ var OBJECT_ID_PATH_SEGMENT_END = `${OBJECT_ID_PATH_SEGMENT}$`;
6897
+ var gameScreenIdentifierList = [
6898
+ {
6899
+ clue: "Where your actions turn into a timeline.",
6900
+ id: "activities",
6901
+ match: "/profile/activities"
6902
+ },
6903
+ {
6904
+ clue: "Where conversations happen without speaking.",
6905
+ id: "chat",
6906
+ match: "/profile/chat"
6907
+ },
6908
+ {
6909
+ clue: "The place to redefine who you are.",
6910
+ id: "edit-profile",
6911
+ match: "/profile/edit-profile"
6912
+ },
6913
+ {
6914
+ clue: "A single moment worth showing up for.",
6915
+ id: "single-event",
6916
+ match: new RegExp(`^/events/${OBJECT_ID_PATH_SEGMENT_END}`)
6917
+ },
6918
+ {
6919
+ clue: "What\u2019s happening around you, right now.",
6920
+ id: "events-near-me",
6921
+ match: "/events/events-near-me"
6922
+ },
6923
+ {
6924
+ clue: "A collection of things worth attending.",
6925
+ id: "events",
6926
+ match: "/events"
6927
+ },
6928
+ {
6929
+ clue: "What\u2019s happening in a wider area \u2014 not just nearby.",
6930
+ id: "events-region",
6931
+ match: /^\/events\/region\/[^/]+$/
6932
+ },
6933
+ {
6934
+ clue: "Where fun becomes a challenge.",
6935
+ id: "games",
6936
+ match: "/games"
6937
+ },
6938
+ {
6939
+ clue: "Your starting point for everything.",
6940
+ id: "home",
6941
+ match: "/"
6942
+ },
6943
+ {
6944
+ clue: "Where the app whispers what you shouldn\u2019t miss.",
6945
+ id: "notifications",
6946
+ match: "/notifications"
6947
+ },
6948
+ {
6949
+ clue: "Where you fine-tune your experience.",
6950
+ id: "options",
6951
+ match: "/options"
6952
+ },
6953
+ {
6954
+ clue: "An organisation or creator supporting the community.",
6955
+ id: "single-partner",
6956
+ match: new RegExp(`^/partners/${OBJECT_ID_PATH_SEGMENT_END}`)
6957
+ },
6958
+ {
6959
+ clue: "Organisations and creators supporting the community.",
6960
+ id: "partners",
6961
+ match: "/partners"
6962
+ },
6963
+ {
6964
+ clue: "A single published post in full view.",
6965
+ id: "single-visitor-post",
6966
+ match: new RegExp(`^/visitors/post/${OBJECT_ID_PATH_SEGMENT_END}`)
6967
+ },
6968
+ {
6969
+ clue: "Your identity, on display.",
6970
+ id: "profile",
6971
+ match: "/profile"
6972
+ },
6973
+ {
6974
+ clue: "One stallholder offering something valuable.",
6975
+ id: "single-vendor",
6976
+ match: new RegExp(`^/vendors/${OBJECT_ID_PATH_SEGMENT_END}`)
6977
+ },
6978
+ {
6979
+ clue: "Where every stallholder waits under the right category.",
6980
+ id: "vendors",
6981
+ match: "/vendors"
6982
+ },
6983
+ {
6984
+ clue: "Where you browse articles and posts from around the platform.",
6985
+ id: "visitors",
6986
+ match: "/visitors"
6987
+ }
6988
+ ];
6893
6989
  var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
6894
6990
  EnumGameType2["DAILY_CLUE"] = "dailyClue";
6895
6991
  return EnumGameType2;
@@ -11055,7 +11151,7 @@ async function saveNotificationsInDb(payload) {
11055
11151
  // src/service/sendPushNotifications.ts
11056
11152
  var import_expo_server_sdk = require("expo-server-sdk");
11057
11153
 
11058
- // node_modules/@timardex/cluemart-shared/dist/chunk-73ULMQM6.mjs
11154
+ // node_modules/@timardex/cluemart-shared/dist/chunk-ZR4TGWTS.mjs
11059
11155
  var EnumOSPlatform2 = /* @__PURE__ */ ((EnumOSPlatform22) => {
11060
11156
  EnumOSPlatform22["ANDROID"] = "android";
11061
11157
  EnumOSPlatform22["IOS"] = "ios";
@@ -12530,6 +12626,37 @@ async function updateAdStatuses() {
12530
12626
  );
12531
12627
  }
12532
12628
 
12629
+ // src/service/associate.ts
12630
+ async function removeAssociateFromResource(resourceId, resourceType) {
12631
+ const normalizedResourceId = resourceId.toString();
12632
+ try {
12633
+ await UserModel.updateMany(
12634
+ {
12635
+ associates: {
12636
+ $elemMatch: {
12637
+ resourceId: normalizedResourceId,
12638
+ resourceType
12639
+ }
12640
+ }
12641
+ },
12642
+ {
12643
+ $pull: {
12644
+ associates: {
12645
+ resourceId: normalizedResourceId,
12646
+ resourceType
12647
+ }
12648
+ }
12649
+ }
12650
+ ).exec();
12651
+ } catch (error) {
12652
+ console.error(
12653
+ `[removeAssociateFromResource] Failed to remove associates for resourceId=${normalizedResourceId}, resourceType=${resourceType}`,
12654
+ error
12655
+ );
12656
+ throw error;
12657
+ }
12658
+ }
12659
+
12533
12660
  // src/service/vendor.ts
12534
12661
  async function updateVendorBasedOnUserLicense(userId, licenceType) {
12535
12662
  try {
@@ -12582,18 +12709,19 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12582
12709
  },
12583
12710
  { new: true }
12584
12711
  );
12712
+ await removeAssociateFromResource(userVendor._id, EnumResourceType.VENDOR);
12585
12713
  } catch (error) {
12586
12714
  console.error("Error updating vendor based on user license:", error);
12587
12715
  }
12588
12716
  }
12589
12717
 
12590
12718
  // src/service/objectIdToString.ts
12591
- var import_mongoose24 = __toESM(require("mongoose"));
12719
+ var import_mongoose25 = __toESM(require("mongoose"));
12592
12720
  function convertObjectIdsToStrings(obj) {
12593
12721
  if (obj === null || obj === void 0) {
12594
12722
  return obj;
12595
12723
  }
12596
- if (obj instanceof import_mongoose24.default.Types.ObjectId) {
12724
+ if (obj instanceof import_mongoose25.default.Types.ObjectId) {
12597
12725
  return obj.toString();
12598
12726
  }
12599
12727
  if (Array.isArray(obj)) {