@floristcloud/api-lib 1.2.6 → 1.2.7
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/build/commands/order-product/group/price-correction-analyze.command.js +25 -0
- package/build/commands/order-product/group/price-correction-execute.command.js +24 -0
- package/build/commands/order-product/index.js +2 -0
- package/build/constant/error.js +15 -0
- package/build/enum/index.js +1 -0
- package/build/enum/order-price-correction-skipped-status-list.js +10 -0
- package/build/schemas/index.js +2 -0
- package/build/schemas/order-product/price-correction-analyze-item.schema.js +34 -0
- package/build/schemas/order-product/price-correction-execute-result-item.schema.js +13 -0
- package/commands/order-product/group/price-correction-analyze.command.ts +29 -0
- package/commands/order-product/group/price-correction-execute.command.ts +28 -0
- package/commands/order-product/index.ts +2 -0
- package/constant/error.ts +15 -0
- package/enum/index.ts +1 -0
- package/enum/order-price-correction-skipped-status-list.ts +8 -0
- package/package.json +1 -1
- package/schemas/index.ts +2 -0
- package/schemas/order-product/price-correction-analyze-item.schema.ts +37 -0
- package/schemas/order-product/price-correction-execute-result-item.schema.ts +11 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PriceCorrectionAnalyzeContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const PriceCorrectionAnalyzeRequestSchema = zod_1.z
|
|
7
|
+
.object({
|
|
8
|
+
productUUIDList: zod_1.z.array(zod_1.z.string().uuid()).optional(),
|
|
9
|
+
consignmentUUID: zod_1.z.string().uuid().optional(),
|
|
10
|
+
})
|
|
11
|
+
.refine(data => { var _a; return ((_a = data.productUUIDList) === null || _a === void 0 ? void 0 : _a.length) || data.consignmentUUID; }, {
|
|
12
|
+
message: 'Either productUUIDList or consignmentUUID must be provided',
|
|
13
|
+
});
|
|
14
|
+
const PriceCorrectionAnalyzeResponseSchema = zod_1.z.object({
|
|
15
|
+
message: zod_1.z.string().optional(),
|
|
16
|
+
data: zod_1.z.object({
|
|
17
|
+
items: zod_1.z.array(schemas_1.PriceCorrectionAnalyzeItemSchema),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
var PriceCorrectionAnalyzeContractCommand;
|
|
21
|
+
(function (PriceCorrectionAnalyzeContractCommand) {
|
|
22
|
+
PriceCorrectionAnalyzeContractCommand.RequestSchema = PriceCorrectionAnalyzeRequestSchema;
|
|
23
|
+
PriceCorrectionAnalyzeContractCommand.ItemSchema = schemas_1.PriceCorrectionAnalyzeItemSchema;
|
|
24
|
+
PriceCorrectionAnalyzeContractCommand.ResponseSchema = PriceCorrectionAnalyzeResponseSchema;
|
|
25
|
+
})(PriceCorrectionAnalyzeContractCommand || (exports.PriceCorrectionAnalyzeContractCommand = PriceCorrectionAnalyzeContractCommand = {}));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PriceCorrectionExecuteContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const PRICE_CORRECTION_BATCH_LIMIT = 50;
|
|
7
|
+
const PriceCorrectionExecuteRequestSchema = zod_1.z.object({
|
|
8
|
+
orderProductUUIDList: zod_1.z.array(zod_1.z.string().uuid()).min(1).max(PRICE_CORRECTION_BATCH_LIMIT),
|
|
9
|
+
withDiscount: zod_1.z.boolean(),
|
|
10
|
+
});
|
|
11
|
+
const PriceCorrectionExecuteResponseSchema = zod_1.z.object({
|
|
12
|
+
message: zod_1.z.string().optional(),
|
|
13
|
+
data: zod_1.z.object({
|
|
14
|
+
results: zod_1.z.array(schemas_1.PriceCorrectionExecuteResultItemSchema),
|
|
15
|
+
successCount: zod_1.z.number(),
|
|
16
|
+
skippedCount: zod_1.z.number(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
var PriceCorrectionExecuteContractCommand;
|
|
20
|
+
(function (PriceCorrectionExecuteContractCommand) {
|
|
21
|
+
PriceCorrectionExecuteContractCommand.RequestSchema = PriceCorrectionExecuteRequestSchema;
|
|
22
|
+
PriceCorrectionExecuteContractCommand.BATCH_LIMIT = PRICE_CORRECTION_BATCH_LIMIT;
|
|
23
|
+
PriceCorrectionExecuteContractCommand.ResponseSchema = PriceCorrectionExecuteResponseSchema;
|
|
24
|
+
})(PriceCorrectionExecuteContractCommand || (exports.PriceCorrectionExecuteContractCommand = PriceCorrectionExecuteContractCommand = {}));
|
|
@@ -27,6 +27,8 @@ __exportStar(require("./group/update-group-order-product-tag.command"), exports)
|
|
|
27
27
|
__exportStar(require("./group/delete-group-order-product.command"), exports);
|
|
28
28
|
__exportStar(require("./group/update-group-order-product-order.command"), exports);
|
|
29
29
|
__exportStar(require("./group/zeroing-receipt-order-product.command"), exports);
|
|
30
|
+
__exportStar(require("./group/price-correction-analyze.command"), exports);
|
|
31
|
+
__exportStar(require("./group/price-correction-execute.command"), exports);
|
|
30
32
|
//webshop
|
|
31
33
|
__exportStar(require("./webshop/update-order-product-for-client.command"), exports);
|
|
32
34
|
__exportStar(require("./webshop/create-order-product-for-client.command"), exports);
|
package/build/constant/error.js
CHANGED
|
@@ -400,6 +400,21 @@ exports.ERRORS = {
|
|
|
400
400
|
message: 'The product is not deleted, because it has write-off',
|
|
401
401
|
httpCode: 500,
|
|
402
402
|
},
|
|
403
|
+
ORDER_PRODUCT_PRICE_CORRECTION_BATCH_LIMIT_EXCEEDED: {
|
|
404
|
+
code: 'OP015',
|
|
405
|
+
message: 'Price correction batch limit exceeded',
|
|
406
|
+
httpCode: 400,
|
|
407
|
+
},
|
|
408
|
+
ORDER_PRODUCT_PRICE_CORRECTION_FAILED: {
|
|
409
|
+
code: 'OP016',
|
|
410
|
+
message: 'Failed to correct price for order product',
|
|
411
|
+
httpCode: 500,
|
|
412
|
+
},
|
|
413
|
+
ORDER_PRODUCT_PRICE_CORRECTION_ORDER_STATUS_NOT_ALLOWED: {
|
|
414
|
+
code: 'OP017',
|
|
415
|
+
message: 'Order status does not allow price correction',
|
|
416
|
+
httpCode: 400,
|
|
417
|
+
},
|
|
403
418
|
//TRANSACTION
|
|
404
419
|
TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
|
|
405
420
|
TRANSACTION_FETCH_FAILED: { code: 'TR002', message: 'Error when retrieving a transaction', httpCode: 500 },
|
package/build/enum/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __exportStar(require("./discount-rules-type.enum"), exports);
|
|
|
43
43
|
__exportStar(require("./discount-rules-mode-type.enum"), exports);
|
|
44
44
|
__exportStar(require("./order-distribute-status-list"), exports);
|
|
45
45
|
__exportStar(require("./order-active-status-list"), exports);
|
|
46
|
+
__exportStar(require("./order-price-correction-skipped-status-list"), exports);
|
|
46
47
|
__exportStar(require("./client-status.enum"), exports);
|
|
47
48
|
__exportStar(require("./client-type.enum"), exports);
|
|
48
49
|
__exportStar(require("./consignment-distribution-validation-status.enum"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderPriceCorrectionSkippedStatusList = void 0;
|
|
4
|
+
const order_status_enum_1 = require("./order-status.enum");
|
|
5
|
+
exports.OrderPriceCorrectionSkippedStatusList = [
|
|
6
|
+
order_status_enum_1.OrderStatusEnum.ASSEMBLED,
|
|
7
|
+
order_status_enum_1.OrderStatusEnum.VERIFIED,
|
|
8
|
+
order_status_enum_1.OrderStatusEnum.SHIPPED,
|
|
9
|
+
order_status_enum_1.OrderStatusEnum.COMPLETED,
|
|
10
|
+
];
|
package/build/schemas/index.js
CHANGED
|
@@ -26,6 +26,8 @@ __exportStar(require("./order-delivery/order-delivery.schema"), exports);
|
|
|
26
26
|
__exportStar(require("./order-product/order-product.schema"), exports);
|
|
27
27
|
__exportStar(require("./order-product/order-product-list.schema"), exports);
|
|
28
28
|
__exportStar(require("./order-product/order-product-multiplicity-optiom.schema"), exports);
|
|
29
|
+
__exportStar(require("./order-product/price-correction-analyze-item.schema"), exports);
|
|
30
|
+
__exportStar(require("./order-product/price-correction-execute-result-item.schema"), exports);
|
|
29
31
|
__exportStar(require("./transaction/transaction.schema"), exports);
|
|
30
32
|
__exportStar(require("./transaction/transaction-list.schema"), exports);
|
|
31
33
|
__exportStar(require("./file"), exports);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PriceCorrectionAnalyzeItemSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const enum_1 = require("../../enum");
|
|
6
|
+
const error_message_schema_1 = require("../error-message.schema");
|
|
7
|
+
exports.PriceCorrectionAnalyzeItemSchema = zod_1.z.object({
|
|
8
|
+
orderProductUUID: zod_1.z.string(),
|
|
9
|
+
orderUUID: zod_1.z.string(),
|
|
10
|
+
orderNumber: zod_1.z.number(),
|
|
11
|
+
orderStatus: zod_1.z.nativeEnum(enum_1.OrderStatusEnum),
|
|
12
|
+
clientName: zod_1.z.string(),
|
|
13
|
+
clientUUID: zod_1.z.string(),
|
|
14
|
+
productUUID: zod_1.z.string(),
|
|
15
|
+
productName: zod_1.z.string(),
|
|
16
|
+
categoryName: zod_1.z.string().nullable(),
|
|
17
|
+
grower: zod_1.z.string().nullable(),
|
|
18
|
+
size: zod_1.z.string().nullable(),
|
|
19
|
+
size2: zod_1.z.string().nullable(),
|
|
20
|
+
size3: zod_1.z.string().nullable(),
|
|
21
|
+
article: zod_1.z.string().nullable(),
|
|
22
|
+
color: zod_1.z.string().nullable(),
|
|
23
|
+
currentPrice: zod_1.z.number(),
|
|
24
|
+
currentAmount: zod_1.z.number(),
|
|
25
|
+
quantity: zod_1.z.number(),
|
|
26
|
+
newPriceWithoutDiscount: zod_1.z.number(),
|
|
27
|
+
newPriceWithDiscount: zod_1.z.number(),
|
|
28
|
+
newAmountWithoutDiscount: zod_1.z.number(),
|
|
29
|
+
newAmountWithDiscount: zod_1.z.number(),
|
|
30
|
+
priceDifferenceWithoutDiscount: zod_1.z.number(),
|
|
31
|
+
priceDifferenceWithDiscount: zod_1.z.number(),
|
|
32
|
+
isSkipped: zod_1.z.boolean(),
|
|
33
|
+
skipReason: error_message_schema_1.ErrorMessageSchema.optional(),
|
|
34
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PriceCorrectionExecuteResultItemSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const error_message_schema_1 = require("../error-message.schema");
|
|
6
|
+
exports.PriceCorrectionExecuteResultItemSchema = zod_1.z.object({
|
|
7
|
+
orderProductUUID: zod_1.z.string(),
|
|
8
|
+
orderUUID: zod_1.z.string(),
|
|
9
|
+
isSuccess: zod_1.z.boolean(),
|
|
10
|
+
error: error_message_schema_1.ErrorMessageSchema.optional(),
|
|
11
|
+
oldPrice: zod_1.z.number().optional(),
|
|
12
|
+
newPrice: zod_1.z.number().optional(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PriceCorrectionAnalyzeItemSchema } from '../../../schemas';
|
|
3
|
+
|
|
4
|
+
const PriceCorrectionAnalyzeRequestSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
productUUIDList: z.array(z.string().uuid()).optional(),
|
|
7
|
+
consignmentUUID: z.string().uuid().optional(),
|
|
8
|
+
})
|
|
9
|
+
.refine(data => data.productUUIDList?.length || data.consignmentUUID, {
|
|
10
|
+
message: 'Either productUUIDList or consignmentUUID must be provided',
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const PriceCorrectionAnalyzeResponseSchema = z.object({
|
|
14
|
+
message: z.string().optional(),
|
|
15
|
+
data: z.object({
|
|
16
|
+
items: z.array(PriceCorrectionAnalyzeItemSchema),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export namespace PriceCorrectionAnalyzeContractCommand {
|
|
21
|
+
export const RequestSchema = PriceCorrectionAnalyzeRequestSchema;
|
|
22
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
23
|
+
|
|
24
|
+
export const ItemSchema = PriceCorrectionAnalyzeItemSchema;
|
|
25
|
+
export type Item = z.infer<typeof ItemSchema>;
|
|
26
|
+
|
|
27
|
+
export const ResponseSchema = PriceCorrectionAnalyzeResponseSchema;
|
|
28
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PriceCorrectionExecuteResultItemSchema } from '../../../schemas';
|
|
3
|
+
|
|
4
|
+
const PRICE_CORRECTION_BATCH_LIMIT = 50;
|
|
5
|
+
|
|
6
|
+
const PriceCorrectionExecuteRequestSchema = z.object({
|
|
7
|
+
orderProductUUIDList: z.array(z.string().uuid()).min(1).max(PRICE_CORRECTION_BATCH_LIMIT),
|
|
8
|
+
withDiscount: z.boolean(),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const PriceCorrectionExecuteResponseSchema = z.object({
|
|
12
|
+
message: z.string().optional(),
|
|
13
|
+
data: z.object({
|
|
14
|
+
results: z.array(PriceCorrectionExecuteResultItemSchema),
|
|
15
|
+
successCount: z.number(),
|
|
16
|
+
skippedCount: z.number(),
|
|
17
|
+
}),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export namespace PriceCorrectionExecuteContractCommand {
|
|
21
|
+
export const RequestSchema = PriceCorrectionExecuteRequestSchema;
|
|
22
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
23
|
+
|
|
24
|
+
export const BATCH_LIMIT = PRICE_CORRECTION_BATCH_LIMIT;
|
|
25
|
+
|
|
26
|
+
export const ResponseSchema = PriceCorrectionExecuteResponseSchema;
|
|
27
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
28
|
+
}
|
|
@@ -11,6 +11,8 @@ export * from './group/update-group-order-product-tag.command';
|
|
|
11
11
|
export * from './group/delete-group-order-product.command';
|
|
12
12
|
export * from './group/update-group-order-product-order.command';
|
|
13
13
|
export * from './group/zeroing-receipt-order-product.command';
|
|
14
|
+
export * from './group/price-correction-analyze.command';
|
|
15
|
+
export * from './group/price-correction-execute.command';
|
|
14
16
|
//webshop
|
|
15
17
|
export * from './webshop/update-order-product-for-client.command';
|
|
16
18
|
export * from './webshop/create-order-product-for-client.command';
|
package/constant/error.ts
CHANGED
|
@@ -416,6 +416,21 @@ export const ERRORS = {
|
|
|
416
416
|
message: 'The product is not deleted, because it has write-off',
|
|
417
417
|
httpCode: 500,
|
|
418
418
|
},
|
|
419
|
+
ORDER_PRODUCT_PRICE_CORRECTION_BATCH_LIMIT_EXCEEDED: {
|
|
420
|
+
code: 'OP015',
|
|
421
|
+
message: 'Price correction batch limit exceeded',
|
|
422
|
+
httpCode: 400,
|
|
423
|
+
},
|
|
424
|
+
ORDER_PRODUCT_PRICE_CORRECTION_FAILED: {
|
|
425
|
+
code: 'OP016',
|
|
426
|
+
message: 'Failed to correct price for order product',
|
|
427
|
+
httpCode: 500,
|
|
428
|
+
},
|
|
429
|
+
ORDER_PRODUCT_PRICE_CORRECTION_ORDER_STATUS_NOT_ALLOWED: {
|
|
430
|
+
code: 'OP017',
|
|
431
|
+
message: 'Order status does not allow price correction',
|
|
432
|
+
httpCode: 400,
|
|
433
|
+
},
|
|
419
434
|
|
|
420
435
|
//TRANSACTION
|
|
421
436
|
TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
|
package/enum/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from './discount-rules-type.enum';
|
|
|
27
27
|
export * from './discount-rules-mode-type.enum';
|
|
28
28
|
export * from './order-distribute-status-list';
|
|
29
29
|
export * from './order-active-status-list';
|
|
30
|
+
export * from './order-price-correction-skipped-status-list';
|
|
30
31
|
export * from './client-status.enum';
|
|
31
32
|
export * from './client-type.enum';
|
|
32
33
|
export * from './consignment-distribution-validation-status.enum';
|
package/package.json
CHANGED
package/schemas/index.ts
CHANGED
|
@@ -10,6 +10,8 @@ export * from './order-delivery/order-delivery.schema';
|
|
|
10
10
|
export * from './order-product/order-product.schema';
|
|
11
11
|
export * from './order-product/order-product-list.schema';
|
|
12
12
|
export * from './order-product/order-product-multiplicity-optiom.schema';
|
|
13
|
+
export * from './order-product/price-correction-analyze-item.schema';
|
|
14
|
+
export * from './order-product/price-correction-execute-result-item.schema';
|
|
13
15
|
export * from './transaction/transaction.schema';
|
|
14
16
|
export * from './transaction/transaction-list.schema';
|
|
15
17
|
export * from './file';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OrderStatusEnum } from '../../enum';
|
|
3
|
+
import { ErrorMessageSchema } from '../error-message.schema';
|
|
4
|
+
|
|
5
|
+
export const PriceCorrectionAnalyzeItemSchema = z.object({
|
|
6
|
+
orderProductUUID: z.string(),
|
|
7
|
+
orderUUID: z.string(),
|
|
8
|
+
orderNumber: z.number(),
|
|
9
|
+
orderStatus: z.nativeEnum(OrderStatusEnum),
|
|
10
|
+
clientName: z.string(),
|
|
11
|
+
clientUUID: z.string(),
|
|
12
|
+
|
|
13
|
+
productUUID: z.string(),
|
|
14
|
+
productName: z.string(),
|
|
15
|
+
categoryName: z.string().nullable(),
|
|
16
|
+
grower: z.string().nullable(),
|
|
17
|
+
size: z.string().nullable(),
|
|
18
|
+
size2: z.string().nullable(),
|
|
19
|
+
size3: z.string().nullable(),
|
|
20
|
+
article: z.string().nullable(),
|
|
21
|
+
color: z.string().nullable(),
|
|
22
|
+
|
|
23
|
+
currentPrice: z.number(),
|
|
24
|
+
currentAmount: z.number(),
|
|
25
|
+
quantity: z.number(),
|
|
26
|
+
|
|
27
|
+
newPriceWithoutDiscount: z.number(),
|
|
28
|
+
newPriceWithDiscount: z.number(),
|
|
29
|
+
newAmountWithoutDiscount: z.number(),
|
|
30
|
+
newAmountWithDiscount: z.number(),
|
|
31
|
+
|
|
32
|
+
priceDifferenceWithoutDiscount: z.number(),
|
|
33
|
+
priceDifferenceWithDiscount: z.number(),
|
|
34
|
+
|
|
35
|
+
isSkipped: z.boolean(),
|
|
36
|
+
skipReason: ErrorMessageSchema.optional(),
|
|
37
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ErrorMessageSchema } from '../error-message.schema';
|
|
3
|
+
|
|
4
|
+
export const PriceCorrectionExecuteResultItemSchema = z.object({
|
|
5
|
+
orderProductUUID: z.string(),
|
|
6
|
+
orderUUID: z.string(),
|
|
7
|
+
isSuccess: z.boolean(),
|
|
8
|
+
error: ErrorMessageSchema.optional(),
|
|
9
|
+
oldPrice: z.number().optional(),
|
|
10
|
+
newPrice: z.number().optional(),
|
|
11
|
+
});
|