refactor: retire legacy tbank-sync status and sync=observe (WealthLedger/backend#196)
Backend verify / commits (push) Skipped
Backend verify / security (push) Successful in 1m7s
Backend verify / verify (push) Failing after 7m39s

This commit was merged in pull request #197.
This commit is contained in:
2026-11-05 22:33:14 +03:00
parent 83b515a453
commit d792baaf59
36 changed files with 182 additions and 832 deletions
@@ -238,7 +238,6 @@ export class BrokerageOperationsService {
userId: string,
accountId: string,
ranges: (openedAt: Date | undefined) => DateOnlyRange[],
observe = false,
) {
const connection = await this.access.local(userId, accountId);
const input = {
@@ -252,21 +251,19 @@ export class BrokerageOperationsService {
periods: ranges,
};
let saved = await this.repository.readPage(input);
if (!observe) {
const targets = (saved?.connection.accounts ?? []).flatMap((account) =>
(saved?.periods ?? []).map((period) => ({
accountId: account.accountId,
...period,
})),
);
if (targets.length) {
await this.sync.readPlan(userId, targets, {
movingEnd: saved?.periods?.some((period) => period.movingEnd),
revision: connection.revision,
});
}
saved = await this.repository.readPage(input);
const targets = (saved?.connection.accounts ?? []).flatMap((account) =>
(saved?.periods ?? []).map((period) => ({
accountId: account.accountId,
...period,
})),
);
if (targets.length) {
await this.sync.readPlan(userId, targets, {
movingEnd: saved?.periods?.some((period) => period.movingEnd),
revision: connection.revision,
});
}
saved = await this.repository.readPage(input);
const now = new Date();
const hourly = await this.hourlySync.hourly(userId);
const membership = investmentResourceMeta({