@7365admin1/module-hygiene 4.20.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,11 @@
1
1
  # @7365admin1/module-hygiene
2
2
 
3
+ ## 4.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Hygiene App Enhancements
8
+
3
9
  ## 4.20.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -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({
@@ -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