@goweekdays/core 2.15.7 → 2.15.9

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.mjs CHANGED
@@ -22627,15 +22627,24 @@ function modelAssetItem(data) {
22627
22627
  "Price must be greater than 0 for items marked as 'for-sale'."
22628
22628
  );
22629
22629
  }
22630
+ if (data.isPublic && (data.marketplacePrice === void 0 || data.marketplacePrice === null)) {
22631
+ throw new BadRequestError108(
22632
+ "Marketplace price is required for items marked as public."
22633
+ );
22634
+ }
22635
+ data.normalizedName = data.name.trim().toLowerCase();
22630
22636
  return {
22631
22637
  _id: data._id,
22632
22638
  orgId: data.orgId,
22633
22639
  name: data.name,
22640
+ normalizedName: data.normalizedName,
22634
22641
  description: data.description ?? "",
22635
22642
  assetCategory: data.assetCategory,
22636
22643
  assetClass: data.assetClass,
22637
22644
  unit: data.unit ?? "",
22638
22645
  price: data.price ?? 0,
22646
+ marketplacePrice: data.marketplacePrice ?? 0,
22647
+ isPublic: data.isPublic ?? false,
22639
22648
  sku: data.sku ?? "",
22640
22649
  brand: data.brand ?? "",
22641
22650
  trackingType: data.trackingType,
@@ -22685,7 +22694,16 @@ function useAssetItemRepo() {
22685
22694
  { key: { purpose: 1 } },
22686
22695
  { key: { trackingType: 1 } },
22687
22696
  { key: { status: 1 } },
22688
- { key: { name: "text" } }
22697
+ { key: { name: "text" } },
22698
+ {
22699
+ key: {
22700
+ orgId: 1,
22701
+ normalizedName: 1,
22702
+ purpose: 1,
22703
+ itemRefId: 1
22704
+ },
22705
+ unique: true
22706
+ }
22689
22707
  ]);
22690
22708
  } catch (error) {
22691
22709
  throw new BadRequestError109("Failed to create asset item indexes.");