@jsdev_ninja/core 0.14.0 → 0.14.2
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/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.es.js +122 -118
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/lib/entities/Cart.d.ts +60 -0
- package/dist/lib/entities/Cart.d.ts.map +1 -1
- package/dist/lib/entities/Order.d.ts +42 -0
- package/dist/lib/entities/Order.d.ts.map +1 -1
- package/dist/lib/entities/Product.d.ts +36 -0
- package/dist/lib/entities/Product.d.ts.map +1 -1
- package/dist/lib/entities/Product.js +4 -0
- package/dist/lib/utils/index.d.ts +4 -0
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/storeCalculator/storeCalculator.test.js +6 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -101,6 +101,16 @@ export declare const CartItemProductSchema: z.ZodObject<{
|
|
|
101
101
|
created_at: z.ZodNumber;
|
|
102
102
|
updated_at: z.ZodNumber;
|
|
103
103
|
categoryIds: z.ZodArray<z.ZodString, "many">;
|
|
104
|
+
stock: z.ZodOptional<z.ZodObject<{
|
|
105
|
+
quantity: z.ZodNumber;
|
|
106
|
+
unit: z.ZodEnum<["piece", "kg", "gram", "liter", "ml"]>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
109
|
+
quantity: number;
|
|
110
|
+
}, {
|
|
111
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
112
|
+
quantity: number;
|
|
113
|
+
}>>;
|
|
104
114
|
categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
|
|
105
115
|
id: string;
|
|
106
116
|
companyId: string;
|
|
@@ -223,6 +233,10 @@ export declare const CartItemProductSchema: z.ZodObject<{
|
|
|
223
233
|
purchasePrice?: number | undefined;
|
|
224
234
|
profitPercentage?: number | undefined;
|
|
225
235
|
isDiscountable?: boolean | undefined;
|
|
236
|
+
stock?: {
|
|
237
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
238
|
+
quantity: number;
|
|
239
|
+
} | undefined;
|
|
226
240
|
categoryList?: ({
|
|
227
241
|
id: string;
|
|
228
242
|
companyId: string;
|
|
@@ -309,6 +323,10 @@ export declare const CartItemProductSchema: z.ZodObject<{
|
|
|
309
323
|
purchasePrice?: number | undefined;
|
|
310
324
|
profitPercentage?: number | undefined;
|
|
311
325
|
isDiscountable?: boolean | undefined;
|
|
326
|
+
stock?: {
|
|
327
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
328
|
+
quantity: number;
|
|
329
|
+
} | undefined;
|
|
312
330
|
categoryList?: ({
|
|
313
331
|
id: string;
|
|
314
332
|
companyId: string;
|
|
@@ -401,6 +419,10 @@ export declare const CartItemProductSchema: z.ZodObject<{
|
|
|
401
419
|
purchasePrice?: number | undefined;
|
|
402
420
|
profitPercentage?: number | undefined;
|
|
403
421
|
isDiscountable?: boolean | undefined;
|
|
422
|
+
stock?: {
|
|
423
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
424
|
+
quantity: number;
|
|
425
|
+
} | undefined;
|
|
404
426
|
categoryList?: ({
|
|
405
427
|
id: string;
|
|
406
428
|
companyId: string;
|
|
@@ -493,6 +515,10 @@ export declare const CartItemProductSchema: z.ZodObject<{
|
|
|
493
515
|
purchasePrice?: number | undefined;
|
|
494
516
|
profitPercentage?: number | undefined;
|
|
495
517
|
isDiscountable?: boolean | undefined;
|
|
518
|
+
stock?: {
|
|
519
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
520
|
+
quantity: number;
|
|
521
|
+
} | undefined;
|
|
496
522
|
categoryList?: ({
|
|
497
523
|
id: string;
|
|
498
524
|
companyId: string;
|
|
@@ -642,6 +668,16 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
642
668
|
created_at: z.ZodNumber;
|
|
643
669
|
updated_at: z.ZodNumber;
|
|
644
670
|
categoryIds: z.ZodArray<z.ZodString, "many">;
|
|
671
|
+
stock: z.ZodOptional<z.ZodObject<{
|
|
672
|
+
quantity: z.ZodNumber;
|
|
673
|
+
unit: z.ZodEnum<["piece", "kg", "gram", "liter", "ml"]>;
|
|
674
|
+
}, "strip", z.ZodTypeAny, {
|
|
675
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
676
|
+
quantity: number;
|
|
677
|
+
}, {
|
|
678
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
679
|
+
quantity: number;
|
|
680
|
+
}>>;
|
|
645
681
|
categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
|
|
646
682
|
id: string;
|
|
647
683
|
companyId: string;
|
|
@@ -764,6 +800,10 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
764
800
|
purchasePrice?: number | undefined;
|
|
765
801
|
profitPercentage?: number | undefined;
|
|
766
802
|
isDiscountable?: boolean | undefined;
|
|
803
|
+
stock?: {
|
|
804
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
805
|
+
quantity: number;
|
|
806
|
+
} | undefined;
|
|
767
807
|
categoryList?: ({
|
|
768
808
|
id: string;
|
|
769
809
|
companyId: string;
|
|
@@ -850,6 +890,10 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
850
890
|
purchasePrice?: number | undefined;
|
|
851
891
|
profitPercentage?: number | undefined;
|
|
852
892
|
isDiscountable?: boolean | undefined;
|
|
893
|
+
stock?: {
|
|
894
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
895
|
+
quantity: number;
|
|
896
|
+
} | undefined;
|
|
853
897
|
categoryList?: ({
|
|
854
898
|
id: string;
|
|
855
899
|
companyId: string;
|
|
@@ -942,6 +986,10 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
942
986
|
purchasePrice?: number | undefined;
|
|
943
987
|
profitPercentage?: number | undefined;
|
|
944
988
|
isDiscountable?: boolean | undefined;
|
|
989
|
+
stock?: {
|
|
990
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
991
|
+
quantity: number;
|
|
992
|
+
} | undefined;
|
|
945
993
|
categoryList?: ({
|
|
946
994
|
id: string;
|
|
947
995
|
companyId: string;
|
|
@@ -1034,6 +1082,10 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1034
1082
|
purchasePrice?: number | undefined;
|
|
1035
1083
|
profitPercentage?: number | undefined;
|
|
1036
1084
|
isDiscountable?: boolean | undefined;
|
|
1085
|
+
stock?: {
|
|
1086
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
1087
|
+
quantity: number;
|
|
1088
|
+
} | undefined;
|
|
1037
1089
|
categoryList?: ({
|
|
1038
1090
|
id: string;
|
|
1039
1091
|
companyId: string;
|
|
@@ -1134,6 +1186,10 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1134
1186
|
purchasePrice?: number | undefined;
|
|
1135
1187
|
profitPercentage?: number | undefined;
|
|
1136
1188
|
isDiscountable?: boolean | undefined;
|
|
1189
|
+
stock?: {
|
|
1190
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
1191
|
+
quantity: number;
|
|
1192
|
+
} | undefined;
|
|
1137
1193
|
categoryList?: ({
|
|
1138
1194
|
id: string;
|
|
1139
1195
|
companyId: string;
|
|
@@ -1234,6 +1290,10 @@ export declare const CartSchema: z.ZodObject<{
|
|
|
1234
1290
|
purchasePrice?: number | undefined;
|
|
1235
1291
|
profitPercentage?: number | undefined;
|
|
1236
1292
|
isDiscountable?: boolean | undefined;
|
|
1293
|
+
stock?: {
|
|
1294
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
1295
|
+
quantity: number;
|
|
1296
|
+
} | undefined;
|
|
1237
1297
|
categoryList?: ({
|
|
1238
1298
|
id: string;
|
|
1239
1299
|
companyId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cart.d.ts","sourceRoot":"","sources":["../../../lib/entities/Cart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"Cart.d.ts","sourceRoot":"","sources":["../../../lib/entities/Cart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAErE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -113,6 +113,16 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
113
113
|
created_at: z.ZodNumber;
|
|
114
114
|
updated_at: z.ZodNumber;
|
|
115
115
|
categoryIds: z.ZodArray<z.ZodString, "many">;
|
|
116
|
+
stock: z.ZodOptional<z.ZodObject<{
|
|
117
|
+
quantity: z.ZodNumber;
|
|
118
|
+
unit: z.ZodEnum<["piece", "kg", "gram", "liter", "ml"]>;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
121
|
+
quantity: number;
|
|
122
|
+
}, {
|
|
123
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
124
|
+
quantity: number;
|
|
125
|
+
}>>;
|
|
116
126
|
categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
|
|
117
127
|
id: string;
|
|
118
128
|
companyId: string;
|
|
@@ -235,6 +245,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
235
245
|
purchasePrice?: number | undefined;
|
|
236
246
|
profitPercentage?: number | undefined;
|
|
237
247
|
isDiscountable?: boolean | undefined;
|
|
248
|
+
stock?: {
|
|
249
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
250
|
+
quantity: number;
|
|
251
|
+
} | undefined;
|
|
238
252
|
categoryList?: ({
|
|
239
253
|
id: string;
|
|
240
254
|
companyId: string;
|
|
@@ -321,6 +335,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
321
335
|
purchasePrice?: number | undefined;
|
|
322
336
|
profitPercentage?: number | undefined;
|
|
323
337
|
isDiscountable?: boolean | undefined;
|
|
338
|
+
stock?: {
|
|
339
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
340
|
+
quantity: number;
|
|
341
|
+
} | undefined;
|
|
324
342
|
categoryList?: ({
|
|
325
343
|
id: string;
|
|
326
344
|
companyId: string;
|
|
@@ -413,6 +431,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
413
431
|
purchasePrice?: number | undefined;
|
|
414
432
|
profitPercentage?: number | undefined;
|
|
415
433
|
isDiscountable?: boolean | undefined;
|
|
434
|
+
stock?: {
|
|
435
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
436
|
+
quantity: number;
|
|
437
|
+
} | undefined;
|
|
416
438
|
categoryList?: ({
|
|
417
439
|
id: string;
|
|
418
440
|
companyId: string;
|
|
@@ -505,6 +527,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
505
527
|
purchasePrice?: number | undefined;
|
|
506
528
|
profitPercentage?: number | undefined;
|
|
507
529
|
isDiscountable?: boolean | undefined;
|
|
530
|
+
stock?: {
|
|
531
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
532
|
+
quantity: number;
|
|
533
|
+
} | undefined;
|
|
508
534
|
categoryList?: ({
|
|
509
535
|
id: string;
|
|
510
536
|
companyId: string;
|
|
@@ -604,6 +630,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
604
630
|
purchasePrice?: number | undefined;
|
|
605
631
|
profitPercentage?: number | undefined;
|
|
606
632
|
isDiscountable?: boolean | undefined;
|
|
633
|
+
stock?: {
|
|
634
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
635
|
+
quantity: number;
|
|
636
|
+
} | undefined;
|
|
607
637
|
categoryList?: ({
|
|
608
638
|
id: string;
|
|
609
639
|
companyId: string;
|
|
@@ -703,6 +733,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
703
733
|
purchasePrice?: number | undefined;
|
|
704
734
|
profitPercentage?: number | undefined;
|
|
705
735
|
isDiscountable?: boolean | undefined;
|
|
736
|
+
stock?: {
|
|
737
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
738
|
+
quantity: number;
|
|
739
|
+
} | undefined;
|
|
706
740
|
categoryList?: ({
|
|
707
741
|
id: string;
|
|
708
742
|
companyId: string;
|
|
@@ -1376,6 +1410,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
1376
1410
|
purchasePrice?: number | undefined;
|
|
1377
1411
|
profitPercentage?: number | undefined;
|
|
1378
1412
|
isDiscountable?: boolean | undefined;
|
|
1413
|
+
stock?: {
|
|
1414
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
1415
|
+
quantity: number;
|
|
1416
|
+
} | undefined;
|
|
1379
1417
|
categoryList?: ({
|
|
1380
1418
|
id: string;
|
|
1381
1419
|
companyId: string;
|
|
@@ -1644,6 +1682,10 @@ export declare const OrderSchema: z.ZodObject<{
|
|
|
1644
1682
|
purchasePrice?: number | undefined;
|
|
1645
1683
|
profitPercentage?: number | undefined;
|
|
1646
1684
|
isDiscountable?: boolean | undefined;
|
|
1685
|
+
stock?: {
|
|
1686
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
1687
|
+
quantity: number;
|
|
1688
|
+
} | undefined;
|
|
1647
1689
|
categoryList?: ({
|
|
1648
1690
|
id: string;
|
|
1649
1691
|
companyId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../lib/entities/Order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../../lib/entities/Order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDtB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -100,6 +100,16 @@ export declare const ProductSchema: z.ZodObject<{
|
|
|
100
100
|
created_at: z.ZodNumber;
|
|
101
101
|
updated_at: z.ZodNumber;
|
|
102
102
|
categoryIds: z.ZodArray<z.ZodString, "many">;
|
|
103
|
+
stock: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
quantity: z.ZodNumber;
|
|
105
|
+
unit: z.ZodEnum<["piece", "kg", "gram", "liter", "ml"]>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
108
|
+
quantity: number;
|
|
109
|
+
}, {
|
|
110
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
111
|
+
quantity: number;
|
|
112
|
+
}>>;
|
|
103
113
|
categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
|
|
104
114
|
id: string;
|
|
105
115
|
companyId: string;
|
|
@@ -222,6 +232,10 @@ export declare const ProductSchema: z.ZodObject<{
|
|
|
222
232
|
purchasePrice?: number | undefined;
|
|
223
233
|
profitPercentage?: number | undefined;
|
|
224
234
|
isDiscountable?: boolean | undefined;
|
|
235
|
+
stock?: {
|
|
236
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
237
|
+
quantity: number;
|
|
238
|
+
} | undefined;
|
|
225
239
|
categoryList?: ({
|
|
226
240
|
id: string;
|
|
227
241
|
companyId: string;
|
|
@@ -308,6 +322,10 @@ export declare const ProductSchema: z.ZodObject<{
|
|
|
308
322
|
purchasePrice?: number | undefined;
|
|
309
323
|
profitPercentage?: number | undefined;
|
|
310
324
|
isDiscountable?: boolean | undefined;
|
|
325
|
+
stock?: {
|
|
326
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
327
|
+
quantity: number;
|
|
328
|
+
} | undefined;
|
|
311
329
|
categoryList?: ({
|
|
312
330
|
id: string;
|
|
313
331
|
companyId: string;
|
|
@@ -444,6 +462,16 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
444
462
|
created_at: z.ZodNumber;
|
|
445
463
|
updated_at: z.ZodNumber;
|
|
446
464
|
categoryIds: z.ZodArray<z.ZodString, "many">;
|
|
465
|
+
stock: z.ZodOptional<z.ZodObject<{
|
|
466
|
+
quantity: z.ZodNumber;
|
|
467
|
+
unit: z.ZodEnum<["piece", "kg", "gram", "liter", "ml"]>;
|
|
468
|
+
}, "strip", z.ZodTypeAny, {
|
|
469
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
470
|
+
quantity: number;
|
|
471
|
+
}, {
|
|
472
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
473
|
+
quantity: number;
|
|
474
|
+
}>>;
|
|
447
475
|
categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
|
|
448
476
|
id: string;
|
|
449
477
|
companyId: string;
|
|
@@ -568,6 +596,10 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
568
596
|
purchasePrice?: number | undefined;
|
|
569
597
|
profitPercentage?: number | undefined;
|
|
570
598
|
isDiscountable?: boolean | undefined;
|
|
599
|
+
stock?: {
|
|
600
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
601
|
+
quantity: number;
|
|
602
|
+
} | undefined;
|
|
571
603
|
categoryList?: ({
|
|
572
604
|
id: string;
|
|
573
605
|
companyId: string;
|
|
@@ -655,6 +687,10 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
655
687
|
purchasePrice?: number | undefined;
|
|
656
688
|
profitPercentage?: number | undefined;
|
|
657
689
|
isDiscountable?: boolean | undefined;
|
|
690
|
+
stock?: {
|
|
691
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
692
|
+
quantity: number;
|
|
693
|
+
} | undefined;
|
|
658
694
|
categoryList?: ({
|
|
659
695
|
id: string;
|
|
660
696
|
companyId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Product.d.ts","sourceRoot":"","sources":["../../../lib/entities/Product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"Product.d.ts","sourceRoot":"","sources":["../../../lib/entities/Product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DxB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE3B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -43,6 +43,10 @@ export const ProductSchema = z.object({
|
|
|
43
43
|
created_at: z.number(),
|
|
44
44
|
updated_at: z.number(),
|
|
45
45
|
categoryIds: z.array(z.string().nonempty()),
|
|
46
|
+
stock: z.object({
|
|
47
|
+
quantity: z.number().min(0),
|
|
48
|
+
unit: z.enum(["piece", "kg", "gram", "liter", "ml"]),
|
|
49
|
+
}).optional(),
|
|
46
50
|
// @deprecated
|
|
47
51
|
categoryList: z.array(CategorySchema).optional(),
|
|
48
52
|
// @deprecated
|
|
@@ -67,6 +67,10 @@ export declare function getCartCost({ cart, discounts, deliveryPrice, freeDelive
|
|
|
67
67
|
purchasePrice?: number | undefined;
|
|
68
68
|
profitPercentage?: number | undefined;
|
|
69
69
|
isDiscountable?: boolean | undefined;
|
|
70
|
+
stock?: {
|
|
71
|
+
unit: "kg" | "gram" | "liter" | "ml" | "piece";
|
|
72
|
+
quantity: number;
|
|
73
|
+
} | undefined;
|
|
70
74
|
categoryList?: ({
|
|
71
75
|
id: string;
|
|
72
76
|
companyId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AA8BjE,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,aAAiB,EACjB,iBAAqB,EACrB,oBAA4B,GAC5B,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AA8BjE,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,aAAiB,EACjB,iBAAqB,EACrB,oBAA4B,GAC5B,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+FA"}
|
|
@@ -23,6 +23,9 @@ describe("storeCalculator", () => {
|
|
|
23
23
|
test("is reversible", () => {
|
|
24
24
|
expect(storeCalculator.calcMarginFromSalePrice(storeCalculator.calcSalePriceFromMargin(30, 100), 100)).toBe(30);
|
|
25
25
|
});
|
|
26
|
+
test("return purchase price when purchase price is not include VAT", () => {
|
|
27
|
+
expect(storeCalculator.calcSalePriceFromMargin(30.31, 8.8 * 1.18)).toBe(14.9);
|
|
28
|
+
});
|
|
26
29
|
});
|
|
27
30
|
describe("calcMarginFromSalePrice", () => {
|
|
28
31
|
test("calculate correct margin for sale price 111.11 and purchase price 100", () => {
|
|
@@ -46,5 +49,8 @@ describe("storeCalculator", () => {
|
|
|
46
49
|
test("return 0 when margin is 100", () => {
|
|
47
50
|
expect(storeCalculator.calcMarginFromSalePrice(100, 100)).toBe(0);
|
|
48
51
|
});
|
|
52
|
+
test("return margin when purchase price is not include VAT", () => {
|
|
53
|
+
expect(storeCalculator.calcMarginFromSalePrice(14.90, 8.8 * 1.18)).toBe(30.31);
|
|
54
|
+
});
|
|
49
55
|
});
|
|
50
56
|
});
|