@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.d.mts CHANGED
@@ -657,6 +657,12 @@ declare function updateAdStatuses(): Promise<void>;
657
657
  * @param licenceObject
658
658
  * @returns
659
659
  */
660
- declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceObject: UserLicenceType): Promise<null>;
660
+ declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceObject: UserLicenceType): Promise<void>;
661
661
 
662
- export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, EnumPubSubEvents, EventInfoModel, EventModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, ParticipantSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateVendorBasedOnUserLicense, userLicenseSchema };
662
+ /**
663
+ * Recursively converts all ObjectId fields to strings in an object
664
+ * This is needed because GraphQL expects string IDs, not ObjectIds
665
+ */
666
+ declare function convertObjectIdsToStrings(obj: any): any;
667
+
668
+ export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, EnumPubSubEvents, EventInfoModel, EventModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, ParticipantSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateVendorBasedOnUserLicense, userLicenseSchema };
package/dist/index.d.ts CHANGED
@@ -657,6 +657,12 @@ declare function updateAdStatuses(): Promise<void>;
657
657
  * @param licenceObject
658
658
  * @returns
659
659
  */
660
- declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceObject: UserLicenceType): Promise<null>;
660
+ declare function updateVendorBasedOnUserLicense(userId: ObjectId, licenceObject: UserLicenceType): Promise<void>;
661
661
 
662
- export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, EnumPubSubEvents, EventInfoModel, EventModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, ParticipantSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateVendorBasedOnUserLicense, userLicenseSchema };
662
+ /**
663
+ * Recursively converts all ObjectId fields to strings in an object
664
+ * This is needed because GraphQL expects string IDs, not ObjectIds
665
+ */
666
+ declare function convertObjectIdsToStrings(obj: any): any;
667
+
668
+ export { APP_SETTINGS_ID, AdModel, AppSettingModel, type AuthUser, CategorySchema, ChatModel, ChatReportModel, EnumPubSubEvents, EventInfoModel, EventModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, ParticipantSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelationType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, associatesSchema, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, dateTimeSchema, locationGeoSchema, locationsSchema, refundPolicySchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, termsAgreementSchema, updateAdStatuses, updateVendorBasedOnUserLicense, userLicenseSchema };
package/dist/index.mjs CHANGED
@@ -8513,8 +8513,8 @@ var GET_EVENT_BY_PLACE_ID = gql`
8513
8513
  ${EVENT_LIST_ITEM}
8514
8514
  `;
8515
8515
  var GET_EVENTS_BY_REGION = gql`
8516
- query getEventsByRegion($region: String!, $onlyClaimed: Boolean) {
8517
- eventsByRegion(region: $region, onlyClaimed: $onlyClaimed) {
8516
+ query getEventsByRegion($region: String!, $options: EventsByRegionOptions) {
8517
+ eventsByRegion(region: $region, options: $options) {
8518
8518
  ...EventListItemFields
8519
8519
  }
8520
8520
  }
@@ -9213,6 +9213,18 @@ var GET_USER_ACTIVITIES = gql`
9213
9213
  ${EVENT_LIST_ITEM}
9214
9214
  ${VENDOR}
9215
9215
  `;
9216
+ var GET_USER_RESOURCES = gql`
9217
+ query getUserResources($userId: ID!) {
9218
+ userResources(userId: $userId) {
9219
+ resources {
9220
+ _id
9221
+ logo
9222
+ name
9223
+ resourceType
9224
+ }
9225
+ }
9226
+ }
9227
+ `;
9216
9228
  var NOTIFICATION_FRAGMENT = gql`
9217
9229
  fragment NotificationFields on Notification {
9218
9230
  _id
@@ -10438,10 +10450,10 @@ var adSchema = create$3().shape({
10438
10450
  }
10439
10451
  )
10440
10452
  }),
10441
- resourceCover: create$6().url("Resource cover must be a valid URL").required("Resource cover is required"),
10453
+ resourceCover: create$6().required("Resource cover is required"),
10442
10454
  resourceDescription: create$6().required("Resource description is required"),
10443
10455
  resourceId: create$6().required("Resource ID is required"),
10444
- resourceLogo: create$6().url("Resource logo must be a valid URL").nullable().notRequired(),
10456
+ resourceLogo: create$6().nullable().notRequired(),
10445
10457
  resourceName: create$6().required("Resource name is required"),
10446
10458
  resourceRegion: create$6().required("Resource region is required"),
10447
10459
  resourceType: create$8().oneOf(Object.values(EnumResourceType), "Please select Event or Vendor").required("Resource Type is required"),
@@ -12025,22 +12037,17 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12025
12037
  try {
12026
12038
  const user = await UserModel.findById(userId).exec();
12027
12039
  if (!user) {
12028
- return null;
12040
+ return;
12029
12041
  }
12030
12042
  const userVendor = await VendorModel.findById(user.vendor).exec();
12031
12043
  if (!userVendor) {
12032
- return null;
12044
+ return;
12033
12045
  }
12034
12046
  const selectedLicence = licenceObject.licenceType;
12035
12047
  if (selectedLicence === void 0) {
12036
- return null;
12048
+ return;
12037
12049
  }
12038
- const vendorUpdateData = {
12039
- owner: {
12040
- email: user.email,
12041
- userId
12042
- }
12043
- };
12050
+ const vendorUpdateData = {};
12044
12051
  if (selectedLicence === EnumUserLicence.STANDARD_VENDOR) {
12045
12052
  vendorUpdateData.associates = [];
12046
12053
  vendorUpdateData.availability = {
@@ -12062,6 +12069,13 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12062
12069
  source: img.source,
12063
12070
  title: img.title
12064
12071
  }));
12072
+ } else {
12073
+ vendorUpdateData.images = (userVendor.images || []).map((img) => ({
12074
+ active: true,
12075
+ // all images will be true
12076
+ source: img.source,
12077
+ title: img.title
12078
+ }));
12065
12079
  }
12066
12080
  await VendorModel.findByIdAndUpdate(
12067
12081
  userVendor._id,
@@ -12070,16 +12084,36 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12070
12084
  },
12071
12085
  { new: true }
12072
12086
  );
12073
- return null;
12074
12087
  } catch (error) {
12075
12088
  console.error("Error updating vendor based on user license:", error);
12076
- return null;
12077
12089
  }
12078
12090
  }
12079
12091
 
12092
+ // src/service/objectIdToString.ts
12093
+ import mongoose20 from "mongoose";
12094
+ function convertObjectIdsToStrings(obj) {
12095
+ if (obj === null || obj === void 0) {
12096
+ return obj;
12097
+ }
12098
+ if (obj instanceof mongoose20.Types.ObjectId) {
12099
+ return obj.toString();
12100
+ }
12101
+ if (Array.isArray(obj)) {
12102
+ return obj.map(convertObjectIdsToStrings);
12103
+ }
12104
+ if (typeof obj === "object") {
12105
+ const converted = {};
12106
+ for (const [key, value] of Object.entries(obj)) {
12107
+ converted[key] = convertObjectIdsToStrings(value);
12108
+ }
12109
+ return converted;
12110
+ }
12111
+ return obj;
12112
+ }
12113
+
12080
12114
  // src/types/index.ts
12081
12115
  import express from "express";
12082
- import mongoose20 from "mongoose";
12116
+ import mongoose21 from "mongoose";
12083
12117
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
12084
12118
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
12085
12119
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -12116,11 +12150,12 @@ export {
12116
12150
  associatesSchema,
12117
12151
  baseResourceFields,
12118
12152
  connectToDatabase,
12153
+ convertObjectIdsToStrings,
12119
12154
  dateTimeSchema3 as dateTimeSchema,
12120
12155
  express,
12121
12156
  locationGeoSchema,
12122
12157
  locationsSchema,
12123
- mongoose20 as mongoose,
12158
+ mongoose21 as mongoose,
12124
12159
  refundPolicySchema,
12125
12160
  relationDatesSchema,
12126
12161
  resourceRelationsSchema,