@floristcloud/api-lib 1.2.168 → 1.2.170
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/index.js +2 -0
- package/build/commands/client/profile/create-client-legal-profile.command.js +4 -15
- package/build/commands/client/profile/delete-client-legal-profile.command.js +4 -11
- package/build/commands/client/profile/get-client-legal-profile-list.query.js +10 -0
- package/build/commands/client/profile/index.js +1 -0
- package/build/commands/client/profile/update-client-legal-profile.command.js +4 -15
- package/build/commands/client/webshop/create-client-legal-profile-for-client.command.js +10 -0
- package/build/commands/client/webshop/update-client-legal-profile-for-client.command.js +10 -0
- package/build/commands/payment-invoice/create-payment-invoice.command.js +4 -29
- package/build/constant/error.js +12 -0
- package/build/schemas/client/client-extended-for-client.schema.js +2 -2
- package/build/schemas/client/client-extended.schema.js +2 -0
- package/build/schemas/client/client-legal-profile-for-client-response.schema.js +9 -0
- package/build/schemas/client/client-legal-profile-for-client.schema.js +27 -0
- package/build/schemas/client/client-legal-profile-requisites.schema.js +15 -0
- package/build/schemas/client/client-legal-profile.schema.js +3 -0
- package/build/schemas/client/create-client-legal-profile-request.schema.js +10 -0
- package/build/schemas/client/create-client-legal-profile-response.schema.js +9 -0
- package/build/schemas/client/delete-client-legal-profile-request.schema.js +5 -0
- package/build/schemas/client/delete-client-legal-profile-response.schema.js +9 -0
- package/build/schemas/client/delete-client-legal-profile-result.schema.js +9 -0
- package/build/schemas/client/get-client-legal-profile-list-request.schema.js +5 -0
- package/build/schemas/client/get-client-legal-profile-list-response.schema.js +9 -0
- package/build/schemas/client/index.js +12 -0
- package/build/schemas/client/update-client-legal-profile-request.schema.js +13 -0
- package/build/schemas/client/update-client-legal-profile-response.schema.js +9 -0
- package/build/schemas/index.js +2 -0
- package/build/schemas/payment-invoice/create-payment-invoice-request.schema.js +27 -0
- package/build/schemas/payment-invoice/create-payment-invoice-response.schema.js +9 -0
- package/build/schemas/payment-invoice/payment-invoice.schema.js +2 -0
- package/commands/client/index.ts +2 -0
- package/commands/client/profile/create-client-legal-profile.command.ts +3 -15
- package/commands/client/profile/delete-client-legal-profile.command.ts +3 -12
- package/commands/client/profile/get-client-legal-profile-list.query.ts +11 -0
- package/commands/client/profile/index.ts +1 -0
- package/commands/client/profile/update-client-legal-profile.command.ts +3 -15
- package/commands/client/webshop/create-client-legal-profile-for-client.command.ts +11 -0
- package/commands/client/webshop/update-client-legal-profile-for-client.command.ts +11 -0
- package/commands/payment-invoice/create-payment-invoice.command.ts +3 -31
- package/constant/error.ts +12 -0
- package/package.json +1 -1
- package/schemas/client/client-extended-for-client.schema.ts +2 -2
- package/schemas/client/client-extended.schema.ts +2 -0
- package/schemas/client/client-legal-profile-for-client-response.schema.ts +7 -0
- package/schemas/client/client-legal-profile-for-client.schema.ts +25 -0
- package/schemas/client/client-legal-profile-requisites.schema.ts +13 -0
- package/schemas/client/client-legal-profile.schema.ts +3 -0
- package/schemas/client/create-client-legal-profile-request.schema.ts +8 -0
- package/schemas/client/create-client-legal-profile-response.schema.ts +7 -0
- package/schemas/client/delete-client-legal-profile-request.schema.ts +3 -0
- package/schemas/client/delete-client-legal-profile-response.schema.ts +7 -0
- package/schemas/client/delete-client-legal-profile-result.schema.ts +7 -0
- package/schemas/client/get-client-legal-profile-list-request.schema.ts +3 -0
- package/schemas/client/get-client-legal-profile-list-response.schema.ts +7 -0
- package/schemas/client/index.ts +12 -0
- package/schemas/client/update-client-legal-profile-request.schema.ts +11 -0
- package/schemas/client/update-client-legal-profile-response.schema.ts +7 -0
- package/schemas/index.ts +2 -0
- package/schemas/payment-invoice/create-payment-invoice-request.schema.ts +26 -0
- package/schemas/payment-invoice/create-payment-invoice-response.schema.ts +7 -0
- package/schemas/payment-invoice/payment-invoice.schema.ts +2 -0
|
@@ -31,6 +31,8 @@ __exportStar(require("./detach-user-from-client.command"), exports);
|
|
|
31
31
|
__exportStar(require("./webshop/register-client-webshop.command"), exports);
|
|
32
32
|
__exportStar(require("./webshop/update-client-for-client.command"), exports);
|
|
33
33
|
__exportStar(require("./webshop/get-client-me-webshop.query"), exports);
|
|
34
|
+
__exportStar(require("./webshop/create-client-legal-profile-for-client.command"), exports);
|
|
35
|
+
__exportStar(require("./webshop/update-client-legal-profile-for-client.command"), exports);
|
|
34
36
|
//marking
|
|
35
37
|
__exportStar(require("./marking/create-client-marking.command"), exports);
|
|
36
38
|
__exportStar(require("./marking/update-client-marking.command"), exports);
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreateClientLegalProfileContractCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const CreateClientLegalProfileRequestSchema = client_1.ClientLegalProfileSchema.omit({
|
|
7
|
-
uuid: true,
|
|
8
|
-
createdAt: true,
|
|
9
|
-
updatedAt: true,
|
|
10
|
-
}).extend({
|
|
11
|
-
correspondentAccount: client_1.ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
12
|
-
});
|
|
13
|
-
const CreateClientLegalProfileResponseSchema = zod_1.z.object({
|
|
14
|
-
message: zod_1.z.string().optional(),
|
|
15
|
-
data: client_1.ClientLegalProfileSchema.nullable(),
|
|
16
|
-
});
|
|
4
|
+
const create_client_legal_profile_request_schema_1 = require("../../../schemas/client/create-client-legal-profile-request.schema");
|
|
5
|
+
const create_client_legal_profile_response_schema_1 = require("../../../schemas/client/create-client-legal-profile-response.schema");
|
|
17
6
|
var CreateClientLegalProfileContractCommand;
|
|
18
7
|
(function (CreateClientLegalProfileContractCommand) {
|
|
19
|
-
CreateClientLegalProfileContractCommand.RequestSchema = CreateClientLegalProfileRequestSchema;
|
|
20
|
-
CreateClientLegalProfileContractCommand.ResponseSchema = CreateClientLegalProfileResponseSchema;
|
|
8
|
+
CreateClientLegalProfileContractCommand.RequestSchema = create_client_legal_profile_request_schema_1.CreateClientLegalProfileRequestSchema;
|
|
9
|
+
CreateClientLegalProfileContractCommand.ResponseSchema = create_client_legal_profile_response_schema_1.CreateClientLegalProfileResponseSchema;
|
|
21
10
|
})(CreateClientLegalProfileContractCommand || (exports.CreateClientLegalProfileContractCommand = CreateClientLegalProfileContractCommand = {}));
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleteClientLegalProfileContractCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const DeleteDataResponseSchema = zod_1.z.object({
|
|
7
|
-
success: zod_1.z.boolean(),
|
|
8
|
-
});
|
|
9
|
-
const DeleteClientLegalProfileResponseSchema = zod_1.z.object({
|
|
10
|
-
message: zod_1.z.string().optional(),
|
|
11
|
-
data: DeleteDataResponseSchema,
|
|
12
|
-
});
|
|
4
|
+
const delete_client_legal_profile_request_schema_1 = require("../../../schemas/client/delete-client-legal-profile-request.schema");
|
|
5
|
+
const delete_client_legal_profile_response_schema_1 = require("../../../schemas/client/delete-client-legal-profile-response.schema");
|
|
13
6
|
var DeleteClientLegalProfileContractCommand;
|
|
14
7
|
(function (DeleteClientLegalProfileContractCommand) {
|
|
15
|
-
DeleteClientLegalProfileContractCommand.RequestSchema = DeleteClientLegalProfileRequestSchema;
|
|
16
|
-
DeleteClientLegalProfileContractCommand.ResponseSchema = DeleteClientLegalProfileResponseSchema;
|
|
8
|
+
DeleteClientLegalProfileContractCommand.RequestSchema = delete_client_legal_profile_request_schema_1.DeleteClientLegalProfileRequestSchema;
|
|
9
|
+
DeleteClientLegalProfileContractCommand.ResponseSchema = delete_client_legal_profile_response_schema_1.DeleteClientLegalProfileResponseSchema;
|
|
17
10
|
})(DeleteClientLegalProfileContractCommand || (exports.DeleteClientLegalProfileContractCommand = DeleteClientLegalProfileContractCommand = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetClientLegalProfileListContractQuery = void 0;
|
|
4
|
+
const get_client_legal_profile_list_request_schema_1 = require("../../../schemas/client/get-client-legal-profile-list-request.schema");
|
|
5
|
+
const get_client_legal_profile_list_response_schema_1 = require("../../../schemas/client/get-client-legal-profile-list-response.schema");
|
|
6
|
+
var GetClientLegalProfileListContractQuery;
|
|
7
|
+
(function (GetClientLegalProfileListContractQuery) {
|
|
8
|
+
GetClientLegalProfileListContractQuery.RequestSchema = get_client_legal_profile_list_request_schema_1.GetClientLegalProfileListRequestSchema;
|
|
9
|
+
GetClientLegalProfileListContractQuery.ResponseSchema = get_client_legal_profile_list_response_schema_1.GetClientLegalProfileListResponseSchema;
|
|
10
|
+
})(GetClientLegalProfileListContractQuery || (exports.GetClientLegalProfileListContractQuery = GetClientLegalProfileListContractQuery = {}));
|
|
@@ -21,3 +21,4 @@ __exportStar(require("./delete-client-individual-profile.command"), exports);
|
|
|
21
21
|
__exportStar(require("./create-client-legal-profile.command"), exports);
|
|
22
22
|
__exportStar(require("./update-client-legal-profile.command"), exports);
|
|
23
23
|
__exportStar(require("./delete-client-legal-profile.command"), exports);
|
|
24
|
+
__exportStar(require("./get-client-legal-profile-list.query"), exports);
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UpdateClientLegalProfileContractCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const UpdateClientLegalProfileRequestSchema = client_1.ClientLegalProfileSchema.omit({
|
|
7
|
-
uuid: true,
|
|
8
|
-
createdAt: true,
|
|
9
|
-
updatedAt: true,
|
|
10
|
-
}).extend({
|
|
11
|
-
correspondentAccount: client_1.ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
12
|
-
});
|
|
13
|
-
const UpdateClientLegalProfileResponseSchema = zod_1.z.object({
|
|
14
|
-
message: zod_1.z.string().optional(),
|
|
15
|
-
data: client_1.ClientLegalProfileSchema.nullable(),
|
|
16
|
-
});
|
|
4
|
+
const update_client_legal_profile_request_schema_1 = require("../../../schemas/client/update-client-legal-profile-request.schema");
|
|
5
|
+
const update_client_legal_profile_response_schema_1 = require("../../../schemas/client/update-client-legal-profile-response.schema");
|
|
17
6
|
var UpdateClientLegalProfileContractCommand;
|
|
18
7
|
(function (UpdateClientLegalProfileContractCommand) {
|
|
19
|
-
UpdateClientLegalProfileContractCommand.RequestSchema = UpdateClientLegalProfileRequestSchema;
|
|
20
|
-
UpdateClientLegalProfileContractCommand.ResponseSchema = UpdateClientLegalProfileResponseSchema;
|
|
8
|
+
UpdateClientLegalProfileContractCommand.RequestSchema = update_client_legal_profile_request_schema_1.UpdateClientLegalProfileRequestSchema;
|
|
9
|
+
UpdateClientLegalProfileContractCommand.ResponseSchema = update_client_legal_profile_response_schema_1.UpdateClientLegalProfileResponseSchema;
|
|
21
10
|
})(UpdateClientLegalProfileContractCommand || (exports.UpdateClientLegalProfileContractCommand = UpdateClientLegalProfileContractCommand = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateClientLegalProfileForClientContractCommand = void 0;
|
|
4
|
+
const client_legal_profile_requisites_schema_1 = require("../../../schemas/client/client-legal-profile-requisites.schema");
|
|
5
|
+
const client_legal_profile_for_client_response_schema_1 = require("../../../schemas/client/client-legal-profile-for-client-response.schema");
|
|
6
|
+
var CreateClientLegalProfileForClientContractCommand;
|
|
7
|
+
(function (CreateClientLegalProfileForClientContractCommand) {
|
|
8
|
+
CreateClientLegalProfileForClientContractCommand.RequestSchema = client_legal_profile_requisites_schema_1.ClientLegalProfileRequisitesSchema;
|
|
9
|
+
CreateClientLegalProfileForClientContractCommand.ResponseSchema = client_legal_profile_for_client_response_schema_1.ClientLegalProfileForClientResponseSchema;
|
|
10
|
+
})(CreateClientLegalProfileForClientContractCommand || (exports.CreateClientLegalProfileForClientContractCommand = CreateClientLegalProfileForClientContractCommand = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateClientLegalProfileForClientContractCommand = void 0;
|
|
4
|
+
const client_legal_profile_requisites_schema_1 = require("../../../schemas/client/client-legal-profile-requisites.schema");
|
|
5
|
+
const client_legal_profile_for_client_response_schema_1 = require("../../../schemas/client/client-legal-profile-for-client-response.schema");
|
|
6
|
+
var UpdateClientLegalProfileForClientContractCommand;
|
|
7
|
+
(function (UpdateClientLegalProfileForClientContractCommand) {
|
|
8
|
+
UpdateClientLegalProfileForClientContractCommand.RequestSchema = client_legal_profile_requisites_schema_1.ClientLegalProfileRequisitesSchema;
|
|
9
|
+
UpdateClientLegalProfileForClientContractCommand.ResponseSchema = client_legal_profile_for_client_response_schema_1.ClientLegalProfileForClientResponseSchema;
|
|
10
|
+
})(UpdateClientLegalProfileForClientContractCommand || (exports.UpdateClientLegalProfileForClientContractCommand = UpdateClientLegalProfileForClientContractCommand = {}));
|
|
@@ -1,35 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreatePaymentInvoiceContractCommand = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const positive_money_schema_1 = require("../../schemas/positive-money.schema");
|
|
7
|
-
// Потолок числа заказов в счёте. Это защита от абсурдного запроса, а не бизнес-правило: счёт за месяц
|
|
8
|
-
// клиенту с ежедневными поставками — это уже 30 строк, поэтому 10-20 отрезали бы живые сценарии.
|
|
9
|
-
// Сто строк — это 3-4 страницы таблицы, документ такого размера собирается и читается нормально.
|
|
10
|
-
const MAX_INVOICE_ORDER_COUNT = 100;
|
|
11
|
-
// Счёт выставляется одним из двух способов:
|
|
12
|
-
// - по заказам: orderUUIDs непустой, итог считается на бэке как сумма totalCost этих заказов,
|
|
13
|
-
// а amount — необязательная правка итога (например скидка по счёту), она уходит отдельной строкой;
|
|
14
|
-
// - вручную: orderUUIDs пуст, тогда amount обязателен и становится единственной строкой счёта.
|
|
15
|
-
const CreatePaymentInvoiceRequestSchema = zod_1.z
|
|
16
|
-
.object({
|
|
17
|
-
clientUUID: zod_1.z.uuid(),
|
|
18
|
-
invoiceDate: zod_1.z.coerce.date(),
|
|
19
|
-
orderUUIDs: zod_1.z.uuid().array().max(MAX_INVOICE_ORDER_COUNT).optional(),
|
|
20
|
-
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
21
|
-
amount: positive_money_schema_1.PositiveMoneySchema.optional(),
|
|
22
|
-
})
|
|
23
|
-
.refine(value => { var _a; return Boolean((_a = value.orderUUIDs) === null || _a === void 0 ? void 0 : _a.length) || value.amount !== undefined; }, {
|
|
24
|
-
message: 'Either orderUUIDs or amount must be provided',
|
|
25
|
-
path: ['amount'],
|
|
26
|
-
});
|
|
27
|
-
const CreatePaymentInvoiceResponseSchema = zod_1.z.object({
|
|
28
|
-
message: zod_1.z.string().optional(),
|
|
29
|
-
data: payment_invoice_schema_1.PaymentInvoiceSchema,
|
|
30
|
-
});
|
|
4
|
+
const create_payment_invoice_request_schema_1 = require("../../schemas/payment-invoice/create-payment-invoice-request.schema");
|
|
5
|
+
const create_payment_invoice_response_schema_1 = require("../../schemas/payment-invoice/create-payment-invoice-response.schema");
|
|
31
6
|
var CreatePaymentInvoiceContractCommand;
|
|
32
7
|
(function (CreatePaymentInvoiceContractCommand) {
|
|
33
|
-
CreatePaymentInvoiceContractCommand.RequestSchema = CreatePaymentInvoiceRequestSchema;
|
|
34
|
-
CreatePaymentInvoiceContractCommand.ResponseSchema = CreatePaymentInvoiceResponseSchema;
|
|
8
|
+
CreatePaymentInvoiceContractCommand.RequestSchema = create_payment_invoice_request_schema_1.CreatePaymentInvoiceRequestSchema;
|
|
9
|
+
CreatePaymentInvoiceContractCommand.ResponseSchema = create_payment_invoice_response_schema_1.CreatePaymentInvoiceResponseSchema;
|
|
35
10
|
})(CreatePaymentInvoiceContractCommand || (exports.CreatePaymentInvoiceContractCommand = CreatePaymentInvoiceContractCommand = {}));
|
package/build/constant/error.js
CHANGED
|
@@ -199,6 +199,12 @@ exports.ERRORS = {
|
|
|
199
199
|
CLIENT_LEGAL_PROFILE_NOT_FOUND: { code: 'CL020', message: 'Legal profile not founded', httpCode: 404 },
|
|
200
200
|
CLIENT_LEGAL_PROFILE_NOT_DELETED: { code: 'CL021', message: 'Legal profile not deleted', httpCode: 500 },
|
|
201
201
|
CLIENT_LEGAL_PROFILE_NOT_UPDATED: { code: 'CL022', message: 'Legal profile not updated', httpCode: 500 },
|
|
202
|
+
CLIENT_LEGAL_PROFILE_ARCHIVED: { code: 'CL046', message: 'Legal profile is archived', httpCode: 409 },
|
|
203
|
+
CLIENT_LEGAL_PROFILE_DEFAULT_REQUIRED: {
|
|
204
|
+
code: 'CL047',
|
|
205
|
+
message: 'Client must keep a default legal profile: assign another one instead',
|
|
206
|
+
httpCode: 409,
|
|
207
|
+
},
|
|
202
208
|
CLIENT_CALCULATE_FAILED: { code: 'CL023', message: 'Failed calculate by client', httpCode: 500 },
|
|
203
209
|
//BRANCH
|
|
204
210
|
BRANCH_NOT_CREATED: { code: 'B001', message: 'Failed to create branch', httpCode: 500 },
|
|
@@ -1638,6 +1644,12 @@ exports.ERRORS = {
|
|
|
1638
1644
|
ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
|
|
1639
1645
|
ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
|
|
1640
1646
|
ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
|
|
1647
|
+
ONE_C_EXCHANGE_FILE_MISSING: { code: 'OC006', message: '1C exchange file was not uploaded or has expired', httpCode: 404 },
|
|
1648
|
+
ONE_C_IMPORT_BUSY: { code: 'OC007', message: 'Another 1C catalog import is running for this company', httpCode: 409 },
|
|
1649
|
+
ONE_C_IMPORT_FAILED: { code: 'OC008', message: 'Failed to import 1C catalog', httpCode: 500 },
|
|
1650
|
+
ONE_C_ORDERS_EXPORT_FAILED: { code: 'OC009', message: 'Failed to export orders to 1C', httpCode: 500 },
|
|
1651
|
+
ONE_C_ORDERS_IMPORT_FAILED: { code: 'OC010', message: 'Failed to apply orders from 1C', httpCode: 500 },
|
|
1652
|
+
ONE_C_ACTOR_NOT_FOUND: { code: 'OC011', message: 'No company admin to attribute 1C changes to', httpCode: 409 },
|
|
1641
1653
|
// COMPANY INTEGRATION (общая запись интеграции компании)
|
|
1642
1654
|
COMPANY_INTEGRATION_FETCH_FAILED: { code: 'CINT001', message: 'Failed to read company integration', httpCode: 500 },
|
|
1643
1655
|
COMPANY_INTEGRATION_NOT_SAVED: { code: 'CINT002', message: 'Failed to save company integration', httpCode: 500 },
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ClientExtendedForClientSchema = void 0;
|
|
4
4
|
const client_for_client_schema_1 = require("./client-for-client.schema");
|
|
5
5
|
const client_individual_profile_schema_1 = require("./client-individual-profile.schema");
|
|
6
|
-
const
|
|
6
|
+
const client_legal_profile_for_client_schema_1 = require("./client-legal-profile-for-client.schema");
|
|
7
7
|
const user_contact_for_client_schema_1 = require("../user/user-contact-for-client.schema");
|
|
8
8
|
const user_name_schema_1 = require("../user/user-name.schema");
|
|
9
9
|
const discount_rules_for_client_schema_1 = require("../discount-rules/discount-rules-for-client.schema");
|
|
@@ -12,6 +12,6 @@ exports.ClientExtendedForClientSchema = client_for_client_schema_1.ClientForClie
|
|
|
12
12
|
user: user_contact_for_client_schema_1.UserContactForClientSchema.nullable(),
|
|
13
13
|
responsibleUser: user_name_schema_1.UserNameSchema.nullable(),
|
|
14
14
|
clientIndividualProfile: client_individual_profile_schema_1.ClientIndividualProfileSchema.nullable(),
|
|
15
|
-
clientLegalProfile:
|
|
15
|
+
clientLegalProfile: client_legal_profile_for_client_schema_1.ClientLegalProfileForClientSchema.nullable(),
|
|
16
16
|
discountRulesList: discount_rules_for_client_schema_1.DiscountRulesForClientSchema.array(),
|
|
17
17
|
});
|
|
@@ -11,7 +11,9 @@ const client_base_schema_1 = require("./client-base.schema");
|
|
|
11
11
|
exports.ClientExtendedSchema = client_base_schema_1.ClientSchema.extend({
|
|
12
12
|
user: user_schema_1.UserSchema.nullable(),
|
|
13
13
|
clientIndividualProfile: client_individual_profile_schema_1.ClientIndividualProfileSchema.nullable(),
|
|
14
|
+
// Основная карточка реквизитов; все карточки клиента, включая архивные, — в clientLegalProfileList.
|
|
14
15
|
clientLegalProfile: client_legal_profile_schema_1.ClientLegalProfileSchema.nullable(),
|
|
16
|
+
clientLegalProfileList: client_legal_profile_schema_1.ClientLegalProfileSchema.array(),
|
|
15
17
|
discountRulesList: discount_rules_schema_1.DiscountRulesSchema.array().optional(),
|
|
16
18
|
orderCount: zod_1.z.number(),
|
|
17
19
|
responsibleUser: user_schema_1.UserSchema.nullable(),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientLegalProfileForClientResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_legal_profile_for_client_schema_1 = require("./client-legal-profile-for-client.schema");
|
|
6
|
+
exports.ClientLegalProfileForClientResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: client_legal_profile_for_client_schema_1.ClientLegalProfileForClientSchema.nullable(),
|
|
9
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientLegalProfileForClientSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_legal_type_enum_1 = require("../../enum/client-legal-type.enum");
|
|
6
|
+
// Реквизиты покупателя на витрине. Подпись и флаги карточки — внутренние поля панели, наружу не отдаются.
|
|
7
|
+
exports.ClientLegalProfileForClientSchema = zod_1.z.object({
|
|
8
|
+
uuid: zod_1.z.uuid(),
|
|
9
|
+
fullCompanyName: zod_1.z.string().nullable(),
|
|
10
|
+
taxId: zod_1.z.string().nullable(),
|
|
11
|
+
ogrn: zod_1.z.string().nullable(),
|
|
12
|
+
ogrnip: zod_1.z.string().nullable(),
|
|
13
|
+
kpp: zod_1.z.string().nullable(),
|
|
14
|
+
bankName: zod_1.z.string().nullable(),
|
|
15
|
+
bankAccountNumber: zod_1.z.string().nullable(),
|
|
16
|
+
correspondentAccount: zod_1.z.string().nullable(),
|
|
17
|
+
bankBic: zod_1.z.string().nullable(),
|
|
18
|
+
directorName: zod_1.z.string().nullable(),
|
|
19
|
+
directorPosition: zod_1.z.string().nullable(),
|
|
20
|
+
directorAuthority: zod_1.z.string().nullable(),
|
|
21
|
+
edoUsage: zod_1.z.boolean(),
|
|
22
|
+
edoId: zod_1.z.string().nullable(),
|
|
23
|
+
address: zod_1.z.string().nullable(),
|
|
24
|
+
legalType: zod_1.z.nativeEnum(client_legal_type_enum_1.ClientLegalTypeEnum),
|
|
25
|
+
createdAt: zod_1.z.date(),
|
|
26
|
+
updatedAt: zod_1.z.date(),
|
|
27
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientLegalProfileRequisitesSchema = void 0;
|
|
4
|
+
const client_legal_profile_schema_1 = require("./client-legal-profile.schema");
|
|
5
|
+
// Реквизиты карточки, которые пользователь заполняет сам: без служебных полей и флагов карточки.
|
|
6
|
+
exports.ClientLegalProfileRequisitesSchema = client_legal_profile_schema_1.ClientLegalProfileSchema.omit({
|
|
7
|
+
uuid: true,
|
|
8
|
+
label: true,
|
|
9
|
+
isDefault: true,
|
|
10
|
+
isArchived: true,
|
|
11
|
+
createdAt: true,
|
|
12
|
+
updatedAt: true,
|
|
13
|
+
}).extend({
|
|
14
|
+
correspondentAccount: client_legal_profile_schema_1.ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
15
|
+
});
|
|
@@ -5,6 +5,9 @@ const zod_1 = require("zod");
|
|
|
5
5
|
const enum_1 = require("../../enum");
|
|
6
6
|
exports.ClientLegalProfileSchema = zod_1.z.object({
|
|
7
7
|
uuid: zod_1.z.uuid(),
|
|
8
|
+
label: zod_1.z.string().nullable(),
|
|
9
|
+
isDefault: zod_1.z.boolean(),
|
|
10
|
+
isArchived: zod_1.z.boolean(),
|
|
8
11
|
fullCompanyName: zod_1.z.string().nullable(),
|
|
9
12
|
taxId: zod_1.z.string().nullable(),
|
|
10
13
|
ogrn: zod_1.z.string().nullable(),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateClientLegalProfileRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_legal_profile_schema_1 = require("./client-legal-profile.schema");
|
|
6
|
+
const client_legal_profile_requisites_schema_1 = require("./client-legal-profile-requisites.schema");
|
|
7
|
+
exports.CreateClientLegalProfileRequestSchema = client_legal_profile_requisites_schema_1.ClientLegalProfileRequisitesSchema.extend({
|
|
8
|
+
label: client_legal_profile_schema_1.ClientLegalProfileSchema.shape.label.optional(),
|
|
9
|
+
isDefault: zod_1.z.boolean().optional(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateClientLegalProfileResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_legal_profile_schema_1 = require("./client-legal-profile.schema");
|
|
6
|
+
exports.CreateClientLegalProfileResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: client_legal_profile_schema_1.ClientLegalProfileSchema.nullable(),
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteClientLegalProfileResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const delete_client_legal_profile_result_schema_1 = require("./delete-client-legal-profile-result.schema");
|
|
6
|
+
exports.DeleteClientLegalProfileResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: delete_client_legal_profile_result_schema_1.DeleteClientLegalProfileResultSchema,
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeleteClientLegalProfileResultSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// isArchived — карточку не удалили, а убрали в архив: по ней уже выписаны документы.
|
|
6
|
+
exports.DeleteClientLegalProfileResultSchema = zod_1.z.object({
|
|
7
|
+
success: zod_1.z.boolean(),
|
|
8
|
+
isArchived: zod_1.z.boolean(),
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetClientLegalProfileListResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_legal_profile_schema_1 = require("./client-legal-profile.schema");
|
|
6
|
+
exports.GetClientLegalProfileListResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: client_legal_profile_schema_1.ClientLegalProfileSchema.array(),
|
|
9
|
+
});
|
|
@@ -18,12 +18,24 @@ __exportStar(require("./client.schema"), exports);
|
|
|
18
18
|
__exportStar(require("./client-name.schema"), exports);
|
|
19
19
|
__exportStar(require("./client-individual-profile.schema"), exports);
|
|
20
20
|
__exportStar(require("./client-legal-profile.schema"), exports);
|
|
21
|
+
__exportStar(require("./client-legal-profile-requisites.schema"), exports);
|
|
22
|
+
__exportStar(require("./create-client-legal-profile-request.schema"), exports);
|
|
23
|
+
__exportStar(require("./create-client-legal-profile-response.schema"), exports);
|
|
24
|
+
__exportStar(require("./update-client-legal-profile-request.schema"), exports);
|
|
25
|
+
__exportStar(require("./update-client-legal-profile-response.schema"), exports);
|
|
26
|
+
__exportStar(require("./delete-client-legal-profile-request.schema"), exports);
|
|
27
|
+
__exportStar(require("./delete-client-legal-profile-result.schema"), exports);
|
|
28
|
+
__exportStar(require("./delete-client-legal-profile-response.schema"), exports);
|
|
29
|
+
__exportStar(require("./get-client-legal-profile-list-request.schema"), exports);
|
|
30
|
+
__exportStar(require("./get-client-legal-profile-list-response.schema"), exports);
|
|
21
31
|
__exportStar(require("./client-marking.schema"), exports);
|
|
22
32
|
__exportStar(require("./client-debt.schema"), exports);
|
|
23
33
|
__exportStar(require("./client-responsible-assignment.schema"), exports);
|
|
24
34
|
__exportStar(require("./client-responsible-assignment-result.schema"), exports);
|
|
25
35
|
__exportStar(require("./client-for-client.schema"), exports);
|
|
26
36
|
__exportStar(require("./client-extended-for-client.schema"), exports);
|
|
37
|
+
__exportStar(require("./client-legal-profile-for-client.schema"), exports);
|
|
38
|
+
__exportStar(require("./client-legal-profile-for-client-response.schema"), exports);
|
|
27
39
|
__exportStar(require("./get-client-me-webshop-response.schema"), exports);
|
|
28
40
|
__exportStar(require("./register-client-webshop-request.schema"), exports);
|
|
29
41
|
__exportStar(require("./register-client-webshop-response.schema"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateClientLegalProfileRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_legal_profile_schema_1 = require("./client-legal-profile.schema");
|
|
6
|
+
const client_legal_profile_requisites_schema_1 = require("./client-legal-profile-requisites.schema");
|
|
7
|
+
// Правка частичная: поле, которого нет в запросе, не меняется, null — очищает. Так карточку можно сделать
|
|
8
|
+
// основной или убрать в архив, не пересылая реквизиты.
|
|
9
|
+
exports.UpdateClientLegalProfileRequestSchema = client_legal_profile_requisites_schema_1.ClientLegalProfileRequisitesSchema.partial().extend({
|
|
10
|
+
label: client_legal_profile_schema_1.ClientLegalProfileSchema.shape.label.optional(),
|
|
11
|
+
isDefault: zod_1.z.boolean().optional(),
|
|
12
|
+
isArchived: zod_1.z.boolean().optional(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateClientLegalProfileResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const client_legal_profile_schema_1 = require("./client-legal-profile.schema");
|
|
6
|
+
exports.UpdateClientLegalProfileResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: client_legal_profile_schema_1.ClientLegalProfileSchema.nullable(),
|
|
9
|
+
});
|
package/build/schemas/index.js
CHANGED
|
@@ -87,6 +87,8 @@ __exportStar(require("./package/validate-package.schema"), exports);
|
|
|
87
87
|
__exportStar(require("./pagination-request.schema"), exports);
|
|
88
88
|
__exportStar(require("./parser"), exports);
|
|
89
89
|
__exportStar(require("./payment-invoice/payment-invoice.schema"), exports);
|
|
90
|
+
__exportStar(require("./payment-invoice/create-payment-invoice-request.schema"), exports);
|
|
91
|
+
__exportStar(require("./payment-invoice/create-payment-invoice-response.schema"), exports);
|
|
90
92
|
__exportStar(require("./positive-decimal4.schema"), exports);
|
|
91
93
|
__exportStar(require("./positive-money.schema"), exports);
|
|
92
94
|
__exportStar(require("./pre-order"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreatePaymentInvoiceRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const positive_money_schema_1 = require("../positive-money.schema");
|
|
6
|
+
// Потолок числа заказов в счёте. Это защита от абсурдного запроса, а не бизнес-правило: счёт за месяц
|
|
7
|
+
// клиенту с ежедневными поставками — это уже 30 строк, поэтому 10-20 отрезали бы живые сценарии.
|
|
8
|
+
// Сто строк — это 3-4 страницы таблицы, документ такого размера собирается и читается нормально.
|
|
9
|
+
const MAX_INVOICE_ORDER_COUNT = 100;
|
|
10
|
+
// Счёт выставляется одним из двух способов:
|
|
11
|
+
// - по заказам: orderUUIDs непустой, итог считается на бэке как сумма totalCost этих заказов,
|
|
12
|
+
// а amount — необязательная правка итога (например скидка по счёту), она уходит отдельной строкой;
|
|
13
|
+
// - вручную: orderUUIDs пуст, тогда amount обязателен и становится единственной строкой счёта.
|
|
14
|
+
exports.CreatePaymentInvoiceRequestSchema = zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
clientUUID: zod_1.z.uuid(),
|
|
17
|
+
// Карточка реквизитов покупателя. Не передана — счёт выписывается на основную карточку клиента.
|
|
18
|
+
clientLegalProfileUUID: zod_1.z.uuid().optional(),
|
|
19
|
+
invoiceDate: zod_1.z.coerce.date(),
|
|
20
|
+
orderUUIDs: zod_1.z.uuid().array().max(MAX_INVOICE_ORDER_COUNT).optional(),
|
|
21
|
+
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
22
|
+
amount: positive_money_schema_1.PositiveMoneySchema.optional(),
|
|
23
|
+
})
|
|
24
|
+
.refine(value => { var _a; return Boolean((_a = value.orderUUIDs) === null || _a === void 0 ? void 0 : _a.length) || value.amount !== undefined; }, {
|
|
25
|
+
message: 'Either orderUUIDs or amount must be provided',
|
|
26
|
+
path: ['amount'],
|
|
27
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreatePaymentInvoiceResponseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const payment_invoice_schema_1 = require("./payment-invoice.schema");
|
|
6
|
+
exports.CreatePaymentInvoiceResponseSchema = zod_1.z.object({
|
|
7
|
+
message: zod_1.z.string().optional(),
|
|
8
|
+
data: payment_invoice_schema_1.PaymentInvoiceSchema,
|
|
9
|
+
});
|
|
@@ -22,6 +22,8 @@ exports.PaymentInvoiceSchema = zod_1.z.object({
|
|
|
22
22
|
remainingAmount: money_schema_1.MoneySchema,
|
|
23
23
|
status: zod_1.z.nativeEnum(payment_invoice_status_enum_1.PaymentInvoiceStatusEnum),
|
|
24
24
|
clientUUID: zod_1.z.string(),
|
|
25
|
+
// Карточка реквизитов, на которую выписан счёт; null — у старых счетов и у клиентов без карточек.
|
|
26
|
+
clientLegalProfileUUID: zod_1.z.string().nullable(),
|
|
25
27
|
clientName: zod_1.z.string(),
|
|
26
28
|
contractNumber: zod_1.z.string().nullable(),
|
|
27
29
|
contractDate: zod_1.z.coerce.date().nullable(),
|
package/commands/client/index.ts
CHANGED
|
@@ -15,6 +15,8 @@ export * from './detach-user-from-client.command';
|
|
|
15
15
|
export * from './webshop/register-client-webshop.command';
|
|
16
16
|
export * from './webshop/update-client-for-client.command';
|
|
17
17
|
export * from './webshop/get-client-me-webshop.query';
|
|
18
|
+
export * from './webshop/create-client-legal-profile-for-client.command';
|
|
19
|
+
export * from './webshop/update-client-legal-profile-for-client.command';
|
|
18
20
|
//marking
|
|
19
21
|
export * from './marking/create-client-marking.command';
|
|
20
22
|
export * from './marking/update-client-marking.command';
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const CreateClientLegalProfileRequestSchema = ClientLegalProfileSchema.omit({
|
|
5
|
-
uuid: true,
|
|
6
|
-
createdAt: true,
|
|
7
|
-
updatedAt: true,
|
|
8
|
-
}).extend({
|
|
9
|
-
correspondentAccount: ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const CreateClientLegalProfileResponseSchema = z.object({
|
|
13
|
-
message: z.string().optional(),
|
|
14
|
-
data: ClientLegalProfileSchema.nullable(),
|
|
15
|
-
});
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { CreateClientLegalProfileRequestSchema } from '../../../schemas/client/create-client-legal-profile-request.schema';
|
|
3
|
+
import { CreateClientLegalProfileResponseSchema } from '../../../schemas/client/create-client-legal-profile-response.schema';
|
|
16
4
|
|
|
17
5
|
export namespace CreateClientLegalProfileContractCommand {
|
|
18
6
|
export const RequestSchema = CreateClientLegalProfileRequestSchema;
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const DeleteDataResponseSchema = z.object({
|
|
6
|
-
success: z.boolean(),
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const DeleteClientLegalProfileResponseSchema = z.object({
|
|
10
|
-
message: z.string().optional(),
|
|
11
|
-
data: DeleteDataResponseSchema,
|
|
12
|
-
});
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { DeleteClientLegalProfileRequestSchema } from '../../../schemas/client/delete-client-legal-profile-request.schema';
|
|
3
|
+
import { DeleteClientLegalProfileResponseSchema } from '../../../schemas/client/delete-client-legal-profile-response.schema';
|
|
13
4
|
|
|
14
5
|
export namespace DeleteClientLegalProfileContractCommand {
|
|
15
6
|
export const RequestSchema = DeleteClientLegalProfileRequestSchema;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { GetClientLegalProfileListRequestSchema } from '../../../schemas/client/get-client-legal-profile-list-request.schema';
|
|
3
|
+
import { GetClientLegalProfileListResponseSchema } from '../../../schemas/client/get-client-legal-profile-list-response.schema';
|
|
4
|
+
|
|
5
|
+
export namespace GetClientLegalProfileListContractQuery {
|
|
6
|
+
export const RequestSchema = GetClientLegalProfileListRequestSchema;
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = GetClientLegalProfileListResponseSchema;
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -5,3 +5,4 @@ export * from './delete-client-individual-profile.command';
|
|
|
5
5
|
export * from './create-client-legal-profile.command';
|
|
6
6
|
export * from './update-client-legal-profile.command';
|
|
7
7
|
export * from './delete-client-legal-profile.command';
|
|
8
|
+
export * from './get-client-legal-profile-list.query';
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const UpdateClientLegalProfileRequestSchema = ClientLegalProfileSchema.omit({
|
|
5
|
-
uuid: true,
|
|
6
|
-
createdAt: true,
|
|
7
|
-
updatedAt: true,
|
|
8
|
-
}).extend({
|
|
9
|
-
correspondentAccount: ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
const UpdateClientLegalProfileResponseSchema = z.object({
|
|
13
|
-
message: z.string().optional(),
|
|
14
|
-
data: ClientLegalProfileSchema.nullable(),
|
|
15
|
-
});
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { UpdateClientLegalProfileRequestSchema } from '../../../schemas/client/update-client-legal-profile-request.schema';
|
|
3
|
+
import { UpdateClientLegalProfileResponseSchema } from '../../../schemas/client/update-client-legal-profile-response.schema';
|
|
16
4
|
|
|
17
5
|
export namespace UpdateClientLegalProfileContractCommand {
|
|
18
6
|
export const RequestSchema = UpdateClientLegalProfileRequestSchema;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { ClientLegalProfileRequisitesSchema } from '../../../schemas/client/client-legal-profile-requisites.schema';
|
|
3
|
+
import { ClientLegalProfileForClientResponseSchema } from '../../../schemas/client/client-legal-profile-for-client-response.schema';
|
|
4
|
+
|
|
5
|
+
export namespace CreateClientLegalProfileForClientContractCommand {
|
|
6
|
+
export const RequestSchema = ClientLegalProfileRequisitesSchema;
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = ClientLegalProfileForClientResponseSchema;
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { ClientLegalProfileRequisitesSchema } from '../../../schemas/client/client-legal-profile-requisites.schema';
|
|
3
|
+
import { ClientLegalProfileForClientResponseSchema } from '../../../schemas/client/client-legal-profile-for-client-response.schema';
|
|
4
|
+
|
|
5
|
+
export namespace UpdateClientLegalProfileForClientContractCommand {
|
|
6
|
+
export const RequestSchema = ClientLegalProfileRequisitesSchema;
|
|
7
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
8
|
+
|
|
9
|
+
export const ResponseSchema = ClientLegalProfileForClientResponseSchema;
|
|
10
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
11
|
+
}
|
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { PositiveMoneySchema } from '../../schemas/positive-money.schema';
|
|
5
|
-
|
|
6
|
-
// Потолок числа заказов в счёте. Это защита от абсурдного запроса, а не бизнес-правило: счёт за месяц
|
|
7
|
-
// клиенту с ежедневными поставками — это уже 30 строк, поэтому 10-20 отрезали бы живые сценарии.
|
|
8
|
-
// Сто строк — это 3-4 страницы таблицы, документ такого размера собирается и читается нормально.
|
|
9
|
-
const MAX_INVOICE_ORDER_COUNT = 100;
|
|
10
|
-
|
|
11
|
-
// Счёт выставляется одним из двух способов:
|
|
12
|
-
// - по заказам: orderUUIDs непустой, итог считается на бэке как сумма totalCost этих заказов,
|
|
13
|
-
// а amount — необязательная правка итога (например скидка по счёту), она уходит отдельной строкой;
|
|
14
|
-
// - вручную: orderUUIDs пуст, тогда amount обязателен и становится единственной строкой счёта.
|
|
15
|
-
const CreatePaymentInvoiceRequestSchema = z
|
|
16
|
-
.object({
|
|
17
|
-
clientUUID: z.uuid(),
|
|
18
|
-
invoiceDate: z.coerce.date(),
|
|
19
|
-
orderUUIDs: z.uuid().array().max(MAX_INVOICE_ORDER_COUNT).optional(),
|
|
20
|
-
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
21
|
-
amount: PositiveMoneySchema.optional(),
|
|
22
|
-
})
|
|
23
|
-
.refine(value => Boolean(value.orderUUIDs?.length) || value.amount !== undefined, {
|
|
24
|
-
message: 'Either orderUUIDs or amount must be provided',
|
|
25
|
-
path: ['amount'],
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const CreatePaymentInvoiceResponseSchema = z.object({
|
|
29
|
-
message: z.string().optional(),
|
|
30
|
-
data: PaymentInvoiceSchema,
|
|
31
|
-
});
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { CreatePaymentInvoiceRequestSchema } from '../../schemas/payment-invoice/create-payment-invoice-request.schema';
|
|
3
|
+
import { CreatePaymentInvoiceResponseSchema } from '../../schemas/payment-invoice/create-payment-invoice-response.schema';
|
|
32
4
|
|
|
33
5
|
export namespace CreatePaymentInvoiceContractCommand {
|
|
34
6
|
export const RequestSchema = CreatePaymentInvoiceRequestSchema;
|
package/constant/error.ts
CHANGED
|
@@ -206,6 +206,12 @@ export const ERRORS = {
|
|
|
206
206
|
CLIENT_LEGAL_PROFILE_NOT_FOUND: { code: 'CL020', message: 'Legal profile not founded', httpCode: 404 },
|
|
207
207
|
CLIENT_LEGAL_PROFILE_NOT_DELETED: { code: 'CL021', message: 'Legal profile not deleted', httpCode: 500 },
|
|
208
208
|
CLIENT_LEGAL_PROFILE_NOT_UPDATED: { code: 'CL022', message: 'Legal profile not updated', httpCode: 500 },
|
|
209
|
+
CLIENT_LEGAL_PROFILE_ARCHIVED: { code: 'CL046', message: 'Legal profile is archived', httpCode: 409 },
|
|
210
|
+
CLIENT_LEGAL_PROFILE_DEFAULT_REQUIRED: {
|
|
211
|
+
code: 'CL047',
|
|
212
|
+
message: 'Client must keep a default legal profile: assign another one instead',
|
|
213
|
+
httpCode: 409,
|
|
214
|
+
},
|
|
209
215
|
CLIENT_CALCULATE_FAILED: { code: 'CL023', message: 'Failed calculate by client', httpCode: 500 },
|
|
210
216
|
//BRANCH
|
|
211
217
|
BRANCH_NOT_CREATED: { code: 'B001', message: 'Failed to create branch', httpCode: 500 },
|
|
@@ -1705,6 +1711,12 @@ export const ERRORS = {
|
|
|
1705
1711
|
ONE_C_INVALID_CREDENTIALS: { code: 'OC003', message: '1C credentials are invalid', httpCode: 401 },
|
|
1706
1712
|
ONE_C_INTEGRATION_DISABLED: { code: 'OC004', message: '1C integration is disabled for this company', httpCode: 409 },
|
|
1707
1713
|
ONE_C_SESSION_INVALID: { code: 'OC005', message: '1C session is missing or expired', httpCode: 401 },
|
|
1714
|
+
ONE_C_EXCHANGE_FILE_MISSING: { code: 'OC006', message: '1C exchange file was not uploaded or has expired', httpCode: 404 },
|
|
1715
|
+
ONE_C_IMPORT_BUSY: { code: 'OC007', message: 'Another 1C catalog import is running for this company', httpCode: 409 },
|
|
1716
|
+
ONE_C_IMPORT_FAILED: { code: 'OC008', message: 'Failed to import 1C catalog', httpCode: 500 },
|
|
1717
|
+
ONE_C_ORDERS_EXPORT_FAILED: { code: 'OC009', message: 'Failed to export orders to 1C', httpCode: 500 },
|
|
1718
|
+
ONE_C_ORDERS_IMPORT_FAILED: { code: 'OC010', message: 'Failed to apply orders from 1C', httpCode: 500 },
|
|
1719
|
+
ONE_C_ACTOR_NOT_FOUND: { code: 'OC011', message: 'No company admin to attribute 1C changes to', httpCode: 409 },
|
|
1708
1720
|
|
|
1709
1721
|
// COMPANY INTEGRATION (общая запись интеграции компании)
|
|
1710
1722
|
COMPANY_INTEGRATION_FETCH_FAILED: { code: 'CINT001', message: 'Failed to read company integration', httpCode: 500 },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ClientForClientSchema } from './client-for-client.schema';
|
|
2
2
|
import { ClientIndividualProfileSchema } from './client-individual-profile.schema';
|
|
3
|
-
import {
|
|
3
|
+
import { ClientLegalProfileForClientSchema } from './client-legal-profile-for-client.schema';
|
|
4
4
|
import { UserContactForClientSchema } from '../user/user-contact-for-client.schema';
|
|
5
5
|
import { UserNameSchema } from '../user/user-name.schema';
|
|
6
6
|
import { DiscountRulesForClientSchema } from '../discount-rules/discount-rules-for-client.schema';
|
|
@@ -10,6 +10,6 @@ export const ClientExtendedForClientSchema = ClientForClientSchema.extend({
|
|
|
10
10
|
user: UserContactForClientSchema.nullable(),
|
|
11
11
|
responsibleUser: UserNameSchema.nullable(),
|
|
12
12
|
clientIndividualProfile: ClientIndividualProfileSchema.nullable(),
|
|
13
|
-
clientLegalProfile:
|
|
13
|
+
clientLegalProfile: ClientLegalProfileForClientSchema.nullable(),
|
|
14
14
|
discountRulesList: DiscountRulesForClientSchema.array(),
|
|
15
15
|
});
|
|
@@ -10,7 +10,9 @@ import { ClientSchema } from './client-base.schema';
|
|
|
10
10
|
export const ClientExtendedSchema = ClientSchema.extend({
|
|
11
11
|
user: UserSchema.nullable(),
|
|
12
12
|
clientIndividualProfile: ClientIndividualProfileSchema.nullable(),
|
|
13
|
+
// Основная карточка реквизитов; все карточки клиента, включая архивные, — в clientLegalProfileList.
|
|
13
14
|
clientLegalProfile: ClientLegalProfileSchema.nullable(),
|
|
15
|
+
clientLegalProfileList: ClientLegalProfileSchema.array(),
|
|
14
16
|
discountRulesList: DiscountRulesSchema.array().optional(),
|
|
15
17
|
orderCount: z.number(),
|
|
16
18
|
responsibleUser: UserSchema.nullable(),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ClientLegalProfileForClientSchema } from './client-legal-profile-for-client.schema';
|
|
3
|
+
|
|
4
|
+
export const ClientLegalProfileForClientResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: ClientLegalProfileForClientSchema.nullable(),
|
|
7
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ClientLegalTypeEnum } from '../../enum/client-legal-type.enum';
|
|
3
|
+
|
|
4
|
+
// Реквизиты покупателя на витрине. Подпись и флаги карточки — внутренние поля панели, наружу не отдаются.
|
|
5
|
+
export const ClientLegalProfileForClientSchema = z.object({
|
|
6
|
+
uuid: z.uuid(),
|
|
7
|
+
fullCompanyName: z.string().nullable(),
|
|
8
|
+
taxId: z.string().nullable(),
|
|
9
|
+
ogrn: z.string().nullable(),
|
|
10
|
+
ogrnip: z.string().nullable(),
|
|
11
|
+
kpp: z.string().nullable(),
|
|
12
|
+
bankName: z.string().nullable(),
|
|
13
|
+
bankAccountNumber: z.string().nullable(),
|
|
14
|
+
correspondentAccount: z.string().nullable(),
|
|
15
|
+
bankBic: z.string().nullable(),
|
|
16
|
+
directorName: z.string().nullable(),
|
|
17
|
+
directorPosition: z.string().nullable(),
|
|
18
|
+
directorAuthority: z.string().nullable(),
|
|
19
|
+
edoUsage: z.boolean(),
|
|
20
|
+
edoId: z.string().nullable(),
|
|
21
|
+
address: z.string().nullable(),
|
|
22
|
+
legalType: z.nativeEnum(ClientLegalTypeEnum),
|
|
23
|
+
createdAt: z.date(),
|
|
24
|
+
updatedAt: z.date(),
|
|
25
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ClientLegalProfileSchema } from './client-legal-profile.schema';
|
|
2
|
+
|
|
3
|
+
// Реквизиты карточки, которые пользователь заполняет сам: без служебных полей и флагов карточки.
|
|
4
|
+
export const ClientLegalProfileRequisitesSchema = ClientLegalProfileSchema.omit({
|
|
5
|
+
uuid: true,
|
|
6
|
+
label: true,
|
|
7
|
+
isDefault: true,
|
|
8
|
+
isArchived: true,
|
|
9
|
+
createdAt: true,
|
|
10
|
+
updatedAt: true,
|
|
11
|
+
}).extend({
|
|
12
|
+
correspondentAccount: ClientLegalProfileSchema.shape.correspondentAccount.optional(),
|
|
13
|
+
});
|
|
@@ -3,6 +3,9 @@ import { ClientLegalTypeEnum } from '../../enum';
|
|
|
3
3
|
|
|
4
4
|
export const ClientLegalProfileSchema = z.object({
|
|
5
5
|
uuid: z.uuid(),
|
|
6
|
+
label: z.string().nullable(),
|
|
7
|
+
isDefault: z.boolean(),
|
|
8
|
+
isArchived: z.boolean(),
|
|
6
9
|
fullCompanyName: z.string().nullable(),
|
|
7
10
|
taxId: z.string().nullable(),
|
|
8
11
|
ogrn: z.string().nullable(),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ClientLegalProfileSchema } from './client-legal-profile.schema';
|
|
3
|
+
import { ClientLegalProfileRequisitesSchema } from './client-legal-profile-requisites.schema';
|
|
4
|
+
|
|
5
|
+
export const CreateClientLegalProfileRequestSchema = ClientLegalProfileRequisitesSchema.extend({
|
|
6
|
+
label: ClientLegalProfileSchema.shape.label.optional(),
|
|
7
|
+
isDefault: z.boolean().optional(),
|
|
8
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { DeleteClientLegalProfileResultSchema } from './delete-client-legal-profile-result.schema';
|
|
3
|
+
|
|
4
|
+
export const DeleteClientLegalProfileResponseSchema = z.object({
|
|
5
|
+
message: z.string().optional(),
|
|
6
|
+
data: DeleteClientLegalProfileResultSchema,
|
|
7
|
+
});
|
package/schemas/client/index.ts
CHANGED
|
@@ -2,12 +2,24 @@ export * from './client.schema';
|
|
|
2
2
|
export * from './client-name.schema';
|
|
3
3
|
export * from './client-individual-profile.schema';
|
|
4
4
|
export * from './client-legal-profile.schema';
|
|
5
|
+
export * from './client-legal-profile-requisites.schema';
|
|
6
|
+
export * from './create-client-legal-profile-request.schema';
|
|
7
|
+
export * from './create-client-legal-profile-response.schema';
|
|
8
|
+
export * from './update-client-legal-profile-request.schema';
|
|
9
|
+
export * from './update-client-legal-profile-response.schema';
|
|
10
|
+
export * from './delete-client-legal-profile-request.schema';
|
|
11
|
+
export * from './delete-client-legal-profile-result.schema';
|
|
12
|
+
export * from './delete-client-legal-profile-response.schema';
|
|
13
|
+
export * from './get-client-legal-profile-list-request.schema';
|
|
14
|
+
export * from './get-client-legal-profile-list-response.schema';
|
|
5
15
|
export * from './client-marking.schema';
|
|
6
16
|
export * from './client-debt.schema';
|
|
7
17
|
export * from './client-responsible-assignment.schema';
|
|
8
18
|
export * from './client-responsible-assignment-result.schema';
|
|
9
19
|
export * from './client-for-client.schema';
|
|
10
20
|
export * from './client-extended-for-client.schema';
|
|
21
|
+
export * from './client-legal-profile-for-client.schema';
|
|
22
|
+
export * from './client-legal-profile-for-client-response.schema';
|
|
11
23
|
export * from './get-client-me-webshop-response.schema';
|
|
12
24
|
export * from './register-client-webshop-request.schema';
|
|
13
25
|
export * from './register-client-webshop-response.schema';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ClientLegalProfileSchema } from './client-legal-profile.schema';
|
|
3
|
+
import { ClientLegalProfileRequisitesSchema } from './client-legal-profile-requisites.schema';
|
|
4
|
+
|
|
5
|
+
// Правка частичная: поле, которого нет в запросе, не меняется, null — очищает. Так карточку можно сделать
|
|
6
|
+
// основной или убрать в архив, не пересылая реквизиты.
|
|
7
|
+
export const UpdateClientLegalProfileRequestSchema = ClientLegalProfileRequisitesSchema.partial().extend({
|
|
8
|
+
label: ClientLegalProfileSchema.shape.label.optional(),
|
|
9
|
+
isDefault: z.boolean().optional(),
|
|
10
|
+
isArchived: z.boolean().optional(),
|
|
11
|
+
});
|
package/schemas/index.ts
CHANGED
|
@@ -71,6 +71,8 @@ export * from './package/validate-package.schema';
|
|
|
71
71
|
export * from './pagination-request.schema';
|
|
72
72
|
export * from './parser';
|
|
73
73
|
export * from './payment-invoice/payment-invoice.schema';
|
|
74
|
+
export * from './payment-invoice/create-payment-invoice-request.schema';
|
|
75
|
+
export * from './payment-invoice/create-payment-invoice-response.schema';
|
|
74
76
|
export * from './positive-decimal4.schema';
|
|
75
77
|
export * from './positive-money.schema';
|
|
76
78
|
export * from './pre-order';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PositiveMoneySchema } from '../positive-money.schema';
|
|
3
|
+
|
|
4
|
+
// Потолок числа заказов в счёте. Это защита от абсурдного запроса, а не бизнес-правило: счёт за месяц
|
|
5
|
+
// клиенту с ежедневными поставками — это уже 30 строк, поэтому 10-20 отрезали бы живые сценарии.
|
|
6
|
+
// Сто строк — это 3-4 страницы таблицы, документ такого размера собирается и читается нормально.
|
|
7
|
+
const MAX_INVOICE_ORDER_COUNT = 100;
|
|
8
|
+
|
|
9
|
+
// Счёт выставляется одним из двух способов:
|
|
10
|
+
// - по заказам: orderUUIDs непустой, итог считается на бэке как сумма totalCost этих заказов,
|
|
11
|
+
// а amount — необязательная правка итога (например скидка по счёту), она уходит отдельной строкой;
|
|
12
|
+
// - вручную: orderUUIDs пуст, тогда amount обязателен и становится единственной строкой счёта.
|
|
13
|
+
export const CreatePaymentInvoiceRequestSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
clientUUID: z.uuid(),
|
|
16
|
+
// Карточка реквизитов покупателя. Не передана — счёт выписывается на основную карточку клиента.
|
|
17
|
+
clientLegalProfileUUID: z.uuid().optional(),
|
|
18
|
+
invoiceDate: z.coerce.date(),
|
|
19
|
+
orderUUIDs: z.uuid().array().max(MAX_INVOICE_ORDER_COUNT).optional(),
|
|
20
|
+
// Строго положительная сумма: отсекаем минус по знаку строки и нулевые записи вида "0" / "0.00".
|
|
21
|
+
amount: PositiveMoneySchema.optional(),
|
|
22
|
+
})
|
|
23
|
+
.refine(value => Boolean(value.orderUUIDs?.length) || value.amount !== undefined, {
|
|
24
|
+
message: 'Either orderUUIDs or amount must be provided',
|
|
25
|
+
path: ['amount'],
|
|
26
|
+
});
|
|
@@ -21,6 +21,8 @@ export const PaymentInvoiceSchema = z.object({
|
|
|
21
21
|
remainingAmount: MoneySchema,
|
|
22
22
|
status: z.nativeEnum(PaymentInvoiceStatusEnum),
|
|
23
23
|
clientUUID: z.string(),
|
|
24
|
+
// Карточка реквизитов, на которую выписан счёт; null — у старых счетов и у клиентов без карточек.
|
|
25
|
+
clientLegalProfileUUID: z.string().nullable(),
|
|
24
26
|
clientName: z.string(),
|
|
25
27
|
contractNumber: z.string().nullable(),
|
|
26
28
|
contractDate: z.coerce.date().nullable(),
|