@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/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -519,6 +519,7 @@ type TCheckOutItem = {
|
|
|
519
519
|
serviceType: TAppServiceType;
|
|
520
520
|
supply: string | ObjectId;
|
|
521
521
|
supplyName: string;
|
|
522
|
+
supplyQty: number;
|
|
522
523
|
qty: number;
|
|
523
524
|
attachment?: string[];
|
|
524
525
|
createdBy: string | ObjectId;
|
|
@@ -528,7 +529,7 @@ type TCheckOutItem = {
|
|
|
528
529
|
updatedAt?: string;
|
|
529
530
|
deletedAt?: string;
|
|
530
531
|
};
|
|
531
|
-
type TCheckOutItemCreate = Pick<TCheckOutItem, "site" | "serviceType" | "supply" | "supplyName" | "qty" | "attachment" | "createdBy" | "createdByName">;
|
|
532
|
+
type TCheckOutItemCreate = Pick<TCheckOutItem, "site" | "serviceType" | "supply" | "supplyName" | "supplyQty" | "qty" | "attachment" | "createdBy" | "createdByName">;
|
|
532
533
|
type TCheckOutItemCreateService = Pick<TCheckOutItem, "site" | "serviceType" | "supply" | "qty" | "attachment" | "createdBy">;
|
|
533
534
|
type TCheckOutItemCreateByBatchService = Pick<TCheckOutItem, "site" | "serviceType" | "createdBy"> & {
|
|
534
535
|
items: Pick<TCheckOutItem, "supply" | "qty" | "attachment">[];
|
|
@@ -538,7 +539,7 @@ type TCheckOutItemGetQuery = {
|
|
|
538
539
|
limit?: number;
|
|
539
540
|
search?: string;
|
|
540
541
|
} & Pick<TCheckOutItem, "site" | "serviceType">;
|
|
541
|
-
type TCheckOutItemGetById = Pick<TCheckOutItem, "_id" | "site" | "serviceType" | "supply" | "supplyName" | "qty" | "status"> & {
|
|
542
|
+
type TCheckOutItemGetById = Pick<TCheckOutItem, "_id" | "site" | "serviceType" | "supply" | "supplyName" | "supplyQty" | "qty" | "status"> & {
|
|
542
543
|
unitOfMeasurement?: string;
|
|
543
544
|
};
|
|
544
545
|
declare const checkOutItemSchema: Joi.ObjectSchema<any>;
|
|
@@ -547,6 +548,7 @@ declare function MCheckOutItem(value: TCheckOutItemCreate): {
|
|
|
547
548
|
serviceType: AppServiceType;
|
|
548
549
|
supply: string | ObjectId;
|
|
549
550
|
supplyName: string;
|
|
551
|
+
supplyQty: number;
|
|
550
552
|
qty: number;
|
|
551
553
|
attachment: string[];
|
|
552
554
|
createdBy: string | ObjectId;
|
package/dist/index.js
CHANGED
|
@@ -5871,6 +5871,7 @@ var checkOutItemSchema = import_joi14.default.object({
|
|
|
5871
5871
|
serviceType: import_joi14.default.string().valid(...Object.values(import_core16.AppServiceType)).required(),
|
|
5872
5872
|
supply: import_joi14.default.string().hex().required(),
|
|
5873
5873
|
supplyName: import_joi14.default.string().required(),
|
|
5874
|
+
supplyQty: import_joi14.default.number().min(0).required(),
|
|
5874
5875
|
qty: import_joi14.default.number().min(0).required(),
|
|
5875
5876
|
attachment: import_joi14.default.array().items(import_joi14.default.string()).optional().allow(null),
|
|
5876
5877
|
createdBy: import_joi14.default.string().hex().required(),
|
|
@@ -5901,6 +5902,7 @@ function MCheckOutItem(value) {
|
|
|
5901
5902
|
serviceType: value.serviceType,
|
|
5902
5903
|
supply: value.supply,
|
|
5903
5904
|
supplyName: value.supplyName,
|
|
5905
|
+
supplyQty: value.supplyQty,
|
|
5904
5906
|
qty: value.qty,
|
|
5905
5907
|
attachment: value.attachment || [],
|
|
5906
5908
|
createdBy: value.createdBy,
|
|
@@ -6005,32 +6007,6 @@ function useCheckOutItemRepository() {
|
|
|
6005
6007
|
try {
|
|
6006
6008
|
const items = await collection.aggregate([
|
|
6007
6009
|
{ $match: query },
|
|
6008
|
-
{
|
|
6009
|
-
$lookup: {
|
|
6010
|
-
from: "site.supplies",
|
|
6011
|
-
let: { supplyId: "$supply" },
|
|
6012
|
-
pipeline: [
|
|
6013
|
-
{
|
|
6014
|
-
$match: {
|
|
6015
|
-
$expr: {
|
|
6016
|
-
$and: [
|
|
6017
|
-
{ $ne: ["$$supplyId", ""] },
|
|
6018
|
-
{ $eq: ["$_id", "$$supplyId"] }
|
|
6019
|
-
]
|
|
6020
|
-
}
|
|
6021
|
-
}
|
|
6022
|
-
},
|
|
6023
|
-
{ $project: { qty: 1 } }
|
|
6024
|
-
],
|
|
6025
|
-
as: "supplyDoc"
|
|
6026
|
-
}
|
|
6027
|
-
},
|
|
6028
|
-
{
|
|
6029
|
-
$unwind: {
|
|
6030
|
-
path: "$supplyDoc",
|
|
6031
|
-
preserveNullAndEmptyArrays: true
|
|
6032
|
-
}
|
|
6033
|
-
},
|
|
6034
6010
|
{
|
|
6035
6011
|
$lookup: {
|
|
6036
6012
|
from: "users",
|
|
@@ -6057,7 +6033,7 @@ function useCheckOutItemRepository() {
|
|
|
6057
6033
|
{
|
|
6058
6034
|
$project: {
|
|
6059
6035
|
supplyName: 1,
|
|
6060
|
-
supplyQty:
|
|
6036
|
+
supplyQty: 1,
|
|
6061
6037
|
checkOutByName: "$createdByName",
|
|
6062
6038
|
profile: "$createdByDoc.profile",
|
|
6063
6039
|
checkOutQty: "$qty",
|
|
@@ -6127,7 +6103,7 @@ function useCheckOutItemRepository() {
|
|
|
6127
6103
|
qty: 1,
|
|
6128
6104
|
status: 1,
|
|
6129
6105
|
unitOfMeasurement: "$supplyDetails.unitOfMeasurement",
|
|
6130
|
-
stockQty: "$
|
|
6106
|
+
stockQty: "$supplyQty",
|
|
6131
6107
|
attachment: 1
|
|
6132
6108
|
}
|
|
6133
6109
|
}
|
|
@@ -6211,6 +6187,7 @@ function useCheckOutItemService() {
|
|
|
6211
6187
|
{
|
|
6212
6188
|
...value,
|
|
6213
6189
|
supplyName: supplyData?.name || "",
|
|
6190
|
+
supplyQty: Math.max((supplyData?.qty || 0) - value.qty, 0),
|
|
6214
6191
|
createdByName: createdByData?.name || ""
|
|
6215
6192
|
},
|
|
6216
6193
|
session
|
|
@@ -6257,6 +6234,7 @@ function useCheckOutItemService() {
|
|
|
6257
6234
|
serviceType,
|
|
6258
6235
|
supply: item.supply,
|
|
6259
6236
|
supplyName: supplyData?.name || "",
|
|
6237
|
+
supplyQty: Math.max((supplyData?.qty || 0) - item.qty, 0),
|
|
6260
6238
|
qty: item.qty,
|
|
6261
6239
|
attachment: item.attachment,
|
|
6262
6240
|
createdBy,
|