@floristcloud/api-lib 1.2.141 → 1.2.143
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/client/get-client-list.query.js +7 -0
- package/build/commands/client/group/assign-group-client-responsible.command.js +16 -0
- package/build/commands/client/index.js +1 -0
- package/build/commands/client/profile/create-client-legal-profile.command.js +2 -0
- package/build/commands/client/profile/update-client-legal-profile.command.js +2 -0
- package/build/constant/client-group-actions.constant.js +8 -0
- package/build/constant/error.js +5 -0
- package/build/constant/index.js +1 -0
- package/build/schemas/client/client-legal-profile.schema.js +1 -0
- package/build/schemas/client/client-responsible-assignment-result.schema.js +10 -0
- package/build/schemas/client/client-responsible-assignment.schema.js +12 -0
- package/build/schemas/client/index.js +2 -0
- package/commands/client/get-client-list.query.ts +7 -0
- package/commands/client/group/assign-group-client-responsible.command.ts +18 -0
- package/commands/client/index.ts +1 -0
- package/commands/client/profile/create-client-legal-profile.command.ts +2 -0
- package/commands/client/profile/update-client-legal-profile.command.ts +2 -0
- package/constant/client-group-actions.constant.ts +5 -0
- package/constant/error.ts +5 -0
- package/constant/index.ts +1 -0
- package/package.json +1 -1
- package/schemas/client/client-legal-profile.schema.ts +1 -0
- package/schemas/client/client-responsible-assignment-result.schema.ts +8 -0
- package/schemas/client/client-responsible-assignment.schema.ts +10 -0
- package/schemas/client/index.ts +2 -0
|
@@ -16,6 +16,13 @@ const GetClientListRequestSchema = zod_1.z.object({
|
|
|
16
16
|
searchQuery: zod_1.z.string().optional(),
|
|
17
17
|
sortByBalance: zod_1.z.union([zod_1.z.literal('asc'), zod_1.z.literal('desc')]).optional(),
|
|
18
18
|
responsibleUserUUID: zod_1.z.string().optional(),
|
|
19
|
+
// Клиенты без ответственного. Отдельный флаг, а не responsibleUserUUID со специальным значением:
|
|
20
|
+
// в query всё приходит строкой, и «null» пришлось бы отличать от клиента с таким именем.
|
|
21
|
+
// true — только с ответственным, false — только без него.
|
|
22
|
+
hasResponsible: zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.transform(val => (val === 'true' ? true : val === 'false' ? false : undefined)),
|
|
19
26
|
hasContract: zod_1.z
|
|
20
27
|
.string()
|
|
21
28
|
.optional()
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AssignGroupClientResponsibleContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_responsible_assignment_schema_1 = require("../../../schemas/client/client-responsible-assignment.schema");
|
|
6
|
+
const client_responsible_assignment_result_schema_1 = require("../../../schemas/client/client-responsible-assignment-result.schema");
|
|
7
|
+
const AssignGroupClientResponsibleRequestSchema = client_responsible_assignment_schema_1.ClientResponsibleAssignmentSchema;
|
|
8
|
+
const AssignGroupClientResponsibleResponseSchema = zod_1.z.object({
|
|
9
|
+
message: zod_1.z.string().optional(),
|
|
10
|
+
data: client_responsible_assignment_result_schema_1.ClientResponsibleAssignmentResultSchema,
|
|
11
|
+
});
|
|
12
|
+
var AssignGroupClientResponsibleContractCommand;
|
|
13
|
+
(function (AssignGroupClientResponsibleContractCommand) {
|
|
14
|
+
AssignGroupClientResponsibleContractCommand.RequestSchema = AssignGroupClientResponsibleRequestSchema;
|
|
15
|
+
AssignGroupClientResponsibleContractCommand.ResponseSchema = AssignGroupClientResponsibleResponseSchema;
|
|
16
|
+
})(AssignGroupClientResponsibleContractCommand || (exports.AssignGroupClientResponsibleContractCommand = AssignGroupClientResponsibleContractCommand = {}));
|
|
@@ -35,3 +35,4 @@ __exportStar(require("./marking/create-client-marking.command"), exports);
|
|
|
35
35
|
__exportStar(require("./marking/update-client-marking.command"), exports);
|
|
36
36
|
__exportStar(require("./marking/delete-client-marking.command"), exports);
|
|
37
37
|
__exportStar(require("./marking/get-client-marking-by-client-list.command"), exports);
|
|
38
|
+
__exportStar(require("./group/assign-group-client-responsible.command"), exports);
|
|
@@ -7,6 +7,8 @@ const CreateClientLegalProfileRequestSchema = client_1.ClientLegalProfileSchema.
|
|
|
7
7
|
uuid: true,
|
|
8
8
|
createdAt: true,
|
|
9
9
|
updatedAt: true,
|
|
10
|
+
}).extend({
|
|
11
|
+
correspondentAccount: client_1.ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
10
12
|
});
|
|
11
13
|
const CreateClientLegalProfileResponseSchema = zod_1.z.object({
|
|
12
14
|
message: zod_1.z.string().optional(),
|
|
@@ -7,6 +7,8 @@ const UpdateClientLegalProfileRequestSchema = client_1.ClientLegalProfileSchema.
|
|
|
7
7
|
uuid: true,
|
|
8
8
|
createdAt: true,
|
|
9
9
|
updatedAt: true,
|
|
10
|
+
}).extend({
|
|
11
|
+
correspondentAccount: client_1.ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
10
12
|
});
|
|
11
13
|
const UpdateClientLegalProfileResponseSchema = zod_1.z.object({
|
|
12
14
|
message: zod_1.z.string().optional(),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLIENT_GROUP_ACTIONS_LIMITS = void 0;
|
|
4
|
+
exports.CLIENT_GROUP_ACTIONS_LIMITS = {
|
|
5
|
+
// Верхняя граница на размер группы: панель шлёт выделение со страницы списка,
|
|
6
|
+
// а необъявленный предел означал бы неограниченный UPDATE по чужому запросу.
|
|
7
|
+
MAX_CLIENTS_PER_REQUEST: 500,
|
|
8
|
+
};
|
package/build/constant/error.js
CHANGED
|
@@ -144,6 +144,11 @@ exports.ERRORS = {
|
|
|
144
144
|
CLIENT_FETCH_FAILED: { code: 'CL005', message: 'Error when retrieving a list of clients', httpCode: 500 },
|
|
145
145
|
CLIENT_ALREADY_EXIST: { code: 'CL006', message: 'Client with this properties already exist', httpCode: 409 },
|
|
146
146
|
CLIENT_ACCESS_DENIED: { code: 'CL043', message: 'You are not responsible for this client', httpCode: 403 },
|
|
147
|
+
CLIENT_RESPONSIBLE_USER_NOT_ASSIGNABLE: {
|
|
148
|
+
code: 'CL045',
|
|
149
|
+
message: 'The responsible user does not belong to this company or has no panel role',
|
|
150
|
+
httpCode: 404,
|
|
151
|
+
},
|
|
147
152
|
CLIENT_EMAIL_ALREADY_EXIST: { code: 'CL007', message: 'Client with this email already exist', httpCode: 409 },
|
|
148
153
|
CLIENT_PHONE_ALREADY_EXIST: { code: 'CL008', message: 'Client with this phone already exist', httpCode: 409 },
|
|
149
154
|
CLIENT_WITH_SAME_USER_ALREADY_EXIST: { code: 'CL009', message: 'Client with same user already exist', httpCode: 409 },
|
package/build/constant/index.js
CHANGED
|
@@ -28,3 +28,4 @@ __exportStar(require("./settings.constant"), exports);
|
|
|
28
28
|
__exportStar(require("./consignment-product-enrichment.constant"), exports);
|
|
29
29
|
__exportStar(require("./attribute-normalization.constant"), exports);
|
|
30
30
|
__exportStar(require("./product-image-merge.constant"), exports);
|
|
31
|
+
__exportStar(require("./client-group-actions.constant"), exports);
|
|
@@ -12,6 +12,7 @@ exports.ClientLegalProfileSchema = zod_1.z.object({
|
|
|
12
12
|
kpp: zod_1.z.string().nullable(),
|
|
13
13
|
bankName: zod_1.z.string().nullable(),
|
|
14
14
|
bankAccountNumber: zod_1.z.string().nullable(),
|
|
15
|
+
correspondentAccount: zod_1.z.string().nullable(),
|
|
15
16
|
bankBic: zod_1.z.string().nullable(),
|
|
16
17
|
directorName: zod_1.z.string().nullable(),
|
|
17
18
|
directorPosition: zod_1.z.string().nullable(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientResponsibleAssignmentResultSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Итог группового переназначения ответственного.
|
|
6
|
+
exports.ClientResponsibleAssignmentResultSchema = zod_1.z.object({
|
|
7
|
+
// Клиентов, у которых назначение действительно изменилось. Те, у кого ответственный
|
|
8
|
+
// уже такой, в счёт не попадают — им не переписывается и дата назначения.
|
|
9
|
+
updatedCount: zod_1.z.number().int().nonnegative(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientResponsibleAssignmentSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_group_actions_constant_1 = require("../../constant/client-group-actions.constant");
|
|
6
|
+
// Кому и за каких клиентов переназначить ответственность.
|
|
7
|
+
exports.ClientResponsibleAssignmentSchema = zod_1.z.object({
|
|
8
|
+
clientUUIDList: zod_1.z.array(zod_1.z.uuid()).min(1).max(client_group_actions_constant_1.CLIENT_GROUP_ACTIONS_LIMITS.MAX_CLIENTS_PER_REQUEST),
|
|
9
|
+
// null — снять ответственного. Поле обязательное: пропуск означал бы «не менять»,
|
|
10
|
+
// а групповое действие без изменения не имеет смысла и скрывал бы опечатку на фронте.
|
|
11
|
+
responsibleUserUUID: zod_1.z.uuid().nullable(),
|
|
12
|
+
});
|
|
@@ -19,3 +19,5 @@ __exportStar(require("./client-individual-profile.schema"), exports);
|
|
|
19
19
|
__exportStar(require("./client-legal-profile.schema"), exports);
|
|
20
20
|
__exportStar(require("./client-marking.schema"), exports);
|
|
21
21
|
__exportStar(require("./client-debt.schema"), exports);
|
|
22
|
+
__exportStar(require("./client-responsible-assignment.schema"), exports);
|
|
23
|
+
__exportStar(require("./client-responsible-assignment-result.schema"), exports);
|
|
@@ -14,6 +14,13 @@ const GetClientListRequestSchema = z.object({
|
|
|
14
14
|
searchQuery: z.string().optional(),
|
|
15
15
|
sortByBalance: z.union([z.literal('asc'), z.literal('desc')]).optional(),
|
|
16
16
|
responsibleUserUUID: z.string().optional(),
|
|
17
|
+
// Клиенты без ответственного. Отдельный флаг, а не responsibleUserUUID со специальным значением:
|
|
18
|
+
// в query всё приходит строкой, и «null» пришлось бы отличать от клиента с таким именем.
|
|
19
|
+
// true — только с ответственным, false — только без него.
|
|
20
|
+
hasResponsible: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.transform(val => (val === 'true' ? true : val === 'false' ? false : undefined)),
|
|
17
24
|
hasContract: z
|
|
18
25
|
.string()
|
|
19
26
|
.optional()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ClientResponsibleAssignmentSchema } from '../../../schemas/client/client-responsible-assignment.schema';
|
|
3
|
+
import { ClientResponsibleAssignmentResultSchema } from '../../../schemas/client/client-responsible-assignment-result.schema';
|
|
4
|
+
|
|
5
|
+
const AssignGroupClientResponsibleRequestSchema = ClientResponsibleAssignmentSchema;
|
|
6
|
+
|
|
7
|
+
const AssignGroupClientResponsibleResponseSchema = z.object({
|
|
8
|
+
message: z.string().optional(),
|
|
9
|
+
data: ClientResponsibleAssignmentResultSchema,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export namespace AssignGroupClientResponsibleContractCommand {
|
|
13
|
+
export const RequestSchema = AssignGroupClientResponsibleRequestSchema;
|
|
14
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
15
|
+
|
|
16
|
+
export const ResponseSchema = AssignGroupClientResponsibleResponseSchema;
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
package/commands/client/index.ts
CHANGED
|
@@ -19,3 +19,4 @@ export * from './marking/create-client-marking.command';
|
|
|
19
19
|
export * from './marking/update-client-marking.command';
|
|
20
20
|
export * from './marking/delete-client-marking.command';
|
|
21
21
|
export * from './marking/get-client-marking-by-client-list.command';
|
|
22
|
+
export * from './group/assign-group-client-responsible.command';
|
|
@@ -5,6 +5,8 @@ const CreateClientLegalProfileRequestSchema = ClientLegalProfileSchema.omit({
|
|
|
5
5
|
uuid: true,
|
|
6
6
|
createdAt: true,
|
|
7
7
|
updatedAt: true,
|
|
8
|
+
}).extend({
|
|
9
|
+
correspondentAccount: ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
8
10
|
});
|
|
9
11
|
|
|
10
12
|
const CreateClientLegalProfileResponseSchema = z.object({
|
|
@@ -5,6 +5,8 @@ const UpdateClientLegalProfileRequestSchema = ClientLegalProfileSchema.omit({
|
|
|
5
5
|
uuid: true,
|
|
6
6
|
createdAt: true,
|
|
7
7
|
updatedAt: true,
|
|
8
|
+
}).extend({
|
|
9
|
+
correspondentAccount: ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
8
10
|
});
|
|
9
11
|
|
|
10
12
|
const UpdateClientLegalProfileResponseSchema = z.object({
|
package/constant/error.ts
CHANGED
|
@@ -149,6 +149,11 @@ export const ERRORS = {
|
|
|
149
149
|
CLIENT_FETCH_FAILED: { code: 'CL005', message: 'Error when retrieving a list of clients', httpCode: 500 },
|
|
150
150
|
CLIENT_ALREADY_EXIST: { code: 'CL006', message: 'Client with this properties already exist', httpCode: 409 },
|
|
151
151
|
CLIENT_ACCESS_DENIED: { code: 'CL043', message: 'You are not responsible for this client', httpCode: 403 },
|
|
152
|
+
CLIENT_RESPONSIBLE_USER_NOT_ASSIGNABLE: {
|
|
153
|
+
code: 'CL045',
|
|
154
|
+
message: 'The responsible user does not belong to this company or has no panel role',
|
|
155
|
+
httpCode: 404,
|
|
156
|
+
},
|
|
152
157
|
CLIENT_EMAIL_ALREADY_EXIST: { code: 'CL007', message: 'Client with this email already exist', httpCode: 409 },
|
|
153
158
|
CLIENT_PHONE_ALREADY_EXIST: { code: 'CL008', message: 'Client with this phone already exist', httpCode: 409 },
|
|
154
159
|
CLIENT_WITH_SAME_USER_ALREADY_EXIST: { code: 'CL009', message: 'Client with same user already exist', httpCode: 409 },
|
package/constant/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ export const ClientLegalProfileSchema = z.object({
|
|
|
10
10
|
kpp: z.string().nullable(),
|
|
11
11
|
bankName: z.string().nullable(),
|
|
12
12
|
bankAccountNumber: z.string().nullable(),
|
|
13
|
+
correspondentAccount: z.string().nullable(),
|
|
13
14
|
bankBic: z.string().nullable(),
|
|
14
15
|
directorName: z.string().nullable(),
|
|
15
16
|
directorPosition: z.string().nullable(),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// Итог группового переназначения ответственного.
|
|
4
|
+
export const ClientResponsibleAssignmentResultSchema = z.object({
|
|
5
|
+
// Клиентов, у которых назначение действительно изменилось. Те, у кого ответственный
|
|
6
|
+
// уже такой, в счёт не попадают — им не переписывается и дата назначения.
|
|
7
|
+
updatedCount: z.number().int().nonnegative(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CLIENT_GROUP_ACTIONS_LIMITS } from '../../constant/client-group-actions.constant';
|
|
3
|
+
|
|
4
|
+
// Кому и за каких клиентов переназначить ответственность.
|
|
5
|
+
export const ClientResponsibleAssignmentSchema = z.object({
|
|
6
|
+
clientUUIDList: z.array(z.uuid()).min(1).max(CLIENT_GROUP_ACTIONS_LIMITS.MAX_CLIENTS_PER_REQUEST),
|
|
7
|
+
// null — снять ответственного. Поле обязательное: пропуск означал бы «не менять»,
|
|
8
|
+
// а групповое действие без изменения не имеет смысла и скрывал бы опечатку на фронте.
|
|
9
|
+
responsibleUserUUID: z.uuid().nullable(),
|
|
10
|
+
});
|
package/schemas/client/index.ts
CHANGED
|
@@ -3,3 +3,5 @@ export * from './client-individual-profile.schema';
|
|
|
3
3
|
export * from './client-legal-profile.schema';
|
|
4
4
|
export * from './client-marking.schema';
|
|
5
5
|
export * from './client-debt.schema';
|
|
6
|
+
export * from './client-responsible-assignment.schema';
|
|
7
|
+
export * from './client-responsible-assignment-result.schema';
|