@timardex/cluemart-server-shared 1.0.97 → 1.0.98

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,6 @@ 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
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 };
package/dist/index.d.ts CHANGED
@@ -657,6 +657,6 @@ 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
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 };
package/dist/index.mjs CHANGED
@@ -12025,22 +12025,17 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12025
12025
  try {
12026
12026
  const user = await UserModel.findById(userId).exec();
12027
12027
  if (!user) {
12028
- return null;
12028
+ return;
12029
12029
  }
12030
12030
  const userVendor = await VendorModel.findById(user.vendor).exec();
12031
12031
  if (!userVendor) {
12032
- return null;
12032
+ return;
12033
12033
  }
12034
12034
  const selectedLicence = licenceObject.licenceType;
12035
12035
  if (selectedLicence === void 0) {
12036
- return null;
12036
+ return;
12037
12037
  }
12038
- const vendorUpdateData = {
12039
- owner: {
12040
- email: user.email,
12041
- userId
12042
- }
12043
- };
12038
+ const vendorUpdateData = {};
12044
12039
  if (selectedLicence === EnumUserLicence.STANDARD_VENDOR) {
12045
12040
  vendorUpdateData.associates = [];
12046
12041
  vendorUpdateData.availability = {
@@ -12062,6 +12057,13 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12062
12057
  source: img.source,
12063
12058
  title: img.title
12064
12059
  }));
12060
+ } else {
12061
+ vendorUpdateData.images = (userVendor.images || []).map((img) => ({
12062
+ active: true,
12063
+ // all images will be true
12064
+ source: img.source,
12065
+ title: img.title
12066
+ }));
12065
12067
  }
12066
12068
  await VendorModel.findByIdAndUpdate(
12067
12069
  userVendor._id,
@@ -12070,10 +12072,8 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12070
12072
  },
12071
12073
  { new: true }
12072
12074
  );
12073
- return null;
12074
12075
  } catch (error) {
12075
12076
  console.error("Error updating vendor based on user license:", error);
12076
- return null;
12077
12077
  }
12078
12078
  }
12079
12079