@timardex/cluemart-server-shared 1.0.97 → 1.0.99

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.
@@ -33,7 +33,7 @@ import {
33
33
  resourceRelationsSchema,
34
34
  termsAgreementSchema,
35
35
  userLicenseSchema
36
- } from "../chunk-GEP7O5RI.mjs";
36
+ } from "../chunk-ZB6VYDYP.mjs";
37
37
  import "../chunk-3QS3WKRC.mjs";
38
38
  export {
39
39
  APP_SETTINGS_ID,
@@ -1674,6 +1674,7 @@ var require_toposort = __commonJS({
1674
1674
  var service_exports = {};
1675
1675
  __export(service_exports, {
1676
1676
  connectToDatabase: () => connectToDatabase,
1677
+ convertObjectIdsToStrings: () => convertObjectIdsToStrings,
1677
1678
  saveNotificationsInDb: () => saveNotificationsInDb,
1678
1679
  sendPushNotifications: () => sendPushNotifications,
1679
1680
  updateAdStatuses: () => updateAdStatuses,
@@ -8555,8 +8556,8 @@ var GET_EVENT_BY_PLACE_ID = gql`
8555
8556
  ${EVENT_LIST_ITEM}
8556
8557
  `;
8557
8558
  var GET_EVENTS_BY_REGION = gql`
8558
- query getEventsByRegion($region: String!, $onlyClaimed: Boolean) {
8559
- eventsByRegion(region: $region, onlyClaimed: $onlyClaimed) {
8559
+ query getEventsByRegion($region: String!, $options: EventsByRegionOptions) {
8560
+ eventsByRegion(region: $region, options: $options) {
8560
8561
  ...EventListItemFields
8561
8562
  }
8562
8563
  }
@@ -9255,6 +9256,18 @@ var GET_USER_ACTIVITIES = gql`
9255
9256
  ${EVENT_LIST_ITEM}
9256
9257
  ${VENDOR}
9257
9258
  `;
9259
+ var GET_USER_RESOURCES = gql`
9260
+ query getUserResources($userId: ID!) {
9261
+ userResources(userId: $userId) {
9262
+ resources {
9263
+ _id
9264
+ logo
9265
+ name
9266
+ resourceType
9267
+ }
9268
+ }
9269
+ }
9270
+ `;
9258
9271
  var NOTIFICATION_FRAGMENT = gql`
9259
9272
  fragment NotificationFields on Notification {
9260
9273
  _id
@@ -10480,10 +10493,10 @@ var adSchema = create$3().shape({
10480
10493
  }
10481
10494
  )
10482
10495
  }),
10483
- resourceCover: create$6().url("Resource cover must be a valid URL").required("Resource cover is required"),
10496
+ resourceCover: create$6().required("Resource cover is required"),
10484
10497
  resourceDescription: create$6().required("Resource description is required"),
10485
10498
  resourceId: create$6().required("Resource ID is required"),
10486
- resourceLogo: create$6().url("Resource logo must be a valid URL").nullable().notRequired(),
10499
+ resourceLogo: create$6().nullable().notRequired(),
10487
10500
  resourceName: create$6().required("Resource name is required"),
10488
10501
  resourceRegion: create$6().required("Resource region is required"),
10489
10502
  resourceType: create$8().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource Type is required"),
@@ -12044,22 +12057,17 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12044
12057
  try {
12045
12058
  const user = await UserModel.findById(userId).exec();
12046
12059
  if (!user) {
12047
- return null;
12060
+ return;
12048
12061
  }
12049
12062
  const userVendor = await VendorModel.findById(user.vendor).exec();
12050
12063
  if (!userVendor) {
12051
- return null;
12064
+ return;
12052
12065
  }
12053
12066
  const selectedLicence = licenceObject.licenceType;
12054
12067
  if (selectedLicence === void 0) {
12055
- return null;
12068
+ return;
12056
12069
  }
12057
- const vendorUpdateData = {
12058
- owner: {
12059
- email: user.email,
12060
- userId
12061
- }
12062
- };
12070
+ const vendorUpdateData = {};
12063
12071
  if (selectedLicence === EnumUserLicence.STANDARD_VENDOR) {
12064
12072
  vendorUpdateData.associates = [];
12065
12073
  vendorUpdateData.availability = {
@@ -12081,6 +12089,13 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12081
12089
  source: img.source,
12082
12090
  title: img.title
12083
12091
  }));
12092
+ } else {
12093
+ vendorUpdateData.images = (userVendor.images || []).map((img) => ({
12094
+ active: true,
12095
+ // all images will be true
12096
+ source: img.source,
12097
+ title: img.title
12098
+ }));
12084
12099
  }
12085
12100
  await VendorModel.findByIdAndUpdate(
12086
12101
  userVendor._id,
@@ -12089,15 +12104,36 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12089
12104
  },
12090
12105
  { new: true }
12091
12106
  );
12092
- return null;
12093
12107
  } catch (error) {
12094
12108
  console.error("Error updating vendor based on user license:", error);
12095
- return null;
12096
12109
  }
12097
12110
  }
12111
+
12112
+ // src/service/objectIdToString.ts
12113
+ var import_mongoose22 = __toESM(require("mongoose"));
12114
+ function convertObjectIdsToStrings(obj) {
12115
+ if (obj === null || obj === void 0) {
12116
+ return obj;
12117
+ }
12118
+ if (obj instanceof import_mongoose22.default.Types.ObjectId) {
12119
+ return obj.toString();
12120
+ }
12121
+ if (Array.isArray(obj)) {
12122
+ return obj.map(convertObjectIdsToStrings);
12123
+ }
12124
+ if (typeof obj === "object") {
12125
+ const converted = {};
12126
+ for (const [key, value] of Object.entries(obj)) {
12127
+ converted[key] = convertObjectIdsToStrings(value);
12128
+ }
12129
+ return converted;
12130
+ }
12131
+ return obj;
12132
+ }
12098
12133
  // Annotate the CommonJS export names for ESM import in node:
12099
12134
  0 && (module.exports = {
12100
12135
  connectToDatabase,
12136
+ convertObjectIdsToStrings,
12101
12137
  saveNotificationsInDb,
12102
12138
  sendPushNotifications,
12103
12139
  updateAdStatuses,