@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 +6 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -5495,6 +5495,7 @@ function useCheckOutItemRepository() {
|
|
|
5495
5495
|
{ key: { site: 1 } },
|
|
5496
5496
|
{ key: { serviceType: 1 } },
|
|
5497
5497
|
{ key: { supply: 1 } },
|
|
5498
|
+
{ key: { createdBy: 1 } },
|
|
5498
5499
|
{ key: { status: 1 } }
|
|
5499
5500
|
]);
|
|
5500
5501
|
} catch (error) {
|
|
@@ -5526,7 +5527,11 @@ function useCheckOutItemRepository() {
|
|
|
5526
5527
|
});
|
|
5527
5528
|
return res.insertedId;
|
|
5528
5529
|
} catch (error) {
|
|
5529
|
-
|
|
5530
|
+
if (error.code === 11e3) {
|
|
5531
|
+
throw "The Item is already exisits";
|
|
5532
|
+
} else {
|
|
5533
|
+
throw error;
|
|
5534
|
+
}
|
|
5530
5535
|
}
|
|
5531
5536
|
}
|
|
5532
5537
|
async function getCheckOutItems({
|
|
@@ -5592,11 +5597,35 @@ function useCheckOutItemRepository() {
|
|
|
5592
5597
|
preserveNullAndEmptyArrays: true
|
|
5593
5598
|
}
|
|
5594
5599
|
},
|
|
5600
|
+
{
|
|
5601
|
+
$lookup: {
|
|
5602
|
+
from: "users",
|
|
5603
|
+
let: { createdByStr: "$createdBy" },
|
|
5604
|
+
pipeline: [
|
|
5605
|
+
{
|
|
5606
|
+
$match: {
|
|
5607
|
+
$expr: {
|
|
5608
|
+
$eq: [{ $toString: "$_id" }, "$$createdByStr"]
|
|
5609
|
+
}
|
|
5610
|
+
}
|
|
5611
|
+
},
|
|
5612
|
+
{ $project: { profile: 1 } }
|
|
5613
|
+
],
|
|
5614
|
+
as: "createdByDoc"
|
|
5615
|
+
}
|
|
5616
|
+
},
|
|
5617
|
+
{
|
|
5618
|
+
$unwind: {
|
|
5619
|
+
path: "$createdByDoc",
|
|
5620
|
+
preserveNullAndEmptyArrays: true
|
|
5621
|
+
}
|
|
5622
|
+
},
|
|
5595
5623
|
{
|
|
5596
5624
|
$project: {
|
|
5597
5625
|
supplyName: 1,
|
|
5598
5626
|
supplyQty: "$supplyDoc.qty",
|
|
5599
5627
|
checkOutByName: "$createdByName",
|
|
5628
|
+
profile: "$createdByDoc.profile",
|
|
5600
5629
|
checkOutQty: "$qty",
|
|
5601
5630
|
createdAt: 1,
|
|
5602
5631
|
status: 1
|