@floristcloud/api-lib 1.2.28 → 1.2.30
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/auth/index.js +1 -0
- package/build/commands/auth/reset-login-attempts-by-admin.command.js +13 -0
- package/build/commands/order/group/merge-orders.command.js +33 -2
- package/build/commands/order/group/split-group-order.command.js +8 -0
- package/build/constant/error.js +1 -0
- package/build/enum/action-log-type.enum.js +1 -0
- package/build/enum/index.js +1 -0
- package/build/enum/order-merge-allowed-status-list.js +11 -0
- package/build/schemas/client/client.schema.js +1 -0
- package/commands/auth/index.ts +1 -0
- package/commands/auth/reset-login-attempts-by-admin.command.ts +15 -0
- package/commands/order/group/merge-orders.command.ts +41 -3
- package/commands/order/group/split-group-order.command.ts +11 -0
- package/constant/error.ts +1 -0
- package/enum/action-log-type.enum.ts +1 -0
- package/enum/index.ts +1 -0
- package/enum/order-merge-allowed-status-list.ts +9 -0
- package/package.json +1 -1
- package/schemas/client/client.schema.ts +1 -0
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./register-user.command"), exports);
|
|
18
18
|
__exportStar(require("./reset-password-by-user.command"), exports);
|
|
19
19
|
__exportStar(require("./reset-password-by-admin.command"), exports);
|
|
20
|
+
__exportStar(require("./reset-login-attempts-by-admin.command"), exports);
|
|
20
21
|
__exportStar(require("./login-user.command"), exports);
|
|
21
22
|
__exportStar(require("./list-mobile-buyer-tenants.command"), exports);
|
|
22
23
|
__exportStar(require("./reset-password-by-token.command"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResetLoginAttemptsByAdminContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const ResetLoginAttemptsByAdminRequestSchema = zod_1.z.object({});
|
|
6
|
+
const ResetLoginAttemptsByAdminResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
});
|
|
9
|
+
var ResetLoginAttemptsByAdminContractCommand;
|
|
10
|
+
(function (ResetLoginAttemptsByAdminContractCommand) {
|
|
11
|
+
ResetLoginAttemptsByAdminContractCommand.RequestSchema = ResetLoginAttemptsByAdminRequestSchema;
|
|
12
|
+
ResetLoginAttemptsByAdminContractCommand.ResponseSchema = ResetLoginAttemptsByAdminResponseSchema;
|
|
13
|
+
})(ResetLoginAttemptsByAdminContractCommand || (exports.ResetLoginAttemptsByAdminContractCommand = ResetLoginAttemptsByAdminContractCommand = {}));
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MergeOrdersContractCommand = exports.MergeOrdersGroupAnalysisResponseSchema = void 0;
|
|
3
|
+
exports.MergeOrdersExecuteContractCommand = exports.MergeOrdersContractCommand = exports.MergeOrdersGroupAnalysisResponseSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const schemas_1 = require("../../../schemas");
|
|
6
|
-
const MergeOrdersRequestSchema = zod_1.z
|
|
6
|
+
const MergeOrdersRequestSchema = zod_1.z
|
|
7
|
+
.object({
|
|
7
8
|
orderUUIDList: zod_1.z.array(zod_1.z.string().uuid()).min(2),
|
|
9
|
+
targetOrderUUID: zod_1.z.string().uuid().optional(),
|
|
10
|
+
})
|
|
11
|
+
.refine(data => !data.targetOrderUUID || data.orderUUIDList.includes(data.targetOrderUUID), {
|
|
12
|
+
message: 'targetOrderUUID must be present in orderUUIDList',
|
|
13
|
+
path: ['targetOrderUUID'],
|
|
8
14
|
});
|
|
9
15
|
exports.MergeOrdersGroupAnalysisResponseSchema = zod_1.z.object({
|
|
10
16
|
clientUUID: zod_1.z.string(),
|
|
@@ -24,3 +30,28 @@ var MergeOrdersContractCommand;
|
|
|
24
30
|
MergeOrdersContractCommand.RequestSchema = MergeOrdersRequestSchema;
|
|
25
31
|
MergeOrdersContractCommand.ResponseSchema = MergeOrdersAnalyzeResponseSchema;
|
|
26
32
|
})(MergeOrdersContractCommand || (exports.MergeOrdersContractCommand = MergeOrdersContractCommand = {}));
|
|
33
|
+
// Группы, не прошедшие merge, перечисляются в `failedGroups` с per-group причиной — UI рендерит
|
|
34
|
+
// «Заказы клиента X не объединены: <message>».
|
|
35
|
+
const MergeOrdersExecuteFailedGroupSchema = zod_1.z.object({
|
|
36
|
+
clientUUID: zod_1.z.string(),
|
|
37
|
+
branchUUID: zod_1.z.string().nullable(),
|
|
38
|
+
targetOrderUUID: zod_1.z.string().nullable(),
|
|
39
|
+
sourceOrdersUUIDs: zod_1.z.array(zod_1.z.string()),
|
|
40
|
+
errorCode: zod_1.z.string(),
|
|
41
|
+
errorMessage: zod_1.z.string(),
|
|
42
|
+
});
|
|
43
|
+
const MergeOrdersExecuteResponseSchema = zod_1.z.object({
|
|
44
|
+
message: zod_1.z.string().optional(),
|
|
45
|
+
data: zod_1.z.object({
|
|
46
|
+
success: zod_1.z.boolean(),
|
|
47
|
+
successCount: zod_1.z.number().int().nonnegative(),
|
|
48
|
+
totalCount: zod_1.z.number().int().nonnegative(),
|
|
49
|
+
failedGroups: zod_1.z.array(MergeOrdersExecuteFailedGroupSchema),
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
var MergeOrdersExecuteContractCommand;
|
|
53
|
+
(function (MergeOrdersExecuteContractCommand) {
|
|
54
|
+
MergeOrdersExecuteContractCommand.RequestSchema = MergeOrdersRequestSchema;
|
|
55
|
+
MergeOrdersExecuteContractCommand.ResponseSchema = MergeOrdersExecuteResponseSchema;
|
|
56
|
+
MergeOrdersExecuteContractCommand.FailedGroupSchema = MergeOrdersExecuteFailedGroupSchema;
|
|
57
|
+
})(MergeOrdersExecuteContractCommand || (exports.MergeOrdersExecuteContractCommand = MergeOrdersExecuteContractCommand = {}));
|
|
@@ -6,12 +6,20 @@ const schemas_1 = require("../../../schemas");
|
|
|
6
6
|
const SplitGroupOrderRequestSchema = zod_1.z.object({
|
|
7
7
|
orderUUIDList: zod_1.z.array(zod_1.z.string()),
|
|
8
8
|
});
|
|
9
|
+
// Источники, которые не удалось разделить, попадают в `failures` с per-source причиной.
|
|
10
|
+
const SplitGroupOrderFailureSchema = zod_1.z.object({
|
|
11
|
+
sourceOrderUUID: zod_1.z.string(),
|
|
12
|
+
errorCode: zod_1.z.string(),
|
|
13
|
+
errorMessage: zod_1.z.string(),
|
|
14
|
+
});
|
|
9
15
|
const SplitGroupOrderResponseSchema = zod_1.z.object({
|
|
10
16
|
message: zod_1.z.string().optional(),
|
|
11
17
|
data: schemas_1.OrderSchema.array(),
|
|
18
|
+
failures: zod_1.z.array(SplitGroupOrderFailureSchema).optional(),
|
|
12
19
|
});
|
|
13
20
|
var SplitGroupOrderContractCommand;
|
|
14
21
|
(function (SplitGroupOrderContractCommand) {
|
|
15
22
|
SplitGroupOrderContractCommand.RequestSchema = SplitGroupOrderRequestSchema;
|
|
16
23
|
SplitGroupOrderContractCommand.ResponseSchema = SplitGroupOrderResponseSchema;
|
|
24
|
+
SplitGroupOrderContractCommand.FailureSchema = SplitGroupOrderFailureSchema;
|
|
17
25
|
})(SplitGroupOrderContractCommand || (exports.SplitGroupOrderContractCommand = SplitGroupOrderContractCommand = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -110,6 +110,7 @@ exports.ERRORS = {
|
|
|
110
110
|
ALREADY_REGISTERED: { code: 'A001', message: 'User already exists', httpCode: 409 },
|
|
111
111
|
INVALID_USER_TYPE: { code: 'A018', message: 'Invalid user type', httpCode: 400 },
|
|
112
112
|
TOO_MANY_REQUESTS: { code: 'A019', message: 'Too many requests', httpCode: 429 },
|
|
113
|
+
ERROR_WHILE_RESET_LOGIN_ATTEMPTS: { code: 'A020', message: 'Failed to reset login attempts', httpCode: 500 },
|
|
113
114
|
//DOMAIN
|
|
114
115
|
DOMAIN_LIST_FETCH_FAILED: { code: 'D001', message: 'Error when retrieving a domain list', httpCode: 500 },
|
|
115
116
|
DOMAIN_FETCH_FAILED: { code: 'D002', message: 'Error when retrieving a domain', httpCode: 500 },
|
|
@@ -10,6 +10,7 @@ var ActionLogTypeEnum;
|
|
|
10
10
|
ActionLogTypeEnum["DELETE_ORDER_ITEM"] = "DELETE_ORDER_ITEM";
|
|
11
11
|
ActionLogTypeEnum["UPDATE_ORDER_ITEM"] = "UPDATE_ORDER_ITEM";
|
|
12
12
|
ActionLogTypeEnum["MOVE_ORDER_ITEM"] = "MOVE_ORDER_ITEM";
|
|
13
|
+
ActionLogTypeEnum["MERGE_ORDER"] = "MERGE_ORDER";
|
|
13
14
|
ActionLogTypeEnum["ADD_PAYMENT"] = "ADD_PAYMENT";
|
|
14
15
|
ActionLogTypeEnum["DELETE_PAYMENT"] = "DELETE_PAYMENT";
|
|
15
16
|
ActionLogTypeEnum["CREATE_PREORDER"] = "CREATE_PREORDER";
|
package/build/enum/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __exportStar(require("./order-type.enum"), exports);
|
|
|
23
23
|
__exportStar(require("./order-status.enum"), exports);
|
|
24
24
|
__exportStar(require("./order-restricted-status-list"), exports);
|
|
25
25
|
__exportStar(require("./order-balance-status-list"), exports);
|
|
26
|
+
__exportStar(require("./order-merge-allowed-status-list"), exports);
|
|
26
27
|
__exportStar(require("./transaction-type.enum"), exports);
|
|
27
28
|
__exportStar(require("./consignment-import-schema-relation-entity-property.enum"), exports);
|
|
28
29
|
__exportStar(require("./consignment-import-errors.enum"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrderMergeAllowedStatusList = void 0;
|
|
4
|
+
const order_status_enum_1 = require("./order-status.enum");
|
|
5
|
+
exports.OrderMergeAllowedStatusList = [
|
|
6
|
+
order_status_enum_1.OrderStatusEnum.NEW,
|
|
7
|
+
order_status_enum_1.OrderStatusEnum.UNDER_REVIEW,
|
|
8
|
+
order_status_enum_1.OrderStatusEnum.ACCEPTED,
|
|
9
|
+
order_status_enum_1.OrderStatusEnum.IMPORTED,
|
|
10
|
+
order_status_enum_1.OrderStatusEnum.TEMPLATE,
|
|
11
|
+
];
|
|
@@ -46,6 +46,7 @@ exports.ClientExtendedSchema = exports.ClientSchema.merge(zod_1.z.object({
|
|
|
46
46
|
responsibleUser: user_schema_1.UserSchema.nullable(),
|
|
47
47
|
clientMarkingList: client_marking_schema_1.ClientMarkingSchema.array().optional(),
|
|
48
48
|
hasOverdueDebt: zod_1.z.boolean().nullable().optional(),
|
|
49
|
+
isLoginBlocked: zod_1.z.boolean(),
|
|
49
50
|
}));
|
|
50
51
|
exports.ClientExtendedListSchema = zod_1.z.object({
|
|
51
52
|
clientList: exports.ClientExtendedSchema.array(),
|
package/commands/auth/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './register-user.command';
|
|
2
2
|
export * from './reset-password-by-user.command';
|
|
3
3
|
export * from './reset-password-by-admin.command';
|
|
4
|
+
export * from './reset-login-attempts-by-admin.command';
|
|
4
5
|
export * from './login-user.command';
|
|
5
6
|
export * from './list-mobile-buyer-tenants.command';
|
|
6
7
|
export * from './reset-password-by-token.command';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
const ResetLoginAttemptsByAdminRequestSchema = z.object({});
|
|
4
|
+
|
|
5
|
+
const ResetLoginAttemptsByAdminResponseSchema = z.object({
|
|
6
|
+
message: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export namespace ResetLoginAttemptsByAdminContractCommand {
|
|
10
|
+
export const RequestSchema = ResetLoginAttemptsByAdminRequestSchema;
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = ResetLoginAttemptsByAdminResponseSchema;
|
|
14
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
15
|
+
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ErrorMessageSchema } from '../../../schemas';
|
|
3
3
|
|
|
4
|
-
const MergeOrdersRequestSchema = z
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const MergeOrdersRequestSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
orderUUIDList: z.array(z.string().uuid()).min(2),
|
|
7
|
+
targetOrderUUID: z.string().uuid().optional(),
|
|
8
|
+
})
|
|
9
|
+
.refine(data => !data.targetOrderUUID || data.orderUUIDList.includes(data.targetOrderUUID), {
|
|
10
|
+
message: 'targetOrderUUID must be present in orderUUIDList',
|
|
11
|
+
path: ['targetOrderUUID'],
|
|
12
|
+
});
|
|
7
13
|
|
|
8
14
|
export const MergeOrdersGroupAnalysisResponseSchema = z.object({
|
|
9
15
|
clientUUID: z.string(),
|
|
@@ -27,3 +33,35 @@ export namespace MergeOrdersContractCommand {
|
|
|
27
33
|
export const ResponseSchema = MergeOrdersAnalyzeResponseSchema;
|
|
28
34
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
29
35
|
}
|
|
36
|
+
|
|
37
|
+
// Группы, не прошедшие merge, перечисляются в `failedGroups` с per-group причиной — UI рендерит
|
|
38
|
+
// «Заказы клиента X не объединены: <message>».
|
|
39
|
+
const MergeOrdersExecuteFailedGroupSchema = z.object({
|
|
40
|
+
clientUUID: z.string(),
|
|
41
|
+
branchUUID: z.string().nullable(),
|
|
42
|
+
targetOrderUUID: z.string().nullable(),
|
|
43
|
+
sourceOrdersUUIDs: z.array(z.string()),
|
|
44
|
+
errorCode: z.string(),
|
|
45
|
+
errorMessage: z.string(),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const MergeOrdersExecuteResponseSchema = z.object({
|
|
49
|
+
message: z.string().optional(),
|
|
50
|
+
data: z.object({
|
|
51
|
+
success: z.boolean(),
|
|
52
|
+
successCount: z.number().int().nonnegative(),
|
|
53
|
+
totalCount: z.number().int().nonnegative(),
|
|
54
|
+
failedGroups: z.array(MergeOrdersExecuteFailedGroupSchema),
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export namespace MergeOrdersExecuteContractCommand {
|
|
59
|
+
export const RequestSchema = MergeOrdersRequestSchema;
|
|
60
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
61
|
+
|
|
62
|
+
export const ResponseSchema = MergeOrdersExecuteResponseSchema;
|
|
63
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
64
|
+
|
|
65
|
+
export const FailedGroupSchema = MergeOrdersExecuteFailedGroupSchema;
|
|
66
|
+
export type FailedGroup = z.infer<typeof FailedGroupSchema>;
|
|
67
|
+
}
|
|
@@ -5,9 +5,17 @@ const SplitGroupOrderRequestSchema = z.object({
|
|
|
5
5
|
orderUUIDList: z.array(z.string()),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
+
// Источники, которые не удалось разделить, попадают в `failures` с per-source причиной.
|
|
9
|
+
const SplitGroupOrderFailureSchema = z.object({
|
|
10
|
+
sourceOrderUUID: z.string(),
|
|
11
|
+
errorCode: z.string(),
|
|
12
|
+
errorMessage: z.string(),
|
|
13
|
+
});
|
|
14
|
+
|
|
8
15
|
const SplitGroupOrderResponseSchema = z.object({
|
|
9
16
|
message: z.string().optional(),
|
|
10
17
|
data: OrderSchema.array(),
|
|
18
|
+
failures: z.array(SplitGroupOrderFailureSchema).optional(),
|
|
11
19
|
});
|
|
12
20
|
|
|
13
21
|
export namespace SplitGroupOrderContractCommand {
|
|
@@ -16,4 +24,7 @@ export namespace SplitGroupOrderContractCommand {
|
|
|
16
24
|
|
|
17
25
|
export const ResponseSchema = SplitGroupOrderResponseSchema;
|
|
18
26
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
27
|
+
|
|
28
|
+
export const FailureSchema = SplitGroupOrderFailureSchema;
|
|
29
|
+
export type Failure = z.infer<typeof FailureSchema>;
|
|
19
30
|
}
|
package/constant/error.ts
CHANGED
|
@@ -114,6 +114,7 @@ export const ERRORS = {
|
|
|
114
114
|
ALREADY_REGISTERED: { code: 'A001', message: 'User already exists', httpCode: 409 },
|
|
115
115
|
INVALID_USER_TYPE: { code: 'A018', message: 'Invalid user type', httpCode: 400 },
|
|
116
116
|
TOO_MANY_REQUESTS: { code: 'A019', message: 'Too many requests', httpCode: 429 },
|
|
117
|
+
ERROR_WHILE_RESET_LOGIN_ATTEMPTS: { code: 'A020', message: 'Failed to reset login attempts', httpCode: 500 },
|
|
117
118
|
|
|
118
119
|
//DOMAIN
|
|
119
120
|
DOMAIN_LIST_FETCH_FAILED: { code: 'D001', message: 'Error when retrieving a domain list', httpCode: 500 },
|
|
@@ -6,6 +6,7 @@ export enum ActionLogTypeEnum {
|
|
|
6
6
|
DELETE_ORDER_ITEM = 'DELETE_ORDER_ITEM',
|
|
7
7
|
UPDATE_ORDER_ITEM = 'UPDATE_ORDER_ITEM',
|
|
8
8
|
MOVE_ORDER_ITEM = 'MOVE_ORDER_ITEM',
|
|
9
|
+
MERGE_ORDER = 'MERGE_ORDER',
|
|
9
10
|
ADD_PAYMENT = 'ADD_PAYMENT',
|
|
10
11
|
DELETE_PAYMENT = 'DELETE_PAYMENT',
|
|
11
12
|
CREATE_PREORDER = 'CREATE_PREORDER',
|
package/enum/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export * from './order-type.enum';
|
|
|
7
7
|
export * from './order-status.enum';
|
|
8
8
|
export * from './order-restricted-status-list';
|
|
9
9
|
export * from './order-balance-status-list';
|
|
10
|
+
export * from './order-merge-allowed-status-list';
|
|
10
11
|
export * from './transaction-type.enum';
|
|
11
12
|
export * from './consignment-import-schema-relation-entity-property.enum';
|
|
12
13
|
export * from './consignment-import-errors.enum';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OrderStatusEnum } from './order-status.enum';
|
|
2
|
+
|
|
3
|
+
export const OrderMergeAllowedStatusList: OrderStatusEnum[] = [
|
|
4
|
+
OrderStatusEnum.NEW,
|
|
5
|
+
OrderStatusEnum.UNDER_REVIEW,
|
|
6
|
+
OrderStatusEnum.ACCEPTED,
|
|
7
|
+
OrderStatusEnum.IMPORTED,
|
|
8
|
+
OrderStatusEnum.TEMPLATE,
|
|
9
|
+
];
|
package/package.json
CHANGED
|
@@ -49,6 +49,7 @@ export const ClientExtendedSchema = ClientSchema.merge(
|
|
|
49
49
|
responsibleUser: UserSchema.nullable(),
|
|
50
50
|
clientMarkingList: ClientMarkingSchema.array().optional(),
|
|
51
51
|
hasOverdueDebt: z.boolean().nullable().optional(),
|
|
52
|
+
isLoginBlocked: z.boolean(),
|
|
52
53
|
}),
|
|
53
54
|
);
|
|
54
55
|
|