@floristcloud/api-lib 1.2.57 → 1.2.58
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/transaction/import-transaction.command.js +32 -0
- package/build/commands/transaction/index.js +1 -0
- package/build/constant/error-i18n-key.js +3 -0
- package/build/constant/error.js +8 -0
- package/build/constant/import.constant.js +2 -1
- package/build/enum/index.js +2 -0
- package/build/enum/transaction-import-entity-property.enum.js +16 -0
- package/build/enum/transaction-import-errors.enum.js +13 -0
- package/commands/transaction/import-transaction.command.ts +38 -0
- package/commands/transaction/index.ts +1 -0
- package/constant/error-i18n-key.ts +3 -0
- package/constant/error.ts +8 -0
- package/constant/import.constant.ts +1 -0
- package/enum/index.ts +2 -0
- package/enum/transaction-import-entity-property.enum.ts +12 -0
- package/enum/transaction-import-errors.enum.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImportTransactionContractCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const schemas_1 = require("../../schemas");
|
|
6
|
+
const enum_1 = require("../../enum");
|
|
7
|
+
const ImportTransactionRequestSchema = zod_1.z.object({});
|
|
8
|
+
const TransactionImportRowErrorSchema = zod_1.z.object({
|
|
9
|
+
row: zod_1.z.number(),
|
|
10
|
+
errors: zod_1.z.array(zod_1.z.object({
|
|
11
|
+
path: zod_1.z.nativeEnum(enum_1.TransactionImportEntityPropertyEnum).optional(),
|
|
12
|
+
type: zod_1.z.nativeEnum(enum_1.TransactionImportErrorsEnum),
|
|
13
|
+
})),
|
|
14
|
+
});
|
|
15
|
+
const TransactionImportCreatedRowSchema = zod_1.z.object({
|
|
16
|
+
row: zod_1.z.number(),
|
|
17
|
+
uuid: zod_1.z.string(),
|
|
18
|
+
});
|
|
19
|
+
const ImportTransactionResponseSchema = zod_1.z.object({
|
|
20
|
+
message: zod_1.z.string().optional(),
|
|
21
|
+
data: zod_1.z.object({
|
|
22
|
+
rows: zod_1.z.number(),
|
|
23
|
+
created: zod_1.z.array(TransactionImportCreatedRowSchema),
|
|
24
|
+
errors: zod_1.z.array(TransactionImportRowErrorSchema),
|
|
25
|
+
globalErrors: zod_1.z.array(schemas_1.ErrorMessageSchema).optional(),
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
var ImportTransactionContractCommand;
|
|
29
|
+
(function (ImportTransactionContractCommand) {
|
|
30
|
+
ImportTransactionContractCommand.RequestSchema = ImportTransactionRequestSchema;
|
|
31
|
+
ImportTransactionContractCommand.ResponseSchema = ImportTransactionResponseSchema;
|
|
32
|
+
})(ImportTransactionContractCommand || (exports.ImportTransactionContractCommand = ImportTransactionContractCommand = {}));
|
|
@@ -26,3 +26,4 @@ __exportStar(require("./update-transaction.command"), exports);
|
|
|
26
26
|
__exportStar(require("./get-transaction-summary.query"), exports);
|
|
27
27
|
__exportStar(require("./generate-pre-payment-check.command"), exports);
|
|
28
28
|
__exportStar(require("./apply-prepayment-transaction.command"), exports);
|
|
29
|
+
__exportStar(require("./import-transaction.command"), exports);
|
|
@@ -22,4 +22,7 @@ exports.ErrorI18nKey = {
|
|
|
22
22
|
clientImportTooManyRows: 'clientImport.tooManyRows',
|
|
23
23
|
clientImportInvalidFileFormat: 'clientImport.invalidFileFormat',
|
|
24
24
|
clientImportMissingRequiredColumns: 'clientImport.missingRequiredColumns',
|
|
25
|
+
transactionImportTooManyRows: 'transactionImport.tooManyRows',
|
|
26
|
+
transactionImportInvalidFileFormat: 'transactionImport.invalidFileFormat',
|
|
27
|
+
transactionImportMissingRequiredColumns: 'transactionImport.missingRequiredColumns',
|
|
25
28
|
};
|
package/build/constant/error.js
CHANGED
|
@@ -465,6 +465,14 @@ exports.ERRORS = {
|
|
|
465
465
|
TRANSACTION_NOT_APPLIED: { code: 'TR011', message: 'Transaction not applied', httpCode: 500 },
|
|
466
466
|
MONEY_ACCOUNT_REQUIRED: { code: 'TR012', message: 'moneyAccountUUID is required to apply bank payment event', httpCode: 400 },
|
|
467
467
|
TRANSACTION_CREATE_FAILED: { code: 'TR013', message: 'Failed to create transaction', httpCode: 500 },
|
|
468
|
+
TRANSACTION_IMPORT_FAILED: { code: 'TR014', message: 'Ошибка при импорте транзакций', httpCode: 400 },
|
|
469
|
+
TRANSACTION_IMPORT_TOO_MANY_ROWS: { code: 'TR015', message: 'Too many rows for transaction import', httpCode: 400 },
|
|
470
|
+
TRANSACTION_IMPORT_INVALID_FILE_FORMAT: { code: 'TR016', message: 'Invalid file format for transaction import', httpCode: 400 },
|
|
471
|
+
TRANSACTION_IMPORT_MISSING_REQUIRED_COLUMNS: {
|
|
472
|
+
code: 'TR017',
|
|
473
|
+
message: 'Missing required columns in transaction import file',
|
|
474
|
+
httpCode: 400,
|
|
475
|
+
},
|
|
468
476
|
// CLIENT_PAYMENT_IDENTIFIER
|
|
469
477
|
CLIENT_PAYMENT_IDENTIFIER_NOT_CREATED: { code: 'CPI001', message: 'Failed to create client payment identifier', httpCode: 500 },
|
|
470
478
|
CLIENT_PAYMENT_IDENTIFIER_NOT_DELETED: { code: 'CPI002', message: 'Failed to delete client payment identifier', httpCode: 500 },
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CONSIGNMENT_IMPORT_LIMITS = exports.CLIENT_IMPORT_MAX_ROWS = exports.SPREADSHEET_IMPORT_MAX_FILE_SIZE_BYTES = void 0;
|
|
3
|
+
exports.CONSIGNMENT_IMPORT_LIMITS = exports.TRANSACTION_IMPORT_MAX_ROWS = exports.CLIENT_IMPORT_MAX_ROWS = exports.SPREADSHEET_IMPORT_MAX_FILE_SIZE_BYTES = void 0;
|
|
4
4
|
exports.SPREADSHEET_IMPORT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
5
5
|
exports.CLIENT_IMPORT_MAX_ROWS = 1000;
|
|
6
|
+
exports.TRANSACTION_IMPORT_MAX_ROWS = 1000;
|
|
6
7
|
exports.CONSIGNMENT_IMPORT_LIMITS = {
|
|
7
8
|
MAX_ROWS_WITHOUT_IMAGES: 1200,
|
|
8
9
|
MAX_ROWS_WITH_FIND_IMAGE: 500,
|
package/build/enum/index.js
CHANGED
|
@@ -64,6 +64,8 @@ __exportStar(require("./sales-unit.enum"), exports);
|
|
|
64
64
|
__exportStar(require("./sales-by-position-group-by.enum"), exports);
|
|
65
65
|
__exportStar(require("./client-import-entity-property.enum"), exports);
|
|
66
66
|
__exportStar(require("./client-import-errors.enum"), exports);
|
|
67
|
+
__exportStar(require("./transaction-import-entity-property.enum"), exports);
|
|
68
|
+
__exportStar(require("./transaction-import-errors.enum"), exports);
|
|
67
69
|
__exportStar(require("./pre-order-collection-item-import-entity-property.enum"), exports);
|
|
68
70
|
__exportStar(require("./report-period-type.enum"), exports);
|
|
69
71
|
__exportStar(require("./inventory-movement-type.enum"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionImportEntityPropertyEnum = void 0;
|
|
4
|
+
var TransactionImportEntityPropertyEnum;
|
|
5
|
+
(function (TransactionImportEntityPropertyEnum) {
|
|
6
|
+
TransactionImportEntityPropertyEnum["CLIENT_NAME"] = "clientName";
|
|
7
|
+
TransactionImportEntityPropertyEnum["CLIENT_PHONE"] = "clientPhone";
|
|
8
|
+
TransactionImportEntityPropertyEnum["CLIENT_TAX_ID"] = "clientTaxId";
|
|
9
|
+
TransactionImportEntityPropertyEnum["CLIENT_EMAIL"] = "clientEmail";
|
|
10
|
+
TransactionImportEntityPropertyEnum["CLIENT_CODE"] = "clientCode";
|
|
11
|
+
TransactionImportEntityPropertyEnum["MONEY_ACCOUNT"] = "moneyAccount";
|
|
12
|
+
TransactionImportEntityPropertyEnum["AMOUNT"] = "amount";
|
|
13
|
+
TransactionImportEntityPropertyEnum["TYPE"] = "type";
|
|
14
|
+
TransactionImportEntityPropertyEnum["DATE"] = "date";
|
|
15
|
+
TransactionImportEntityPropertyEnum["COMMENT"] = "comment";
|
|
16
|
+
})(TransactionImportEntityPropertyEnum || (exports.TransactionImportEntityPropertyEnum = TransactionImportEntityPropertyEnum = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionImportErrorsEnum = void 0;
|
|
4
|
+
var TransactionImportErrorsEnum;
|
|
5
|
+
(function (TransactionImportErrorsEnum) {
|
|
6
|
+
TransactionImportErrorsEnum["REQUIRED"] = "REQUIRED";
|
|
7
|
+
TransactionImportErrorsEnum["INVALID_VALUE"] = "INVALID_VALUE";
|
|
8
|
+
TransactionImportErrorsEnum["CLIENT_NOT_FOUND"] = "CLIENT_NOT_FOUND";
|
|
9
|
+
TransactionImportErrorsEnum["CLIENT_AMBIGUOUS"] = "CLIENT_AMBIGUOUS";
|
|
10
|
+
TransactionImportErrorsEnum["MONEY_ACCOUNT_NOT_FOUND"] = "MONEY_ACCOUNT_NOT_FOUND";
|
|
11
|
+
TransactionImportErrorsEnum["MONEY_ACCOUNT_AMBIGUOUS"] = "MONEY_ACCOUNT_AMBIGUOUS";
|
|
12
|
+
TransactionImportErrorsEnum["CREATE_FAILED"] = "CREATE_FAILED";
|
|
13
|
+
})(TransactionImportErrorsEnum || (exports.TransactionImportErrorsEnum = TransactionImportErrorsEnum = {}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ErrorMessageSchema } from '../../schemas';
|
|
3
|
+
import { TransactionImportEntityPropertyEnum, TransactionImportErrorsEnum } from '../../enum';
|
|
4
|
+
|
|
5
|
+
const ImportTransactionRequestSchema = z.object({});
|
|
6
|
+
|
|
7
|
+
const TransactionImportRowErrorSchema = z.object({
|
|
8
|
+
row: z.number(),
|
|
9
|
+
errors: z.array(
|
|
10
|
+
z.object({
|
|
11
|
+
path: z.nativeEnum(TransactionImportEntityPropertyEnum).optional(),
|
|
12
|
+
type: z.nativeEnum(TransactionImportErrorsEnum),
|
|
13
|
+
}),
|
|
14
|
+
),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const TransactionImportCreatedRowSchema = z.object({
|
|
18
|
+
row: z.number(),
|
|
19
|
+
uuid: z.string(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const ImportTransactionResponseSchema = z.object({
|
|
23
|
+
message: z.string().optional(),
|
|
24
|
+
data: z.object({
|
|
25
|
+
rows: z.number(),
|
|
26
|
+
created: z.array(TransactionImportCreatedRowSchema),
|
|
27
|
+
errors: z.array(TransactionImportRowErrorSchema),
|
|
28
|
+
globalErrors: z.array(ErrorMessageSchema).optional(),
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export namespace ImportTransactionContractCommand {
|
|
33
|
+
export const RequestSchema = ImportTransactionRequestSchema;
|
|
34
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
35
|
+
|
|
36
|
+
export const ResponseSchema = ImportTransactionResponseSchema;
|
|
37
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
38
|
+
}
|
|
@@ -19,6 +19,9 @@ export const ErrorI18nKey = {
|
|
|
19
19
|
clientImportTooManyRows: 'clientImport.tooManyRows',
|
|
20
20
|
clientImportInvalidFileFormat: 'clientImport.invalidFileFormat',
|
|
21
21
|
clientImportMissingRequiredColumns: 'clientImport.missingRequiredColumns',
|
|
22
|
+
transactionImportTooManyRows: 'transactionImport.tooManyRows',
|
|
23
|
+
transactionImportInvalidFileFormat: 'transactionImport.invalidFileFormat',
|
|
24
|
+
transactionImportMissingRequiredColumns: 'transactionImport.missingRequiredColumns',
|
|
22
25
|
} as const;
|
|
23
26
|
|
|
24
27
|
export type ErrorI18nKeyType = (typeof ErrorI18nKey)[keyof typeof ErrorI18nKey];
|
package/constant/error.ts
CHANGED
|
@@ -482,6 +482,14 @@ export const ERRORS = {
|
|
|
482
482
|
TRANSACTION_NOT_APPLIED: { code: 'TR011', message: 'Transaction not applied', httpCode: 500 },
|
|
483
483
|
MONEY_ACCOUNT_REQUIRED: { code: 'TR012', message: 'moneyAccountUUID is required to apply bank payment event', httpCode: 400 },
|
|
484
484
|
TRANSACTION_CREATE_FAILED: { code: 'TR013', message: 'Failed to create transaction', httpCode: 500 },
|
|
485
|
+
TRANSACTION_IMPORT_FAILED: { code: 'TR014', message: 'Ошибка при импорте транзакций', httpCode: 400 },
|
|
486
|
+
TRANSACTION_IMPORT_TOO_MANY_ROWS: { code: 'TR015', message: 'Too many rows for transaction import', httpCode: 400 },
|
|
487
|
+
TRANSACTION_IMPORT_INVALID_FILE_FORMAT: { code: 'TR016', message: 'Invalid file format for transaction import', httpCode: 400 },
|
|
488
|
+
TRANSACTION_IMPORT_MISSING_REQUIRED_COLUMNS: {
|
|
489
|
+
code: 'TR017',
|
|
490
|
+
message: 'Missing required columns in transaction import file',
|
|
491
|
+
httpCode: 400,
|
|
492
|
+
},
|
|
485
493
|
|
|
486
494
|
// CLIENT_PAYMENT_IDENTIFIER
|
|
487
495
|
CLIENT_PAYMENT_IDENTIFIER_NOT_CREATED: { code: 'CPI001', message: 'Failed to create client payment identifier', httpCode: 500 },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const SPREADSHEET_IMPORT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;
|
|
2
2
|
export const CLIENT_IMPORT_MAX_ROWS = 1000;
|
|
3
|
+
export const TRANSACTION_IMPORT_MAX_ROWS = 1000;
|
|
3
4
|
export const CONSIGNMENT_IMPORT_LIMITS = {
|
|
4
5
|
MAX_ROWS_WITHOUT_IMAGES: 1200,
|
|
5
6
|
MAX_ROWS_WITH_FIND_IMAGE: 500,
|
package/enum/index.ts
CHANGED
|
@@ -48,6 +48,8 @@ export * from './sales-unit.enum';
|
|
|
48
48
|
export * from './sales-by-position-group-by.enum';
|
|
49
49
|
export * from './client-import-entity-property.enum';
|
|
50
50
|
export * from './client-import-errors.enum';
|
|
51
|
+
export * from './transaction-import-entity-property.enum';
|
|
52
|
+
export * from './transaction-import-errors.enum';
|
|
51
53
|
export * from './pre-order-collection-item-import-entity-property.enum';
|
|
52
54
|
export * from './report-period-type.enum';
|
|
53
55
|
export * from './inventory-movement-type.enum';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export enum TransactionImportEntityPropertyEnum {
|
|
2
|
+
CLIENT_NAME = 'clientName',
|
|
3
|
+
CLIENT_PHONE = 'clientPhone',
|
|
4
|
+
CLIENT_TAX_ID = 'clientTaxId',
|
|
5
|
+
CLIENT_EMAIL = 'clientEmail',
|
|
6
|
+
CLIENT_CODE = 'clientCode',
|
|
7
|
+
MONEY_ACCOUNT = 'moneyAccount',
|
|
8
|
+
AMOUNT = 'amount',
|
|
9
|
+
TYPE = 'type',
|
|
10
|
+
DATE = 'date',
|
|
11
|
+
COMMENT = 'comment',
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export enum TransactionImportErrorsEnum {
|
|
2
|
+
REQUIRED = 'REQUIRED',
|
|
3
|
+
INVALID_VALUE = 'INVALID_VALUE',
|
|
4
|
+
CLIENT_NOT_FOUND = 'CLIENT_NOT_FOUND',
|
|
5
|
+
CLIENT_AMBIGUOUS = 'CLIENT_AMBIGUOUS',
|
|
6
|
+
MONEY_ACCOUNT_NOT_FOUND = 'MONEY_ACCOUNT_NOT_FOUND',
|
|
7
|
+
MONEY_ACCOUNT_AMBIGUOUS = 'MONEY_ACCOUNT_AMBIGUOUS',
|
|
8
|
+
CREATE_FAILED = 'CREATE_FAILED',
|
|
9
|
+
}
|