@7365admin1/module-hygiene 4.19.0 → 4.21.0

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,17 @@
1
1
  # @7365admin1/module-hygiene
2
2
 
3
+ ## 4.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Hygiene App Enhancements
8
+
9
+ ## 4.20.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Update module hygiene
14
+
3
15
  ## 4.19.0
4
16
 
5
17
  ### Minor Changes
package/dist/index.js CHANGED
@@ -4823,7 +4823,7 @@ function useSupplyRepository() {
4823
4823
  throw new import_node_server_utils22.BadRequestError("Invalid site ID format.");
4824
4824
  }
4825
4825
  if (search) {
4826
- query.$text = { $search: search };
4826
+ query.name = { $regex: search, $options: "i" };
4827
4827
  cacheOptions.search = search;
4828
4828
  }
4829
4829
  const cacheKey = (0, import_node_server_utils22.makeCacheKey)(namespace_collection, cacheOptions);
@@ -5492,6 +5492,7 @@ function useCheckOutItemRepository() {
5492
5492
  { key: { site: 1 } },
5493
5493
  { key: { serviceType: 1 } },
5494
5494
  { key: { supply: 1 } },
5495
+ { key: { createdBy: 1 } },
5495
5496
  { key: { status: 1 } }
5496
5497
  ]);
5497
5498
  } catch (error) {
@@ -5523,7 +5524,11 @@ function useCheckOutItemRepository() {
5523
5524
  });
5524
5525
  return res.insertedId;
5525
5526
  } catch (error) {
5526
- throw error;
5527
+ if (error.code === 11e3) {
5528
+ throw "The Item is already exisits";
5529
+ } else {
5530
+ throw error;
5531
+ }
5527
5532
  }
5528
5533
  }
5529
5534
  async function getCheckOutItems({
@@ -5551,7 +5556,7 @@ function useCheckOutItemRepository() {
5551
5556
  throw new import_node_server_utils29.BadRequestError("Invalid site ID format.");
5552
5557
  }
5553
5558
  if (search) {
5554
- query.$text = { $search: search };
5559
+ query.supplyName = { $regex: search, $options: "i" };
5555
5560
  cacheOptions.search = search;
5556
5561
  }
5557
5562
  const cacheKey = (0, import_node_server_utils29.makeCacheKey)(namespace_collection, cacheOptions);
@@ -5589,11 +5594,35 @@ function useCheckOutItemRepository() {
5589
5594
  preserveNullAndEmptyArrays: true
5590
5595
  }
5591
5596
  },
5597
+ {
5598
+ $lookup: {
5599
+ from: "users",
5600
+ let: { createdByStr: "$createdBy" },
5601
+ pipeline: [
5602
+ {
5603
+ $match: {
5604
+ $expr: {
5605
+ $eq: [{ $toString: "$_id" }, "$$createdByStr"]
5606
+ }
5607
+ }
5608
+ },
5609
+ { $project: { profile: 1 } }
5610
+ ],
5611
+ as: "createdByDoc"
5612
+ }
5613
+ },
5614
+ {
5615
+ $unwind: {
5616
+ path: "$createdByDoc",
5617
+ preserveNullAndEmptyArrays: true
5618
+ }
5619
+ },
5592
5620
  {
5593
5621
  $project: {
5594
5622
  supplyName: 1,
5595
5623
  supplyQty: "$supplyDoc.qty",
5596
5624
  checkOutByName: "$createdByName",
5625
+ profile: "$createdByDoc.profile",
5597
5626
  checkOutQty: "$qty",
5598
5627
  createdAt: 1,
5599
5628
  status: 1