@goweekdays/core 2.15.8 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 2.15.9
4
+
5
+ ### Patch Changes
6
+
7
+ - fcf8414: Add asset item unique index
8
+
3
9
  ## 2.15.8
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -2230,6 +2230,7 @@ type TAssetItem = {
2230
2230
  _id?: ObjectId;
2231
2231
  orgId: ObjectId | string;
2232
2232
  name: string;
2233
+ normalizedName?: string;
2233
2234
  description?: string;
2234
2235
  assetCategory: TAssetItemCategory;
2235
2236
  assetClass: TAssetItemClass;
package/dist/index.js CHANGED
@@ -22638,10 +22638,12 @@ function modelAssetItem(data) {
22638
22638
  "Marketplace price is required for items marked as public."
22639
22639
  );
22640
22640
  }
22641
+ data.normalizedName = data.name.trim().toLowerCase();
22641
22642
  return {
22642
22643
  _id: data._id,
22643
22644
  orgId: data.orgId,
22644
22645
  name: data.name,
22646
+ normalizedName: data.normalizedName,
22645
22647
  description: data.description ?? "",
22646
22648
  assetCategory: data.assetCategory,
22647
22649
  assetClass: data.assetClass,
@@ -22690,7 +22692,16 @@ function useAssetItemRepo() {
22690
22692
  { key: { purpose: 1 } },
22691
22693
  { key: { trackingType: 1 } },
22692
22694
  { key: { status: 1 } },
22693
- { key: { name: "text" } }
22695
+ { key: { name: "text" } },
22696
+ {
22697
+ key: {
22698
+ orgId: 1,
22699
+ normalizedName: 1,
22700
+ purpose: 1,
22701
+ itemRefId: 1
22702
+ },
22703
+ unique: true
22704
+ }
22694
22705
  ]);
22695
22706
  } catch (error) {
22696
22707
  throw new import_utils116.BadRequestError("Failed to create asset item indexes.");