@7365admin1/module-hygiene 4.27.2-staging.4 → 4.28.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.d.ts +4 -2
- package/dist/index.js +6 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/.github/workflows/publish-staging.yml +0 -36
package/dist/index.mjs
CHANGED
|
@@ -5866,6 +5866,7 @@ var checkOutItemSchema = Joi14.object({
|
|
|
5866
5866
|
serviceType: Joi14.string().valid(...Object.values(AppServiceType15)).required(),
|
|
5867
5867
|
supply: Joi14.string().hex().required(),
|
|
5868
5868
|
supplyName: Joi14.string().required(),
|
|
5869
|
+
supplyQty: Joi14.number().min(0).required(),
|
|
5869
5870
|
qty: Joi14.number().min(0).required(),
|
|
5870
5871
|
attachment: Joi14.array().items(Joi14.string()).optional().allow(null),
|
|
5871
5872
|
createdBy: Joi14.string().hex().required(),
|
|
@@ -5896,6 +5897,7 @@ function MCheckOutItem(value) {
|
|
|
5896
5897
|
serviceType: value.serviceType,
|
|
5897
5898
|
supply: value.supply,
|
|
5898
5899
|
supplyName: value.supplyName,
|
|
5900
|
+
supplyQty: value.supplyQty,
|
|
5899
5901
|
qty: value.qty,
|
|
5900
5902
|
attachment: value.attachment || [],
|
|
5901
5903
|
createdBy: value.createdBy,
|
|
@@ -6009,32 +6011,6 @@ function useCheckOutItemRepository() {
|
|
|
6009
6011
|
try {
|
|
6010
6012
|
const items = await collection.aggregate([
|
|
6011
6013
|
{ $match: query },
|
|
6012
|
-
{
|
|
6013
|
-
$lookup: {
|
|
6014
|
-
from: "site.supplies",
|
|
6015
|
-
let: { supplyId: "$supply" },
|
|
6016
|
-
pipeline: [
|
|
6017
|
-
{
|
|
6018
|
-
$match: {
|
|
6019
|
-
$expr: {
|
|
6020
|
-
$and: [
|
|
6021
|
-
{ $ne: ["$$supplyId", ""] },
|
|
6022
|
-
{ $eq: ["$_id", "$$supplyId"] }
|
|
6023
|
-
]
|
|
6024
|
-
}
|
|
6025
|
-
}
|
|
6026
|
-
},
|
|
6027
|
-
{ $project: { qty: 1 } }
|
|
6028
|
-
],
|
|
6029
|
-
as: "supplyDoc"
|
|
6030
|
-
}
|
|
6031
|
-
},
|
|
6032
|
-
{
|
|
6033
|
-
$unwind: {
|
|
6034
|
-
path: "$supplyDoc",
|
|
6035
|
-
preserveNullAndEmptyArrays: true
|
|
6036
|
-
}
|
|
6037
|
-
},
|
|
6038
6014
|
{
|
|
6039
6015
|
$lookup: {
|
|
6040
6016
|
from: "users",
|
|
@@ -6061,7 +6037,7 @@ function useCheckOutItemRepository() {
|
|
|
6061
6037
|
{
|
|
6062
6038
|
$project: {
|
|
6063
6039
|
supplyName: 1,
|
|
6064
|
-
supplyQty:
|
|
6040
|
+
supplyQty: 1,
|
|
6065
6041
|
checkOutByName: "$createdByName",
|
|
6066
6042
|
profile: "$createdByDoc.profile",
|
|
6067
6043
|
checkOutQty: "$qty",
|
|
@@ -6131,7 +6107,7 @@ function useCheckOutItemRepository() {
|
|
|
6131
6107
|
qty: 1,
|
|
6132
6108
|
status: 1,
|
|
6133
6109
|
unitOfMeasurement: "$supplyDetails.unitOfMeasurement",
|
|
6134
|
-
stockQty: "$
|
|
6110
|
+
stockQty: "$supplyQty",
|
|
6135
6111
|
attachment: 1
|
|
6136
6112
|
}
|
|
6137
6113
|
}
|
|
@@ -6215,6 +6191,7 @@ function useCheckOutItemService() {
|
|
|
6215
6191
|
{
|
|
6216
6192
|
...value,
|
|
6217
6193
|
supplyName: supplyData?.name || "",
|
|
6194
|
+
supplyQty: Math.max((supplyData?.qty || 0) - value.qty, 0),
|
|
6218
6195
|
createdByName: createdByData?.name || ""
|
|
6219
6196
|
},
|
|
6220
6197
|
session
|
|
@@ -6261,6 +6238,7 @@ function useCheckOutItemService() {
|
|
|
6261
6238
|
serviceType,
|
|
6262
6239
|
supply: item.supply,
|
|
6263
6240
|
supplyName: supplyData?.name || "",
|
|
6241
|
+
supplyQty: Math.max((supplyData?.qty || 0) - item.qty, 0),
|
|
6264
6242
|
qty: item.qty,
|
|
6265
6243
|
attachment: item.attachment,
|
|
6266
6244
|
createdBy,
|