From c08a7e6af1247e2eb0955bfdaea9790ba9fd30fa Mon Sep 17 00:00:00 2001 From: Ochenstarik Date: Thu, 24 Sep 2026 18:28:58 +0700 Subject: [PATCH] fix(finance): preserve imported corrections --- api/openapi.yaml | 2 +- src/operations.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/api/openapi.yaml b/api/openapi.yaml index 31f4eaa..7566696 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -309,7 +309,7 @@ paths: type: object required: [value_minor] properties: - value_minor: { type: integer, minimum: 0 } + value_minor: { type: integer, minimum: -9000000000000000, maximum: 9000000000000000 } currency_code: { type: string, pattern: '^[A-Z]{3}$' } responses: '200': { description: Сумма сохранена } diff --git a/src/operations.ts b/src/operations.ts index a851417..aaf4f92 100644 --- a/src/operations.ts +++ b/src/operations.ts @@ -216,7 +216,11 @@ export async function registerOperationsRoutes( body: { type: 'object', additionalProperties: false, required: ['value_minor'], properties: { - value_minor: { type: 'integer', minimum: 0, maximum: 9_000_000_000_000_000 }, + value_minor: { + type: 'integer', + minimum: -9_000_000_000_000_000, + maximum: 9_000_000_000_000_000, + }, currency_code: { type: 'string', pattern: '^[A-Z]{3}$' }, }, }, @@ -689,7 +693,7 @@ function validateImport(body: OwnerWorkbookImportBody): boolean { if (!financialMetricKeys.has(entry.metric_key) || !parseDate(entry.business_date) || !Number.isSafeInteger(entry.value_minor) - || entry.value_minor < 0) return false; + || Math.abs(entry.value_minor) > 9_000_000_000_000_000) return false; } for (const employee of body.employees ?? []) { if (!employee.external_ref || !employee.personnel_number.trim() || !employee.display_name.trim()) {