@floristcloud/api-lib 1.0.31 → 1.0.32
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/group/merge-orders.command.js +26 -0
- package/build/commands/order/index.js +1 -0
- package/build/constant/error-i18n-key.js +9 -0
- package/build/constant/error.js +12 -0
- package/build/constant/index.js +1 -0
- package/build/schemas/error-message.schema.js +10 -0
- package/build/schemas/index.js +1 -0
- package/commands/order/group/merge-orders.command.ts +29 -0
- package/commands/order/index.ts +1 -0
- package/constant/error-i18n-key.ts +9 -0
- package/constant/error.ts +12 -0
- package/constant/index.ts +1 -0
- package/package.json +1 -1
- package/schemas/error-message.schema.ts +8 -0
- package/schemas/index.ts +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MergeOrdersContractCommand = exports.MergeOrdersGroupAnalysisResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../../schemas");
|
|
6
|
+
const MergeOrdersRequestSchema = zod_1.z.object({
|
|
7
|
+
orderUUIDList: zod_1.z.array(zod_1.z.string().uuid()).min(2),
|
|
8
|
+
});
|
|
9
|
+
exports.MergeOrdersGroupAnalysisResponseSchema = zod_1.z.object({
|
|
10
|
+
clientUUID: zod_1.z.string(),
|
|
11
|
+
branchUUID: zod_1.z.string().nullable(),
|
|
12
|
+
isPossible: zod_1.z.boolean(),
|
|
13
|
+
targetOrderUUID: zod_1.z.string().nullable(),
|
|
14
|
+
sourceOrdersUUIDs: zod_1.z.array(zod_1.z.string()),
|
|
15
|
+
errors: zod_1.z.array(schemas_1.ErrorMessageSchema),
|
|
16
|
+
warnings: zod_1.z.array(schemas_1.ErrorMessageSchema),
|
|
17
|
+
});
|
|
18
|
+
const MergeOrdersAnalyzeResponseSchema = zod_1.z.object({
|
|
19
|
+
message: zod_1.z.string().optional(),
|
|
20
|
+
data: zod_1.z.array(exports.MergeOrdersGroupAnalysisResponseSchema),
|
|
21
|
+
});
|
|
22
|
+
var MergeOrdersContractCommand;
|
|
23
|
+
(function (MergeOrdersContractCommand) {
|
|
24
|
+
MergeOrdersContractCommand.RequestSchema = MergeOrdersRequestSchema;
|
|
25
|
+
MergeOrdersContractCommand.ResponseSchema = MergeOrdersAnalyzeResponseSchema;
|
|
26
|
+
})(MergeOrdersContractCommand || (exports.MergeOrdersContractCommand = MergeOrdersContractCommand = {}));
|
|
@@ -30,6 +30,7 @@ __exportStar(require("./group/update-group-order-tag.command"), exports);
|
|
|
30
30
|
__exportStar(require("./group/deletet-group-order.command"), exports);
|
|
31
31
|
__exportStar(require("./group/update-group-order-status.command"), exports);
|
|
32
32
|
__exportStar(require("./group/split-group-order.command"), exports);
|
|
33
|
+
__exportStar(require("./group/merge-orders.command"), exports);
|
|
33
34
|
//webshop
|
|
34
35
|
__exportStar(require("./webshop/get-order-for-client.query"), exports);
|
|
35
36
|
__exportStar(require("./webshop/create-cart.command"), exports);
|
|
@@ -4,4 +4,13 @@ exports.ErrorI18nKey = void 0;
|
|
|
4
4
|
exports.ErrorI18nKey = {
|
|
5
5
|
importOrderNotCreated: 'import.orderNotCreated',
|
|
6
6
|
duplicateProducts: 'import.duplicateProducts',
|
|
7
|
+
mergeOrderNotEnoughOrders: 'mergeOrder.notEnoughOrders',
|
|
8
|
+
mergeOrderStatusNotAllowed: 'mergeOrder.statusNotAllowed',
|
|
9
|
+
mergeOrderDifferentStatuses: 'mergeOrder.differentStatuses',
|
|
10
|
+
mergeOrderHasDeliveryRoute: 'mergeOrder.hasDeliveryRoute',
|
|
11
|
+
mergeOrderHasWriteOffs: 'mergeOrder.hasWriteOffs',
|
|
12
|
+
mergeOrderHasDistribution: 'mergeOrder.hasDistribution',
|
|
13
|
+
mergeOrderPaymentsTransfer: 'mergeOrder.paymentsTransfer',
|
|
14
|
+
mergeOrderDeliveryMerge: 'mergeOrder.deliveryMerge',
|
|
15
|
+
mergeOrderDeliveryTransfer: 'mergeOrder.deliveryTransfer',
|
|
7
16
|
};
|
package/build/constant/error.js
CHANGED
|
@@ -326,6 +326,18 @@ exports.ERRORS = {
|
|
|
326
326
|
ORDER_DELIVERY_COST_NEGATIVE: { code: 'O022', message: 'Order delivery cost is negative', httpCode: 400 },
|
|
327
327
|
ORDER_TOTAL_QUANTITY_NEGATIVE: { code: 'O023', message: 'Order total quantity is negative', httpCode: 400 },
|
|
328
328
|
ORDER_VALUE_NEGATIVE: { code: 'O024', message: 'Order value is negative', httpCode: 400 },
|
|
329
|
+
ORDER_MERGE_FAILED: { code: 'O026', message: 'Order merge failed', httpCode: 500 },
|
|
330
|
+
ORDER_MERGE_NOT_ENOUGH_ORDERS: { code: 'O027', message: 'Not enough orders to merge', httpCode: 400 },
|
|
331
|
+
ORDER_MERGE_STATUS_NOT_ALLOWED: { code: 'O028', message: 'Order status is not allowed for merge', httpCode: 400 },
|
|
332
|
+
ORDER_MERGE_DIFFERENT_STATUSES: { code: 'O029', message: 'All orders must have the same status', httpCode: 400 },
|
|
333
|
+
ORDER_MERGE_HAS_DELIVERY_ROUTE: { code: 'O030', message: 'Order is assigned to a delivery route', httpCode: 400 },
|
|
334
|
+
ORDER_MERGE_HAS_WRITE_OFFS: { code: 'O031', message: 'Order has write-offs', httpCode: 400 },
|
|
335
|
+
ORDER_MERGE_HAS_DISTRIBUTION: { code: 'O032', message: 'Order has products with distribution', httpCode: 400 },
|
|
336
|
+
ORDER_MERGE_BALANCE_STATUS_NOT_ALLOWED: {
|
|
337
|
+
code: 'O033',
|
|
338
|
+
message: 'Order status is balance affecting, merge not allowed',
|
|
339
|
+
httpCode: 400,
|
|
340
|
+
},
|
|
329
341
|
//ORDER DELIVERY
|
|
330
342
|
ORDER_DELIVERY_ALREADY_EXIST: { code: 'OD006', message: 'Delivery for the order already exists', httpCode: 409 },
|
|
331
343
|
ORDER_DELIVERY_NOT_CREATED: { code: 'OD007', message: 'Failed to create order delivery', httpCode: 500 },
|
package/build/constant/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./error"), exports);
|
|
18
18
|
__exportStar(require("./verbose"), exports);
|
|
19
|
+
__exportStar(require("./error-i18n-key"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorMessageSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.ErrorMessageSchema = zod_1.z.object({
|
|
6
|
+
message: zod_1.z.string(),
|
|
7
|
+
code: zod_1.z.string().optional(),
|
|
8
|
+
i18nKey: zod_1.z.string().optional(),
|
|
9
|
+
i18nParams: zod_1.z.record(zod_1.z.string(), zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.null()])).optional(),
|
|
10
|
+
});
|
package/build/schemas/index.js
CHANGED
|
@@ -70,3 +70,4 @@ __exportStar(require("./product-configuration/product-configuration.schema"), ex
|
|
|
70
70
|
__exportStar(require("./bank-payment"), exports);
|
|
71
71
|
__exportStar(require("./client"), exports);
|
|
72
72
|
__exportStar(require("./messenger-profile"), exports);
|
|
73
|
+
__exportStar(require("./error-message.schema"), exports);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ErrorMessageSchema } from '../../../schemas';
|
|
3
|
+
|
|
4
|
+
const MergeOrdersRequestSchema = z.object({
|
|
5
|
+
orderUUIDList: z.array(z.string().uuid()).min(2),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const MergeOrdersGroupAnalysisResponseSchema = z.object({
|
|
9
|
+
clientUUID: z.string(),
|
|
10
|
+
branchUUID: z.string().nullable(),
|
|
11
|
+
isPossible: z.boolean(),
|
|
12
|
+
targetOrderUUID: z.string().nullable(),
|
|
13
|
+
sourceOrdersUUIDs: z.array(z.string()),
|
|
14
|
+
errors: z.array(ErrorMessageSchema),
|
|
15
|
+
warnings: z.array(ErrorMessageSchema),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const MergeOrdersAnalyzeResponseSchema = z.object({
|
|
19
|
+
message: z.string().optional(),
|
|
20
|
+
data: z.array(MergeOrdersGroupAnalysisResponseSchema),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export namespace MergeOrdersContractCommand {
|
|
24
|
+
export const RequestSchema = MergeOrdersRequestSchema;
|
|
25
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
26
|
+
|
|
27
|
+
export const ResponseSchema = MergeOrdersAnalyzeResponseSchema;
|
|
28
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
29
|
+
}
|
package/commands/order/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ export * from './group/update-group-order-tag.command';
|
|
|
14
14
|
export * from './group/deletet-group-order.command';
|
|
15
15
|
export * from './group/update-group-order-status.command';
|
|
16
16
|
export * from './group/split-group-order.command';
|
|
17
|
+
export * from './group/merge-orders.command';
|
|
17
18
|
//webshop
|
|
18
19
|
export * from './webshop/get-order-for-client.query';
|
|
19
20
|
export * from './webshop/create-cart.command';
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export const ErrorI18nKey = {
|
|
2
2
|
importOrderNotCreated: 'import.orderNotCreated',
|
|
3
3
|
duplicateProducts: 'import.duplicateProducts',
|
|
4
|
+
mergeOrderNotEnoughOrders: 'mergeOrder.notEnoughOrders',
|
|
5
|
+
mergeOrderStatusNotAllowed: 'mergeOrder.statusNotAllowed',
|
|
6
|
+
mergeOrderDifferentStatuses: 'mergeOrder.differentStatuses',
|
|
7
|
+
mergeOrderHasDeliveryRoute: 'mergeOrder.hasDeliveryRoute',
|
|
8
|
+
mergeOrderHasWriteOffs: 'mergeOrder.hasWriteOffs',
|
|
9
|
+
mergeOrderHasDistribution: 'mergeOrder.hasDistribution',
|
|
10
|
+
mergeOrderPaymentsTransfer: 'mergeOrder.paymentsTransfer',
|
|
11
|
+
mergeOrderDeliveryMerge: 'mergeOrder.deliveryMerge',
|
|
12
|
+
mergeOrderDeliveryTransfer: 'mergeOrder.deliveryTransfer',
|
|
4
13
|
} as const;
|
|
5
14
|
|
|
6
15
|
export type ErrorI18nKeyType = (typeof ErrorI18nKey)[keyof typeof ErrorI18nKey];
|
package/constant/error.ts
CHANGED
|
@@ -340,6 +340,18 @@ export const ERRORS = {
|
|
|
340
340
|
ORDER_DELIVERY_COST_NEGATIVE: { code: 'O022', message: 'Order delivery cost is negative', httpCode: 400 },
|
|
341
341
|
ORDER_TOTAL_QUANTITY_NEGATIVE: { code: 'O023', message: 'Order total quantity is negative', httpCode: 400 },
|
|
342
342
|
ORDER_VALUE_NEGATIVE: { code: 'O024', message: 'Order value is negative', httpCode: 400 },
|
|
343
|
+
ORDER_MERGE_FAILED: { code: 'O026', message: 'Order merge failed', httpCode: 500 },
|
|
344
|
+
ORDER_MERGE_NOT_ENOUGH_ORDERS: { code: 'O027', message: 'Not enough orders to merge', httpCode: 400 },
|
|
345
|
+
ORDER_MERGE_STATUS_NOT_ALLOWED: { code: 'O028', message: 'Order status is not allowed for merge', httpCode: 400 },
|
|
346
|
+
ORDER_MERGE_DIFFERENT_STATUSES: { code: 'O029', message: 'All orders must have the same status', httpCode: 400 },
|
|
347
|
+
ORDER_MERGE_HAS_DELIVERY_ROUTE: { code: 'O030', message: 'Order is assigned to a delivery route', httpCode: 400 },
|
|
348
|
+
ORDER_MERGE_HAS_WRITE_OFFS: { code: 'O031', message: 'Order has write-offs', httpCode: 400 },
|
|
349
|
+
ORDER_MERGE_HAS_DISTRIBUTION: { code: 'O032', message: 'Order has products with distribution', httpCode: 400 },
|
|
350
|
+
ORDER_MERGE_BALANCE_STATUS_NOT_ALLOWED: {
|
|
351
|
+
code: 'O033',
|
|
352
|
+
message: 'Order status is balance affecting, merge not allowed',
|
|
353
|
+
httpCode: 400,
|
|
354
|
+
},
|
|
343
355
|
|
|
344
356
|
//ORDER DELIVERY
|
|
345
357
|
ORDER_DELIVERY_ALREADY_EXIST: { code: 'OD006', message: 'Delivery for the order already exists', httpCode: 409 },
|
package/constant/index.ts
CHANGED
package/package.json
CHANGED
package/schemas/index.ts
CHANGED