@floristcloud/api-lib 1.2.96 → 1.2.98

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.
Files changed (117) hide show
  1. package/build/commands/account-deletion-request/initiate-public-account-deletion.command.js +2 -0
  2. package/build/commands/action-log/get-action-log-list-for-client.query.js +1 -1
  3. package/build/commands/action-log/get-action-log-list.query.js +1 -1
  4. package/build/commands/auth/list-mobile-buyer-tenants.command.js +2 -2
  5. package/build/commands/auth/reset-password-by-token.command.js +1 -1
  6. package/build/commands/bank-payment/get-bank-payment-list.query.js +1 -1
  7. package/build/commands/consignment/execute-consignment-product-update.command.js +2 -2
  8. package/build/commands/consignment/get-consignment-list.query.js +1 -1
  9. package/build/commands/discount-rules/remove-consignment-discount.command.js +1 -1
  10. package/build/commands/discount-rules/set-consignment-discount.command.js +1 -1
  11. package/build/commands/employee-schedule/get-employee-schedule-list.query.js +1 -1
  12. package/build/commands/order/get-order-list.query.js +2 -1
  13. package/build/commands/order/group/merge-orders.command.js +1 -1
  14. package/build/commands/order/webshop/get-order-list-for-client.query.js +3 -3
  15. package/build/commands/order-product/group/price-correction-analyze.command.js +1 -1
  16. package/build/commands/order-product/webshop/create-order-product-for-client.command.js +1 -1
  17. package/build/commands/pre-order/group/analyze-copy-pre-orders.command.js +1 -1
  18. package/build/commands/pre-order/group/analyze-create-pre-orders-from-standing-orders.command.js +1 -1
  19. package/build/commands/pre-order/group/group-copy-pre-orders-to-collection.command.js +3 -2
  20. package/build/commands/pre-order/group/group-create-pre-orders-from-standing-orders.command.js +1 -1
  21. package/build/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.js +2 -2
  22. package/build/commands/product/group/delete-group-product.command.js +2 -3
  23. package/build/commands/product/group/update-group-product-update-batch.command.js +2 -2
  24. package/build/commands/report/export-client-statement.query.js +1 -1
  25. package/build/commands/report/export-inventory-movement.query.js +1 -1
  26. package/build/commands/report/export-inventory-turnover.query.js +1 -1
  27. package/build/commands/report/export-sales-by-client.query.js +2 -2
  28. package/build/commands/report/export-sales-by-position.query.js +2 -2
  29. package/build/commands/report/export-sales-revenue.query.js +1 -1
  30. package/build/commands/report/get-daily-orders-summary.query.js +2 -2
  31. package/build/commands/report/get-report-by-client-weeks.query.js +1 -1
  32. package/build/commands/report/get-report-for-period.query.js +1 -1
  33. package/build/commands/report/get-report-group-by-client.query.js +1 -1
  34. package/build/commands/report/get-report-group-by-position.query.js +1 -1
  35. package/build/commands/report/get-sales-summary.query.js +1 -1
  36. package/build/commands/transaction/export-transactions.command.js +1 -1
  37. package/build/commands/transaction/get-sum-transaction-by-money-account.query.js +1 -1
  38. package/build/commands/transaction/get-transaction-list.query.js +1 -1
  39. package/build/commands/transaction/get-transaction-summary.query.js +1 -1
  40. package/build/commands/transaction/webshop/get-transaction-list-for-client.query.js +1 -1
  41. package/build/commands/user/createUser.command.js +2 -0
  42. package/build/commands/user/createUserByClientId.command.js +3 -1
  43. package/build/commands/user/createUserForCompany.command.js +3 -1
  44. package/build/commands/work-session/export-overtime.query.js +1 -1
  45. package/build/commands/write-off/create-write-off-from-pending.command.js +1 -1
  46. package/build/commands/write-off/get-write-off-list.query.js +1 -1
  47. package/build/commands/write-off/update-write-off-status.command.js +1 -1
  48. package/build/constant/error-i18n-key.js +43 -0
  49. package/build/constant/error.js +113 -14
  50. package/build/constant/index.js +2 -0
  51. package/build/constant/validation-i18n-key.js +39 -0
  52. package/build/constant/validation-i18n-message.js +47 -0
  53. package/build/constant/verbose.js +11 -10
  54. package/build/schemas/api-error.schema.js +32 -0
  55. package/build/schemas/consignment-transfer/accept-consignment-transfer.schema.js +1 -1
  56. package/build/schemas/index.js +1 -0
  57. package/build/schemas/order-service-line/order-service-line.schema.js +1 -1
  58. package/build/schemas/pre-order/pre-order-copy.schema.js +2 -1
  59. package/commands/account-deletion-request/initiate-public-account-deletion.command.ts +2 -0
  60. package/commands/action-log/get-action-log-list-for-client.query.ts +1 -1
  61. package/commands/action-log/get-action-log-list.query.ts +1 -1
  62. package/commands/auth/list-mobile-buyer-tenants.command.ts +2 -2
  63. package/commands/auth/reset-password-by-token.command.ts +1 -1
  64. package/commands/bank-payment/get-bank-payment-list.query.ts +1 -1
  65. package/commands/consignment/execute-consignment-product-update.command.ts +2 -2
  66. package/commands/consignment/get-consignment-list.query.ts +1 -1
  67. package/commands/discount-rules/remove-consignment-discount.command.ts +1 -1
  68. package/commands/discount-rules/set-consignment-discount.command.ts +1 -1
  69. package/commands/employee-schedule/get-employee-schedule-list.query.ts +1 -1
  70. package/commands/order/get-order-list.query.ts +2 -1
  71. package/commands/order/group/merge-orders.command.ts +1 -1
  72. package/commands/order/webshop/get-order-list-for-client.query.ts +3 -3
  73. package/commands/order-product/group/price-correction-analyze.command.ts +1 -1
  74. package/commands/order-product/webshop/create-order-product-for-client.command.ts +1 -1
  75. package/commands/pre-order/group/analyze-copy-pre-orders.command.ts +2 -2
  76. package/commands/pre-order/group/analyze-create-pre-orders-from-standing-orders.command.ts +2 -1
  77. package/commands/pre-order/group/group-copy-pre-orders-to-collection.command.ts +3 -2
  78. package/commands/pre-order/group/group-create-pre-orders-from-standing-orders.command.ts +2 -2
  79. package/commands/pre-order-collection-item/execute-pre-order-collection-item-update.command.ts +2 -2
  80. package/commands/product/group/delete-group-product.command.ts +4 -5
  81. package/commands/product/group/update-group-product-update-batch.command.ts +2 -2
  82. package/commands/report/export-client-statement.query.ts +1 -1
  83. package/commands/report/export-inventory-movement.query.ts +1 -1
  84. package/commands/report/export-inventory-turnover.query.ts +1 -1
  85. package/commands/report/export-sales-by-client.query.ts +2 -2
  86. package/commands/report/export-sales-by-position.query.ts +2 -2
  87. package/commands/report/export-sales-revenue.query.ts +1 -1
  88. package/commands/report/get-daily-orders-summary.query.ts +2 -2
  89. package/commands/report/get-report-by-client-weeks.query.ts +1 -1
  90. package/commands/report/get-report-for-period.query.ts +1 -1
  91. package/commands/report/get-report-group-by-client.query.ts +1 -1
  92. package/commands/report/get-report-group-by-position.query.ts +3 -3
  93. package/commands/report/get-sales-summary.query.ts +1 -1
  94. package/commands/transaction/export-transactions.command.ts +1 -1
  95. package/commands/transaction/get-sum-transaction-by-money-account.query.ts +1 -1
  96. package/commands/transaction/get-transaction-list.query.ts +1 -1
  97. package/commands/transaction/get-transaction-summary.query.ts +1 -1
  98. package/commands/transaction/webshop/get-transaction-list-for-client.query.ts +1 -1
  99. package/commands/user/createUser.command.ts +2 -0
  100. package/commands/user/createUserByClientId.command.ts +3 -1
  101. package/commands/user/createUserForCompany.command.ts +3 -1
  102. package/commands/work-session/export-overtime.query.ts +4 -7
  103. package/commands/write-off/create-write-off-from-pending.command.ts +1 -1
  104. package/commands/write-off/get-write-off-list.query.ts +1 -1
  105. package/commands/write-off/update-write-off-status.command.ts +1 -1
  106. package/constant/error-i18n-key.ts +53 -0
  107. package/constant/error.ts +116 -14
  108. package/constant/index.ts +2 -0
  109. package/constant/validation-i18n-key.ts +38 -0
  110. package/constant/validation-i18n-message.ts +46 -0
  111. package/constant/verbose.ts +12 -11
  112. package/package.json +1 -1
  113. package/schemas/api-error.schema.ts +34 -0
  114. package/schemas/consignment-transfer/accept-consignment-transfer.schema.ts +1 -1
  115. package/schemas/index.ts +1 -0
  116. package/schemas/order-service-line/order-service-line.schema.ts +1 -1
  117. package/schemas/pre-order/pre-order-copy.schema.ts +2 -1
@@ -29,4 +29,47 @@ exports.ErrorI18nKey = {
29
29
  preOrderCollectionItemImportInvalidFileFormat: 'preOrderCollectionItemImport.invalidFileFormat',
30
30
  preOrderCollectionItemImportMissingRequiredColumns: 'preOrderCollectionItemImport.missingRequiredColumns',
31
31
  preOrderCollectionItemImportFailed: 'preOrderCollectionItemImport.failed',
32
+ // Bulk / group operations
33
+ bulkBatchTooLarge: 'bulk.batchTooLarge',
34
+ bulkProductNotFound: 'bulk.productNotFound',
35
+ bulkProductNotInConsignment: 'bulk.productNotInConsignment',
36
+ bulkProductUpdateFailed: 'bulk.productUpdateFailed',
37
+ bulkProductDeleteFailed: 'bulk.productDeleteFailed',
38
+ bulkProductInOrder: 'bulk.productInOrder',
39
+ bulkItemUpdateFailed: 'bulk.itemUpdateFailed',
40
+ bulkUuidNotProvided: 'bulk.uuidNotProvided',
41
+ // Pre-order → order conversion warnings
42
+ preOrderConvertProductNotFound: 'preOrderConvert.productNotFound',
43
+ preOrderConvertNotDistributed: 'preOrderConvert.notDistributed',
44
+ preOrderConvertAlreadyExists: 'preOrderConvert.alreadyExists',
45
+ // Category determination (import)
46
+ categoryNotDetermined: 'category.notDetermined',
47
+ // Standing-order import
48
+ standingOrderClientNotFound: 'standingOrderImport.clientNotFound',
49
+ standingOrderCategoryNotFound: 'standingOrderImport.categoryNotFound',
50
+ // Standing-order → pre-order conversion per-item warnings
51
+ soItemNotLinkedToCatalog: 'preOrderFromStandingOrder.itemNotLinkedToCatalog',
52
+ soItemNoMatches: 'preOrderFromStandingOrder.itemNoMatches',
53
+ soItemInsufficientQuantity: 'preOrderFromStandingOrder.itemInsufficientQuantity',
54
+ soItemPartiallyAllocated: 'preOrderFromStandingOrder.itemPartiallyAllocated',
55
+ soItemNotAddedInCollection: 'preOrderFromStandingOrder.itemNotAddedInCollection',
56
+ soProductNotCreated: 'preOrderFromStandingOrder.productNotCreated',
57
+ soCriticalError: 'preOrderFromStandingOrder.criticalError',
58
+ soNoPreOrdersCreated: 'preOrderFromStandingOrder.noPreOrdersCreated',
59
+ // Copy pre-order per-item warnings
60
+ preOrderCopyItemNoMatches: 'preOrderCopy.itemNoMatches',
61
+ preOrderCopyItemInsufficientQuantity: 'preOrderCopy.itemInsufficientQuantity',
62
+ preOrderCopySourceNotFoundOrEmpty: 'preOrderCopy.sourceNotFoundOrEmpty',
63
+ preOrderCopyProductCreateFailed: 'preOrderCopy.productCreateFailed',
64
+ // Auth
65
+ authTooManyFailedAttempts: 'auth.tooManyFailedAttempts',
66
+ // Order merge / move guards
67
+ mergeOrderTargetInSourceList: 'mergeOrder.targetInSourceList',
68
+ moveItemsSameOrder: 'moveItems.sameOrder',
69
+ // Invoice notification generation
70
+ invoiceNotificationInvalidType: 'invoiceNotification.invalidType',
71
+ invoiceNotificationOrderUuidMissing: 'invoiceNotification.orderUuidMissing',
72
+ // Neutral success
73
+ operationSuccess: 'common.operationSuccess',
74
+ accountDeletionRequestSubmitted: 'accountDeletionRequest.submitted',
32
75
  };
@@ -29,7 +29,7 @@ exports.ERRORS = {
29
29
  NOTIFICATION_NOT_UPDATED: { code: 'N003', message: 'Failed to update Notification', httpCode: 500 },
30
30
  NOTIFICATION_FETCH_FAILED: { code: 'N004', message: 'Error when retrieving a notification', httpCode: 500 },
31
31
  NOTIFICATION_MAX_RETRIES_REACHED: {
32
- code: 'N004',
32
+ code: 'N009',
33
33
  message: 'Maximum retry attempts reached for notification',
34
34
  httpCode: 500,
35
35
  },
@@ -82,6 +82,8 @@ exports.ERRORS = {
82
82
  SETTINGS_NOT_FOUND: { code: 'S005', message: 'Settings not found', httpCode: 404 },
83
83
  SETTINGS_FETCH_FAILED: { code: 'S006', message: 'Error when retrieving a Settings', httpCode: 500 },
84
84
  FORBIDDEN_API: { code: 'A011', message: 'Access denied', httpCode: 403 },
85
+ RESOURCE_ACCESS_DENIED: { code: 'A022', message: 'Resource does not belong to your company', httpCode: 400 },
86
+ RESOURCE_NOT_FOUND: { code: 'A023', message: 'Resource not found', httpCode: 404 },
85
87
  FAILED_TO_DEFINE_ROLE: { code: 'A008', message: 'User role could not be determined', httpCode: 400 },
86
88
  ACCOUNT_WITH_PAYLOAD_NOT_FOUND: { code: 'A016', message: 'Account not be found based on information from the token', httpCode: 404 },
87
89
  ORIGIN_HEADER_NOT_FOUND: { code: 'H001', message: 'Origin header of the user current address was not found', httpCode: 404 },
@@ -96,12 +98,14 @@ exports.ERRORS = {
96
98
  USER_UPDATE_FAILED: { code: 'U009', message: 'Failed to update user', httpCode: 400 },
97
99
  USER_LIST_FETCH_FAILED: { code: 'U010', message: 'Failed fetching user list', httpCode: 500 },
98
100
  USER_NO_BELONGS_COMPANY: { code: 'U011', message: 'This user does not belongs to the company ', httpCode: 403 },
99
- USER_MISSING_EMAIL_OR_PHONE: { code: 'U012', message: 'Не указан email или телефон ', httpCode: 400 },
101
+ USER_MISSING_EMAIL_OR_PHONE: { code: 'U012', message: 'Email or phone is required', httpCode: 400 },
100
102
  USER_ROLE_MISMATCH_CLIENT: { code: 'U013', message: 'User does not have BUYER role required for client login', httpCode: 403 },
101
103
  USER_ROLE_MISMATCH_EMPLOYEE: { code: 'U014', message: 'User does not have employee role required for employee login', httpCode: 403 },
102
104
  USER_CANNOT_DEACTIVATE_SELF: { code: 'U015', message: 'You cannot deactivate your own account', httpCode: 400 },
103
105
  USER_CANNOT_REMOVE_OWN_ADMIN_ROLE: { code: 'U016', message: 'You cannot remove the ADMIN role from your own account', httpCode: 400 },
104
106
  USER_CANNOT_REMOVE_LAST_ADMIN: { code: 'U017', message: 'The company must keep at least one active administrator', httpCode: 400 },
107
+ USER_EMAIL_REQUIRED_FOR_NOTIFICATION: { code: 'U018', message: 'User email is required for email notification', httpCode: 400 },
108
+ USER_PASSWORD_GENERATION_FAILED: { code: 'U019', message: 'Failed to generate and send password', httpCode: 500 },
105
109
  //AUTH
106
110
  FAILED_TO_UPDATE: { code: 'A010', message: 'User update failed', httpCode: 500 },
107
111
  RESTORE_TOKEN_ERROR: { code: 'A012', message: 'Invalid recovery token', httpCode: 500 },
@@ -156,7 +160,7 @@ exports.ERRORS = {
156
160
  CLIENT_HAS_ORDERS: { code: 'CL025', message: 'Client has orders', httpCode: 400 },
157
161
  CLIENT_IMPORT_FAILED: {
158
162
  code: 'CL024',
159
- message: 'Ошибка при импорте клиентов',
163
+ message: 'Failed to import clients',
160
164
  httpCode: 400,
161
165
  },
162
166
  CLIENT_FILTERS_VALUES_FETCH_FAILED: {
@@ -256,6 +260,12 @@ exports.ERRORS = {
256
260
  CONSIGNMENT_IMPORT_TOO_MANY_ROWS: { code: 'CON024', message: 'Too many rows for this import mode', httpCode: 400 },
257
261
  CONSIGNMENT_PRODUCT_UPDATE_SCHEMA_NOT_FOUND: { code: 'CON025', message: 'Update schema not found', httpCode: 404 },
258
262
  CONSIGNMENT_PRODUCT_UPDATE_SCHEMA_NO_HEADERS_MATCHED: { code: 'CON026', message: 'No schema headers matched the file', httpCode: 400 },
263
+ CONSIGNMENT_PRODUCT_UPDATE_NOT_IN_CONSIGNMENT: {
264
+ code: 'CON027',
265
+ message: 'Product does not belong to this consignment',
266
+ httpCode: 400,
267
+ },
268
+ CONSIGNMENT_PRODUCT_UPDATE_ITEM_FAILED: { code: 'CON028', message: 'Product update failed', httpCode: 400 },
259
269
  // CONSIGNMENT-IMPORT-SCHEME
260
270
  CONSIGNMENT_IMPORT_SCHEME_NOT_CREATED: { code: 'CS001', message: 'Failed to create consignment import scheme', httpCode: 500 },
261
271
  CONSIGNMENT_IMPORT_SCHEME_FETCH_FAILED: { code: 'CS002', message: 'Error when retrieving a consignment import scheme', httpCode: 500 },
@@ -397,6 +407,9 @@ exports.ERRORS = {
397
407
  message: 'Delivery information will be transferred to the target order.',
398
408
  httpCode: 400,
399
409
  },
410
+ ORDER_MERGE_TARGET_IN_SOURCE_LIST: { code: 'O036', message: 'Target order must not be in source list', httpCode: 400 },
411
+ ORDER_INVOICE_NOTIFICATION_INVALID_TYPE: { code: 'O037', message: 'Invalid notification type', httpCode: 400 },
412
+ ORDER_INVOICE_NOTIFICATION_ORDER_UUID_MISSING: { code: 'O038', message: 'Order UUID missing in payload', httpCode: 400 },
400
413
  //SERVICE
401
414
  SERVICE_NOT_CREATED: { code: 'SV001', message: 'Failed to create service', httpCode: 500 },
402
415
  SERVICE_FETCH_FAILED: { code: 'SV002', message: 'Error when retrieving a service', httpCode: 500 },
@@ -502,6 +515,11 @@ exports.ERRORS = {
502
515
  message: 'Order product not found in the order',
503
516
  httpCode: 404,
504
517
  },
518
+ ORDER_PRODUCT_MOVE_SAME_ORDER: {
519
+ code: 'OP025',
520
+ message: 'Source and destination orders must differ',
521
+ httpCode: 400,
522
+ },
505
523
  //TRANSACTION
506
524
  TRANSACTION_NOT_CREATED: { code: 'TR001', message: 'Failed to transaction product', httpCode: 500 },
507
525
  TRANSACTION_FETCH_FAILED: { code: 'TR002', message: 'Error when retrieving a transaction', httpCode: 500 },
@@ -516,7 +534,7 @@ exports.ERRORS = {
516
534
  TRANSACTION_NOT_APPLIED: { code: 'TR011', message: 'Transaction not applied', httpCode: 500 },
517
535
  MONEY_ACCOUNT_REQUIRED: { code: 'TR012', message: 'moneyAccountUUID is required to apply bank payment event', httpCode: 400 },
518
536
  TRANSACTION_CREATE_FAILED: { code: 'TR013', message: 'Failed to create transaction', httpCode: 500 },
519
- TRANSACTION_IMPORT_FAILED: { code: 'TR014', message: 'Ошибка при импорте транзакций', httpCode: 400 },
537
+ TRANSACTION_IMPORT_FAILED: { code: 'TR014', message: 'Failed to import transactions', httpCode: 400 },
520
538
  TRANSACTION_IMPORT_TOO_MANY_ROWS: { code: 'TR015', message: 'Too many rows for transaction import', httpCode: 400 },
521
539
  TRANSACTION_IMPORT_INVALID_FILE_FORMAT: { code: 'TR016', message: 'Invalid file format for transaction import', httpCode: 400 },
522
540
  TRANSACTION_IMPORT_MISSING_REQUIRED_COLUMNS: {
@@ -569,6 +587,12 @@ exports.ERRORS = {
569
587
  message: 'Failed to get match suggestions for bank payment event',
570
588
  httpCode: 500,
571
589
  },
590
+ // COMMON (transport-level codes the catch-all HttpExceptionFilter emits for non-business failures)
591
+ COMMON_NO_DATA_RETURNED: { code: 'E900', message: 'No data returned', httpCode: 500 },
592
+ COMMON_UNKNOWN_ERROR: { code: 'E901', message: 'Unknown error', httpCode: 500 },
593
+ COMMON_VALIDATION_FAILED: { code: 'E902', message: 'Validation failed', httpCode: 400 },
594
+ COMMON_UNAUTHORIZED: { code: 'E903', message: 'Unauthorized', httpCode: 401 },
595
+ COMMON_BAD_REQUEST: { code: 'E904', message: 'Bad request', httpCode: 400 },
572
596
  // EXCEL
573
597
  EXCEL_CREATE_FAILED: { code: 'E001', message: 'Failed to create excel', httpCode: 500 },
574
598
  EXCEL_GET_DATA_BY_BUFFER_FAILED: { code: 'E002', message: 'Failed to get buffer', httpCode: 500 },
@@ -580,6 +604,7 @@ exports.ERRORS = {
580
604
  CATEGORY_NOT_DELETED: { code: 'CA011', message: 'Failed to delete category', httpCode: 500 },
581
605
  CATEGORY_NOT_GET_BY_UUID: { code: 'CA012', message: 'Failed to get category by uuid', httpCode: 500 },
582
606
  CATEGORY_FETCH_FAILED: { code: 'CA013', message: 'Error when retrieving a list of categories', httpCode: 500 },
607
+ CATEGORY_NOT_DETERMINED: { code: 'CA019', message: 'Could not determine category for product', httpCode: 400 },
583
608
  CATEGORY_NOT_UPDATED: { code: 'CA014', message: 'Failed to update category', httpCode: 500 },
584
609
  CATEGORY_CREATE_MANY_FAILED: { code: 'CA015', message: 'Failed to create many categories', httpCode: 500 },
585
610
  CATEGORY_USE_IN_PRODUCT: { code: 'CA016', message: 'Category use in product', httpCode: 500 },
@@ -617,15 +642,15 @@ exports.ERRORS = {
617
642
  FILE_NOT_SUPPORTED: { code: 'F006', message: 'File not supported', httpCode: 400 },
618
643
  FILE_TOO_LARGE: { code: 'F007', message: 'File size exceeds the allowed limit', httpCode: 413 },
619
644
  FILE_UPLOAD_FAILED: { code: 'F008', message: 'File upload failed', httpCode: 400 },
620
- FILE_S3_FORBIDDEN: { code: 'F007', message: 'File S3 forbidden', httpCode: 403 },
645
+ FILE_S3_FORBIDDEN: { code: 'F009', message: 'File S3 forbidden', httpCode: 403 },
621
646
  //WHATSAPP
622
- WHATSAPP_TEXT_NOT_SENT: { code: 'W001', message: 'Failed to send text message', httpCode: 500 },
623
- WHATSAPP_FILE_NOT_SENT: { code: 'W002', message: 'Failed to send file message', httpCode: 500 },
624
- WHATSAPP_FETCH_FAILED_NOTIFICATIONS: { code: 'W003', message: 'Failed to fetch notifications', httpCode: 500 },
625
- WHATSAPP_PHONE_NOT_FOUND: { code: 'W004', message: 'Phone number not found or invalid', httpCode: 400 },
626
- WHATSAPP_STATUS_CHECK_FAILED: { code: 'W005', message: 'Failed to check WhatsApp message status', httpCode: 500 },
627
- WHATSAPP_MESSAGE_NOT_FOUND: { code: 'W006', message: 'Message not found in notification', httpCode: 400 },
628
- WHATSAPP_CHANNEL_NOT_IN_USE: { code: 'W007', message: 'WhatsApp channel is not in use', httpCode: 410 },
647
+ WHATSAPP_TEXT_NOT_SENT: { code: 'WH001', message: 'Failed to send text message', httpCode: 500 },
648
+ WHATSAPP_FILE_NOT_SENT: { code: 'WH002', message: 'Failed to send file message', httpCode: 500 },
649
+ WHATSAPP_FETCH_FAILED_NOTIFICATIONS: { code: 'WH003', message: 'Failed to fetch notifications', httpCode: 500 },
650
+ WHATSAPP_PHONE_NOT_FOUND: { code: 'WH004', message: 'Phone number not found or invalid', httpCode: 400 },
651
+ WHATSAPP_STATUS_CHECK_FAILED: { code: 'WH005', message: 'Failed to check WhatsApp message status', httpCode: 500 },
652
+ WHATSAPP_MESSAGE_NOT_FOUND: { code: 'WH006', message: 'Message not found in notification', httpCode: 400 },
653
+ WHATSAPP_CHANNEL_NOT_IN_USE: { code: 'WH007', message: 'WhatsApp channel is not in use', httpCode: 410 },
629
654
  //MAX MESSENGER
630
655
  MAX_MESSENGER_TEXT_NOT_SENT: { code: 'MX001', message: 'Failed to send text message via Max Messenger', httpCode: 500 },
631
656
  MAX_MESSENGER_FILE_NOT_SENT: { code: 'MX002', message: 'Failed to send file message via Max Messenger', httpCode: 500 },
@@ -687,7 +712,7 @@ exports.ERRORS = {
687
712
  //PRE ORDER
688
713
  PRE_ORDER_NOT_CREATED: { code: 'PO001', message: 'Failed to create pre order', httpCode: 500 },
689
714
  PRE_ORDER_NOT_DELETED: { code: 'PO002', message: 'Failed to delete pre order', httpCode: 500 },
690
- PRE_ORDER_MANY_NOT_DELETED: { code: 'PO002', message: 'Failed to delete pre orders', httpCode: 500 },
715
+ PRE_ORDER_MANY_NOT_DELETED: { code: 'PO036', message: 'Failed to delete pre orders', httpCode: 500 },
691
716
  PRE_ORDER_NOT_UPDATED: { code: 'PO003', message: 'Failed to update pre order', httpCode: 500 },
692
717
  PRE_ORDER_NOT_FOUND: { code: 'PO004', message: 'The pre order with the specified UUID was not found', httpCode: 404 },
693
718
  PRE_ORDER_FETCH_FAILED: { code: 'PO006', message: 'Error when retrieving a list of pre orders', httpCode: 500 },
@@ -746,10 +771,72 @@ exports.ERRORS = {
746
771
  httpCode: 400,
747
772
  },
748
773
  PRE_ORDER_INVALID_COLLECTION: {
749
- code: 'PO013',
774
+ code: 'PO037',
750
775
  message: 'Pre order invalid collection',
751
776
  httpCode: 400,
752
777
  },
778
+ // PRE ORDER — standing-order → pre-order conversion per-item warnings
779
+ PRE_ORDER_SO_ITEM_NOT_LINKED_TO_CATALOG: {
780
+ code: 'PO024',
781
+ message: 'Standing-order item is not linked to a STANDING_ORDER_CATALOG item; matching is impossible',
782
+ httpCode: 400,
783
+ },
784
+ PRE_ORDER_SO_ITEM_NO_MATCHES: {
785
+ code: 'PO025',
786
+ message: 'No matches found in the available collections for the catalog item',
787
+ httpCode: 400,
788
+ },
789
+ PRE_ORDER_SO_ITEM_INSUFFICIENT_QUANTITY: {
790
+ code: 'PO026',
791
+ message: 'Insufficient available quantity in collections for the catalog item; item added partially or not added',
792
+ httpCode: 400,
793
+ },
794
+ PRE_ORDER_SO_ITEM_PARTIALLY_ALLOCATED: {
795
+ code: 'PO027',
796
+ message: 'Not enough balance for the catalog item; part of the quantity was left unallocated',
797
+ httpCode: 400,
798
+ },
799
+ PRE_ORDER_SO_ITEM_NOT_ADDED_IN_COLLECTION: {
800
+ code: 'PO028',
801
+ message: 'Standing-order item was not added to the pre-order for this collection because no match was found in this collection',
802
+ httpCode: 400,
803
+ },
804
+ PRE_ORDER_SO_PRODUCT_NOT_CREATED: {
805
+ code: 'PO029',
806
+ message: 'Failed to create pre-order product from standing-order item',
807
+ httpCode: 400,
808
+ },
809
+ PRE_ORDER_SO_CRITICAL_ERROR: {
810
+ code: 'PO030',
811
+ message: 'Critical error during pre-order creation from standing order',
812
+ httpCode: 400,
813
+ },
814
+ PRE_ORDER_SO_NO_PRE_ORDERS_CREATED: {
815
+ code: 'PO031',
816
+ message: 'No pre-orders were created for this standing order: no matching items found in the selected collections',
817
+ httpCode: 400,
818
+ },
819
+ // PRE ORDER — copy pre-order per-item warnings
820
+ PRE_ORDER_COPY_ITEM_NO_MATCHES: {
821
+ code: 'PO032',
822
+ message: 'No matches found in the target collection for the item',
823
+ httpCode: 400,
824
+ },
825
+ PRE_ORDER_COPY_ITEM_INSUFFICIENT_QUANTITY: {
826
+ code: 'PO033',
827
+ message: 'Insufficient balance for the item; part of the quantity was left unallocated',
828
+ httpCode: 400,
829
+ },
830
+ PRE_ORDER_COPY_SOURCE_NOT_FOUND_OR_EMPTY: {
831
+ code: 'PO034',
832
+ message: 'Source pre-order not found or contains no products',
833
+ httpCode: 400,
834
+ },
835
+ PRE_ORDER_COPY_PRODUCT_CREATE_FAILED: {
836
+ code: 'PO035',
837
+ message: 'Failed to create product during pre-order copy',
838
+ httpCode: 400,
839
+ },
753
840
  //PRE ORDER PRODUCT
754
841
  PRE_ORDER_PRODUCT_NOT_CREATED: { code: 'POP001', message: 'Failed to create pre order product', httpCode: 500 },
755
842
  PRE_ORDER_PRODUCT_NOT_DELETED: { code: 'POP002', message: 'Failed to delete pre order product', httpCode: 500 },
@@ -945,6 +1032,11 @@ exports.ERRORS = {
945
1032
  message: 'Missing required columns in pre order collection item import file',
946
1033
  httpCode: 400,
947
1034
  },
1035
+ PRE_ORDER_COLLECTION_ITEM_UPDATE_BATCH_TOO_LARGE: {
1036
+ code: 'POCI028',
1037
+ message: 'Batch size too large',
1038
+ httpCode: 400,
1039
+ },
948
1040
  // EMPLOYEE SCHEDULE
949
1041
  EMPLOYEE_SCHEDULE_NOT_CREATED: { code: 'ES001', message: 'Failed to create employee schedule', httpCode: 500 },
950
1042
  EMPLOYEE_SCHEDULE_NOT_DELETED: { code: 'ES002', message: 'Failed to delete employee schedule', httpCode: 500 },
@@ -1047,6 +1139,8 @@ exports.ERRORS = {
1047
1139
  IMPORT_UNKNOWN_ERROR: { code: 'ID002', message: 'Unknown error', httpCode: 500 },
1048
1140
  IMPORT_ITEMS_COUNT_LIMIT_EXCEEDED: { code: 'ID003', message: 'Items count limit exceeded', httpCode: 400 },
1049
1141
  NOT_IMPLEMENTED: { code: 'G001', message: 'Not implemented', httpCode: 501 },
1142
+ // Neutral 2xx success — lets the frontend localize a success body by code instead of raw text
1143
+ OPERATION_SUCCESS: { code: 'OK001', message: 'Operation completed successfully', httpCode: 200 },
1050
1144
  // SESSION
1051
1145
  SESSION_NOT_FOUND: { code: 'SES001', message: 'Session not found', httpCode: 401 },
1052
1146
  SESSION_REVOKED: { code: 'SES002', message: 'Session has been revoked', httpCode: 401 },
@@ -1094,6 +1188,11 @@ exports.ERRORS = {
1094
1188
  PUBLIC_ACCOUNT_DELETION_INVALID_CODE: { code: 'ADR009', message: 'Invalid or expired verification code', httpCode: 400 },
1095
1189
  PUBLIC_ACCOUNT_DELETION_INVALID_TOKEN: { code: 'ADR010', message: 'Invalid or expired verification token', httpCode: 400 },
1096
1190
  PUBLIC_ACCOUNT_DELETION_NO_TENANTS_SELECTED: { code: 'ADR011', message: 'No valid tenants selected for deletion', httpCode: 400 },
1191
+ ACCOUNT_DELETION_REQUEST_SUBMITTED: {
1192
+ code: 'ADR012',
1193
+ message: 'If the account exists, a verification code has been sent',
1194
+ httpCode: 200,
1195
+ },
1097
1196
  // MOYSKLAD INTEGRATION
1098
1197
  MOYSKLAD_INVALID_TOKEN: { code: 'MS001', message: 'MoySklad token is invalid or has insufficient permissions', httpCode: 400 },
1099
1198
  MOYSKLAD_CONNECT_FAILED: { code: 'MS002', message: 'Failed to connect MoySklad integration', httpCode: 500 },
@@ -18,3 +18,5 @@ __exportStar(require("./error"), exports);
18
18
  __exportStar(require("./verbose"), exports);
19
19
  __exportStar(require("./error-i18n-key"), exports);
20
20
  __exportStar(require("./import.constant"), exports);
21
+ __exportStar(require("./validation-i18n-key"), exports);
22
+ __exportStar(require("./validation-i18n-message"), exports);
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationI18nKey = void 0;
4
+ /**
5
+ * Stable i18n tokens for Zod validation messages.
6
+ *
7
+ * The global ZodValidationPipe surfaces a schema's `message` verbatim to the client with no error
8
+ * code, so raw English/Russian prose there is not localizable. Use these dot-notation tokens as the
9
+ * Zod `message` instead — the frontend maps the token to a localized string. The token itself is the
10
+ * stable contract; the English text lives only in the frontend dictionary.
11
+ */
12
+ exports.ValidationI18nKey = {
13
+ dateRange: 'validation.dateRange',
14
+ reportPeriodMax: 'validation.reportPeriodMax',
15
+ emailOrPhoneRequired: 'validation.emailOrPhoneRequired',
16
+ allowedRoles: 'validation.allowedRoles',
17
+ statusNotAllowedWebshop: 'validation.statusNotAllowedWebshop',
18
+ targetOrderInList: 'validation.targetOrderInList',
19
+ productListOrConsignment: 'validation.productListOrConsignment',
20
+ consignmentOrProducts: 'validation.consignmentOrProducts',
21
+ rejectionReasonRequired: 'validation.rejectionReasonRequired',
22
+ targetOrNewConsignment: 'validation.targetOrNewConsignment',
23
+ serviceOrNamePrice: 'validation.serviceOrNamePrice',
24
+ quantityPositive: 'validation.quantityPositive',
25
+ nameRequired: 'validation.nameRequired',
26
+ categoryRequired: 'validation.categoryRequired',
27
+ quantityRequired: 'validation.quantityRequired',
28
+ atLeastOneItem: 'validation.atLeastOneItem',
29
+ atLeastOneClient: 'validation.atLeastOneClient',
30
+ fieldRequired: 'validation.fieldRequired',
31
+ phoneFormat: 'validation.phoneFormat',
32
+ emailFormat: 'validation.emailFormat',
33
+ dateFormat: 'validation.dateFormat',
34
+ invalidClientType: 'validation.invalidClientType',
35
+ standingOrderClientNameRequired: 'validation.standingOrderClientNameRequired',
36
+ standingOrderCategoryRequired: 'validation.standingOrderCategoryRequired',
37
+ standingOrderNameRequired: 'validation.standingOrderNameRequired',
38
+ standingOrderQuantityRequired: 'validation.standingOrderQuantityRequired',
39
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VALIDATION_I18N_TOKEN_PATTERN = exports.VALIDATION_I18N_MESSAGE = void 0;
4
+ const validation_i18n_key_1 = require("./validation-i18n-key");
5
+ /**
6
+ * English fallback text for every stable Zod validation token (see validation-i18n-key.ts).
7
+ *
8
+ * The global ZodValidationPipe puts the token into an issue's `message`. The catch-all
9
+ * HttpExceptionFilter detects that a message is a token and, using this map, moves the token to the
10
+ * `i18nKey` field while replacing `message` with the EN text below. The frontend localizes off
11
+ * `i18nKey`; `message` is only the human-readable fallback (see api-error.schema.ts).
12
+ *
13
+ * Every token in ValidationI18nKey MUST have an entry here (enforced by the Record type).
14
+ */
15
+ exports.VALIDATION_I18N_MESSAGE = {
16
+ [validation_i18n_key_1.ValidationI18nKey.dateRange]: 'Start date must be before or equal to end date',
17
+ [validation_i18n_key_1.ValidationI18nKey.reportPeriodMax]: 'The selected period exceeds the maximum allowed range',
18
+ [validation_i18n_key_1.ValidationI18nKey.emailOrPhoneRequired]: 'Either email or phone is required',
19
+ [validation_i18n_key_1.ValidationI18nKey.allowedRoles]: 'The specified role is not allowed',
20
+ [validation_i18n_key_1.ValidationI18nKey.statusNotAllowedWebshop]: 'This status is not allowed in the webshop',
21
+ [validation_i18n_key_1.ValidationI18nKey.targetOrderInList]: 'The target order must not be included in the source order list',
22
+ [validation_i18n_key_1.ValidationI18nKey.productListOrConsignment]: 'Either a product list or a consignment must be provided',
23
+ [validation_i18n_key_1.ValidationI18nKey.consignmentOrProducts]: 'Either a consignment or products must be provided',
24
+ [validation_i18n_key_1.ValidationI18nKey.rejectionReasonRequired]: 'A rejection reason is required',
25
+ [validation_i18n_key_1.ValidationI18nKey.targetOrNewConsignment]: 'Either a target consignment or a new consignment must be provided',
26
+ [validation_i18n_key_1.ValidationI18nKey.serviceOrNamePrice]: 'Either a service or a name and price must be provided',
27
+ [validation_i18n_key_1.ValidationI18nKey.quantityPositive]: 'Quantity must be a positive number',
28
+ [validation_i18n_key_1.ValidationI18nKey.nameRequired]: 'Name is required',
29
+ [validation_i18n_key_1.ValidationI18nKey.categoryRequired]: 'Category is required',
30
+ [validation_i18n_key_1.ValidationI18nKey.quantityRequired]: 'Quantity is required',
31
+ [validation_i18n_key_1.ValidationI18nKey.atLeastOneItem]: 'At least one item is required',
32
+ [validation_i18n_key_1.ValidationI18nKey.atLeastOneClient]: 'At least one client is required',
33
+ [validation_i18n_key_1.ValidationI18nKey.fieldRequired]: 'This field is required',
34
+ [validation_i18n_key_1.ValidationI18nKey.phoneFormat]: 'Invalid phone number format',
35
+ [validation_i18n_key_1.ValidationI18nKey.emailFormat]: 'Invalid email format',
36
+ [validation_i18n_key_1.ValidationI18nKey.dateFormat]: 'Invalid date format',
37
+ [validation_i18n_key_1.ValidationI18nKey.invalidClientType]: 'Invalid client type',
38
+ [validation_i18n_key_1.ValidationI18nKey.standingOrderClientNameRequired]: 'Client name is required',
39
+ [validation_i18n_key_1.ValidationI18nKey.standingOrderCategoryRequired]: 'Category is required',
40
+ [validation_i18n_key_1.ValidationI18nKey.standingOrderNameRequired]: 'Name is required',
41
+ [validation_i18n_key_1.ValidationI18nKey.standingOrderQuantityRequired]: 'Quantity is required',
42
+ };
43
+ /**
44
+ * A validation `message` is a stable i18n token when it matches this pattern (e.g. `validation.dateRange`).
45
+ * Anything else is a custom Zod message that stays in `message` with no `i18nKey`.
46
+ */
47
+ exports.VALIDATION_I18N_TOKEN_PATTERN = /^validation\.[A-Za-z0-9.]+$/;
@@ -1,22 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERBOSE = void 0;
4
+ // Success messages: `message` is the EN fallback, the frontend localizes by `code` (same model as ERRORS).
4
5
  exports.VERBOSE = {
5
- USER_SUCCESSFULLY_CREATED: { code: 'SM001', message: 'Пользователь успешно зарегистрирован' },
6
+ USER_SUCCESSFULLY_CREATED: { code: 'SM001', message: 'User registered successfully' },
6
7
  EMAIL_VERIFICATION_SEND: {
7
8
  code: 'SM002',
8
- message: 'Подтверждение адреса электронной почти отправлено успешно! Проверьте свой почтовый ящик.',
9
+ message: 'Email verification sent successfully! Check your inbox.',
9
10
  },
10
- EMAIL_VERIFICATION_SUCCESS: { code: 'SM003', message: 'Подтверждение почты прошло успешно!' },
11
- PASSWORD_SUCCESSFULLY_SET: { code: 'SM004', message: 'Пароль пользователя успешно установлен!' },
11
+ EMAIL_VERIFICATION_SUCCESS: { code: 'SM003', message: 'Email verified successfully!' },
12
+ PASSWORD_SUCCESSFULLY_SET: { code: 'SM004', message: 'User password set successfully!' },
12
13
  PASSWORD_SUCCESSFULLY_RESTORED: {
13
14
  code: 'SM005',
14
- message: 'Вам на почту выслано письмо с подтверждением сброса пароля. Проверьте свой почтовый ящик!',
15
+ message: 'A password reset confirmation email has been sent to you. Check your inbox!',
15
16
  },
16
- PASSWORD_SUCCESSFULLY_RESET: { code: 'SM006', message: 'Пароль успешно сброшен' },
17
- CABINET_SUCCESSFULLY_UPDATED: { code: 'SM007', message: 'Кабинет успешно обновлён' },
18
- PROJECT_SUCCESSFULLY_CREATED: { code: 'SM008', message: 'Проект успешно создан.' },
19
- PROJECT_SUCCESSFULLY_UPDATED: { code: 'SM009', message: 'Проект успешно обновлён.' },
17
+ PASSWORD_SUCCESSFULLY_RESET: { code: 'SM006', message: 'Password reset successfully' },
18
+ CABINET_SUCCESSFULLY_UPDATED: { code: 'SM007', message: 'Cabinet updated successfully' },
19
+ PROJECT_SUCCESSFULLY_CREATED: { code: 'SM008', message: 'Project created successfully.' },
20
+ PROJECT_SUCCESSFULLY_UPDATED: { code: 'SM009', message: 'Project updated successfully.' },
20
21
  // SMS GATEWAY
21
- SMS_SUCCESSFULLY_SENT: { code: 'SM010', message: 'SMS сообщение успешно отправлено' },
22
+ SMS_SUCCESSFULLY_SENT: { code: 'SM010', message: 'SMS message sent successfully' },
22
23
  };
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiErrorSchema = exports.ApiErrorValidationIssueSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ // Per-field issue of a VALIDATION error (Zod): `path` addresses the offending field.
6
+ // `i18nKey` is the stable token the frontend translates; it is set only when the schema used a
7
+ // registered `validation.*` token as its Zod message (see validation-i18n-key.ts). In that case
8
+ // `message` carries the EN fallback text from VALIDATION_I18N_MESSAGE. For custom Zod messages that
9
+ // are not tokens, `i18nKey` is omitted and `message` holds the raw Zod string as-is.
10
+ exports.ApiErrorValidationIssueSchema = zod_1.z.object({
11
+ path: zod_1.z.array(zod_1.z.union([zod_1.z.string(), zod_1.z.number()])),
12
+ message: zod_1.z.string(),
13
+ i18nKey: zod_1.z.string().optional(),
14
+ });
15
+ /**
16
+ * Unified HTTP error envelope: every non-2xx response of the API has exactly this shape
17
+ * (enforced by the catch-all HttpExceptionFilter on the backend).
18
+ *
19
+ * - `errorCode` — a code from ERRORS (business) or ApiGenericErrorCodeEnum (validation/transport);
20
+ * the frontend maps it to a localized text, `message` is only the EN fallback.
21
+ * - `errors` — present only when `errorCode` is VALIDATION (per-field issues).
22
+ * - `data` — optional machine-readable payload attached by business errors.
23
+ */
24
+ exports.ApiErrorSchema = zod_1.z.object({
25
+ statusCode: zod_1.z.number().int(),
26
+ errorCode: zod_1.z.string(),
27
+ message: zod_1.z.string(),
28
+ timestamp: zod_1.z.string(),
29
+ path: zod_1.z.string(),
30
+ errors: zod_1.z.array(exports.ApiErrorValidationIssueSchema).optional(),
31
+ data: zod_1.z.unknown().optional(),
32
+ });
@@ -23,7 +23,7 @@ exports.AcceptConsignmentTransferRequestSchema = zod_1.z
23
23
  .min(1),
24
24
  })
25
25
  .refine(data => Boolean(data.targetConsignmentUUID) !== Boolean(data.newConsignment), {
26
- message: 'Provide either targetConsignmentUUID or newConsignment, not both',
26
+ message: 'validation.targetOrNewConsignment',
27
27
  path: ['targetConsignmentUUID'],
28
28
  });
29
29
  exports.AcceptConsignmentTransferResponseSchema = zod_1.z.object({
@@ -83,4 +83,5 @@ __exportStar(require("./messenger-profile"), exports);
83
83
  __exportStar(require("./error-message.schema"), exports);
84
84
  __exportStar(require("./account-deletion-request/account-deletion-request.schema"), exports);
85
85
  __exportStar(require("./consignment-transfer"), exports);
86
+ __exportStar(require("./api-error.schema"), exports);
86
87
  __exportStar(require("./access-policy"), exports);
@@ -29,7 +29,7 @@ exports.CreateOrderServiceLineRequestSchema = zod_1.z
29
29
  comment: zod_1.z.string().max(1000).optional(),
30
30
  })
31
31
  .refine(data => data.serviceUUID || (data.name && data.price !== undefined), {
32
- message: 'Either serviceUUID or both name and price must be provided',
32
+ message: 'validation.serviceOrNamePrice',
33
33
  });
34
34
  exports.UpdateOrderServiceLineRequestSchema = zod_1.z.object({
35
35
  price: zod_1.z.number().min(0).max(1000000000).optional(),
@@ -5,6 +5,7 @@ const zod_1 = require("zod");
5
5
  const pre_order_schema_1 = require("./pre-order.schema");
6
6
  const pre_order_product_schema_1 = require("../pre-order-product/pre-order-product.schema");
7
7
  const pre_order_collection_item_schema_1 = require("../pre-order-collection-item/pre-order-collection-item.schema");
8
+ const error_message_schema_1 = require("../error-message.schema");
8
9
  exports.CopyAnalysisMatchSchema = zod_1.z.object({
9
10
  collectionItem: pre_order_collection_item_schema_1.PreOrderCollectionItemSchema,
10
11
  quantity: zod_1.z.number(),
@@ -17,5 +18,5 @@ exports.CopyAnalysisMappingSchema = zod_1.z.object({
17
18
  exports.CopyAnalysisSchema = zod_1.z.object({
18
19
  preOrder: pre_order_schema_1.PreOrderWithClientSchema,
19
20
  mappings: zod_1.z.record(zod_1.z.string(), exports.CopyAnalysisMappingSchema),
20
- warnings: zod_1.z.record(zod_1.z.string(), zod_1.z.array(zod_1.z.string())),
21
+ warnings: zod_1.z.record(zod_1.z.string(), zod_1.z.array(error_message_schema_1.ErrorMessageSchema)),
21
22
  });
@@ -6,6 +6,8 @@ const InitiatePublicAccountDeletionRequestSchema = z.object({
6
6
 
7
7
  const InitiatePublicAccountDeletionResponseSchema = z.object({
8
8
  message: z.string(),
9
+ code: z.string().optional(),
10
+ i18nKey: z.string().optional(),
9
11
  data: z.object({
10
12
  success: z.boolean(),
11
13
  }),
@@ -20,7 +20,7 @@ const GetActionLogListForClientRequestSchema = z
20
20
  return true;
21
21
  },
22
22
  {
23
- message: 'End date must be greater than start date',
23
+ message: 'validation.dateRange',
24
24
  path: ['endDate', 'startDate'],
25
25
  },
26
26
  );
@@ -21,7 +21,7 @@ const GetActionLogListRequestSchema = z
21
21
  return true;
22
22
  },
23
23
  {
24
- message: 'End date must be greater than start date',
24
+ message: 'validation.dateRange',
25
25
  path: ['endDate', 'startDate'],
26
26
  },
27
27
  );
@@ -5,8 +5,8 @@ const ListMobileBuyerTenantsRequestSchema = z
5
5
  phone: z.string().min(1).optional(),
6
6
  email: z.email().optional(),
7
7
  })
8
- .refine((data) => data.phone || data.email, {
9
- message: 'Either phone or email must be provided',
8
+ .refine(data => data.phone || data.email, {
9
+ message: 'validation.emailOrPhoneRequired',
10
10
  });
11
11
 
12
12
  const MobileBuyerTenantItemSchema = z.object({
@@ -8,7 +8,7 @@ export const ResetPasswordByTokenRequestSchema = z
8
8
  password: z.string(),
9
9
  })
10
10
  .refine(data => data.email || data.phone, {
11
- message: 'Either email or phone must be provided',
11
+ message: 'validation.emailOrPhoneRequired',
12
12
  path: ['email', 'phone'],
13
13
  });
14
14
 
@@ -21,7 +21,7 @@ const GetBankPaymentListRequestSchema = z
21
21
  return true;
22
22
  },
23
23
  {
24
- message: 'End date must be greater than start date',
24
+ message: 'validation.dateRange',
25
25
  path: ['endDate', 'startDate'],
26
26
  },
27
27
  );
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ErrorMessageSchema } from '../../schemas/error-message.schema';
2
3
 
3
4
  const OptionUpdateSchema = z.object({
4
5
  title: z.string().nullable().optional(),
@@ -42,9 +43,8 @@ const UpdateBatchResponseSchema = z.object({
42
43
  successCount: z.number(),
43
44
  failedCount: z.number(),
44
45
  errors: z.array(
45
- z.object({
46
+ ErrorMessageSchema.extend({
46
47
  uuid: z.string(),
47
- error: z.string(),
48
48
  }),
49
49
  ),
50
50
  }),
@@ -28,7 +28,7 @@ const GetConsignmentListRequestSchema = z
28
28
  return true;
29
29
  },
30
30
  {
31
- message: 'End date must be greater than start date',
31
+ message: 'validation.dateRange',
32
32
  path: ['endDate', 'startDate'],
33
33
  },
34
34
  );
@@ -6,7 +6,7 @@ const RemoveConsignmentDiscountBodySchema = z
6
6
  productUUIDs: z.uuid().array().optional().default([]),
7
7
  })
8
8
  .refine(data => Boolean(data.consignmentUUID) || data.productUUIDs.length > 0, {
9
- message: 'Provide consignmentUUID or a non-empty productUUIDs list',
9
+ message: 'validation.consignmentOrProducts',
10
10
  });
11
11
 
12
12
  const RemoveConsignmentDiscountRequestSchema = z.object({
@@ -9,7 +9,7 @@ const SetConsignmentDiscountBodySchema = z
9
9
  })
10
10
  .and(discountRulesModeSchema)
11
11
  .refine(data => Boolean(data.consignmentUUID) || data.productUUIDs.length > 0, {
12
- message: 'Provide consignmentUUID or a non-empty productUUIDs list',
12
+ message: 'validation.consignmentOrProducts',
13
13
  });
14
14
 
15
15
  const SetConsignmentDiscountRequestSchema = z.object({
@@ -24,7 +24,7 @@ const GetEmployeeScheduleListRequestSchema = z
24
24
  return true;
25
25
  },
26
26
  {
27
- message: 'End date must be greater than start date',
27
+ message: 'validation.dateRange',
28
28
  path: ['endDate', 'startDate'],
29
29
  },
30
30
  );