fix(investments): align roles and date contracts
Backend security / security (push) Successful in 9s
Backend verify / verify (push) Successful in 10m23s
Backend security / security (pull_request) Successful in 8s
Backend verify / verify (pull_request) Successful in 10m39s
Conventional commits / commits (pull_request) Successful in 29s

Identify income dependencies by role and document screen-specific dates.
Convert inclusive calendar days into half-open source ranges while
preserving operation timestamps and existing stored coverage.
This commit is contained in:
2026-09-27 11:38:13 +03:00
parent e4232138d0
commit 516e43203e
18 changed files with 500 additions and 74 deletions
@@ -63,12 +63,19 @@ export function normalizeScreen(
if (['stock', 'bond'].includes(input.screen) && !input.instrumentUid) fail();
if (input.accountId !== undefined && !accountId) fail();
if (['income', 'events'].includes(input.screen)) {
if (Boolean(input.from) !== Boolean(input.to)) fail();
if (input.screen === 'income' && Boolean(input.from) !== Boolean(input.to))
fail();
for (const value of [input.from, input.to])
if (value && !/^\d{4}-\d{2}-\d{2}$/.test(value)) fail();
}
if (input.from && input.to && new Date(input.from) > new Date(input.to))
fail();
if (
input.screen === 'events' &&
input.to &&
(input.from ?? new Date().toISOString().slice(0, 10)) > input.to
)
fail();
if (
input.candleRange &&
new Date(input.candleRange.from) >= new Date(input.candleRange.to)