@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.
@@ -12044,22 +12044,17 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12044
12044
  try {
12045
12045
  const user = await UserModel.findById(userId).exec();
12046
12046
  if (!user) {
12047
- return null;
12047
+ return;
12048
12048
  }
12049
12049
  const userVendor = await VendorModel.findById(user.vendor).exec();
12050
12050
  if (!userVendor) {
12051
- return null;
12051
+ return;
12052
12052
  }
12053
12053
  const selectedLicence = licenceObject.licenceType;
12054
12054
  if (selectedLicence === void 0) {
12055
- return null;
12055
+ return;
12056
12056
  }
12057
- const vendorUpdateData = {
12058
- owner: {
12059
- email: user.email,
12060
- userId
12061
- }
12062
- };
12057
+ const vendorUpdateData = {};
12063
12058
  if (selectedLicence === EnumUserLicence.STANDARD_VENDOR) {
12064
12059
  vendorUpdateData.associates = [];
12065
12060
  vendorUpdateData.availability = {
@@ -12081,6 +12076,13 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12081
12076
  source: img.source,
12082
12077
  title: img.title
12083
12078
  }));
12079
+ } else {
12080
+ vendorUpdateData.images = (userVendor.images || []).map((img) => ({
12081
+ active: true,
12082
+ // all images will be true
12083
+ source: img.source,
12084
+ title: img.title
12085
+ }));
12084
12086
  }
12085
12087
  await VendorModel.findByIdAndUpdate(
12086
12088
  userVendor._id,
@@ -12089,10 +12091,8 @@ async function updateVendorBasedOnUserLicense(userId, licenceObject) {
12089
12091
  },
12090
12092
  { new: true }
12091
12093
  );
12092
- return null;
12093
12094
  } catch (error) {
12094
12095
  console.error("Error updating vendor based on user license:", error);
12095
- return null;
12096
12096
  }
12097
12097
  }
12098
12098
  // Annotate the CommonJS export names for ESM import in node: