fix(finance): preserve imported corrections

This commit is contained in:
Ochenstarik 2026-09-24 18:28:58 +07:00
parent 1007f929c2
commit c08a7e6af1
2 changed files with 7 additions and 3 deletions

View file

@ -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: Сумма сохранена }

View file

@ -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()) {