@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.
package/dist/index.cjs CHANGED
@@ -1701,11 +1701,12 @@ __export(index_exports, {
1701
1701
  associatesSchema: () => associatesSchema,
1702
1702
  baseResourceFields: () => baseResourceFields,
1703
1703
  connectToDatabase: () => connectToDatabase,
1704
+ convertObjectIdsToStrings: () => convertObjectIdsToStrings,
1704
1705
  dateTimeSchema: () => dateTimeSchema3,
1705
1706
  express: () => import_express.default,
1706
1707
  locationGeoSchema: () => locationGeoSchema,
1707
1708
  locationsSchema: () => locationsSchema,
1708
- mongoose: () => import_mongoose22.default,
1709
+ mongoose: () => import_mongoose23.default,
1709
1710
  refundPolicySchema: () => refundPolicySchema,
1710
1711
  relationDatesSchema: () => relationDatesSchema,
1711
1712
  resourceRelationsSchema: () => resourceRelationsSchema,
@@ -8567,8 +8568,8 @@ var GET_EVENT_BY_PLACE_ID = gql`
8567
8568
  ${EVENT_LIST_ITEM}
8568
8569
  `;
8569
8570
  var GET_EVENTS_BY_REGION = gql`
8570
- query getEventsByRegion($region: String!, $onlyClaimed: Boolean) {
8571
- eventsByRegion(region: $region, onlyClaimed: $onlyClaimed) {
8571
+ query getEventsByRegion($region: String!, $options: EventsByRegionOptions) {
8572
+ eventsByRegion(region: $region, options: $options) {
8572
8573
  ...EventListItemFields
8573
8574
  }
8574
8575
  }
@@ -9267,6 +9268,18 @@ var GET_USER_ACTIVITIES = gql`
9267
9268
  ${EVENT_LIST_ITEM}
9268
9269
  ${VENDOR}
9269
9270
  `;
9271
+ var GET_USER_RESOURCES = gql`
9272
+ query getUserResources($userId: ID!) {
9273
+ userResources(userId: $userId) {
9274
+ resources {
9275
+ _id
9276
+ logo
9277
+ name
9278
+ resourceType
9279
+ }
9280
+ }
9281
+ }
9282
+ `;
9270
9283
  var NOTIFICATION_FRAGMENT = gql`
9271
9284
  fragment NotificationFields on Notification {
9272
9285
  _id
@@ -10492,10 +10505,10 @@ var adSchema = create$3().shape({
10492
10505
  }
10493
10506
  )
10494
10507
  }),
10495
- resourceCover: create$6().url("Resource cover must be a valid URL").required("Resource cover is required"),
10508
+ resourceCover: create$6().required("Resource cover is required"),
10496
10509
  resourceDescription: create$6().required("Resource description is required"),
10497
10510
  resourceId: create$6().required("Resource ID is required"),
10498
- resourceLogo: create$6().url("Resource logo must be a valid URL").nullable().notRequired(),
10511
+ resourceLogo: create$6().nullable().notRequired(),
10499
10512
  resourceName: create$6().required("Resource name is required"),
10500
10513
  resourceRegion: create$6().required("Resource region is required"),
10501
10514
  resourceType: create$8().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource Type is required"),
@@ -12079,22 +12092,17 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12079
12092
  try {
12080
12093
  const user = await UserModel.findById(userId).exec();
12081
12094
  if (!user) {
12082
- return null;
12095
+ return;
12083
12096
  }
12084
12097
  const userVendor = await VendorModel.findById(user.vendor).exec();
12085
12098
  if (!userVendor) {
12086
- return null;
12099
+ return;
12087
12100
  }
12088
12101
  const selectedLicence = licenceObject.licenceType;
12089
12102
  if (selectedLicence === void 0) {
12090
- return null;
12103
+ return;
12091
12104
  }
12092
- const vendorUpdateData = {
12093
- owner: {
12094
- email: user.email,
12095
- userId
12096
- }
12097
- };
12105
+ const vendorUpdateData = {};
12098
12106
  if (selectedLicence === EnumUserLicence.STANDARD_VENDOR) {
12099
12107
  vendorUpdateData.associates = [];
12100
12108
  vendorUpdateData.availability = {
@@ -12116,6 +12124,13 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12116
12124
  source: img.source,
12117
12125
  title: img.title
12118
12126
  }));
12127
+ } else {
12128
+ vendorUpdateData.images = (userVendor.images || []).map((img) => ({
12129
+ active: true,
12130
+ // all images will be true
12131
+ source: img.source,
12132
+ title: img.title
12133
+ }));
12119
12134
  }
12120
12135
  await VendorModel.findByIdAndUpdate(
12121
12136
  userVendor._id,
@@ -12124,16 +12139,36 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12124
12139
  },
12125
12140
  { new: true }
12126
12141
  );
12127
- return null;
12128
12142
  } catch (error) {
12129
12143
  console.error("Error updating vendor based on user license:", error);
12130
- return null;
12131
12144
  }
12132
12145
  }
12133
12146
 
12147
+ // src/service/objectIdToString.ts
12148
+ var import_mongoose22 = __toESM(require("mongoose"));
12149
+ function convertObjectIdsToStrings(obj) {
12150
+ if (obj === null || obj === void 0) {
12151
+ return obj;
12152
+ }
12153
+ if (obj instanceof import_mongoose22.default.Types.ObjectId) {
12154
+ return obj.toString();
12155
+ }
12156
+ if (Array.isArray(obj)) {
12157
+ return obj.map(convertObjectIdsToStrings);
12158
+ }
12159
+ if (typeof obj === "object") {
12160
+ const converted = {};
12161
+ for (const [key, value] of Object.entries(obj)) {
12162
+ converted[key] = convertObjectIdsToStrings(value);
12163
+ }
12164
+ return converted;
12165
+ }
12166
+ return obj;
12167
+ }
12168
+
12134
12169
  // src/types/index.ts
12135
12170
  var import_express = __toESM(require("express"));
12136
- var import_mongoose22 = __toESM(require("mongoose"));
12171
+ var import_mongoose23 = __toESM(require("mongoose"));
12137
12172
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12138
12173
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12139
12174
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -12171,6 +12206,7 @@ var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12171
12206
  associatesSchema,
12172
12207
  baseResourceFields,
12173
12208
  connectToDatabase,
12209
+ convertObjectIdsToStrings,
12174
12210
  dateTimeSchema,
12175
12211
  express,
12176
12212
  locationGeoSchema,