Skip to content

feat(log): admin endpoint to bulk-set FinancialDataLog validity#3919

Open
TaprootFreak wants to merge 2 commits into
developfrom
feat/financial-log-validity-endpoint
Open

feat(log): admin endpoint to bulk-set FinancialDataLog validity#3919
TaprootFreak wants to merge 2 commits into
developfrom
feat/financial-log-validity-endpoint

Conversation

@TaprootFreak

Copy link
Copy Markdown
Collaborator

Why

FinancialDataLog entries occasionally get a transient, implausibly high totalBalanceChf (booking-order race: plusBalanceChf jumps ahead of the corresponding minusBalanceChf). Until now each occurrence required a hand-written one-shot migration to flip valid (e.g. #3884, #3889, #3892, #3903, #3916). This adds a reusable admin endpoint so the same correction can be applied (and reverted) without a migration per day.

Endpoint

PUT /log/financial/validity — ADMIN only.

Bulk-sets the valid flag on FinancialDataLog entries (system=LogService, subsystem=FinancialDataLog, severity=Info) matched by an optional created range and/or totalBalanceChf bounds.

Body (SetFinancialLogValidityDto):

field type meaning
from ISO date created >= from (inclusive)
to ISO date created <= to (inclusive)
min number totalBalanceChf > min
max number totalBalanceChf < max
valid boolean required — value to set (false = invalidate, true = restore)

Returns { affected: <rowCount> }.

Guard rails

  • At least one filter (from / to / min / max) is required — prevents touching the whole table.
  • from must not be after to; min must be smaller than max.

Example

PUT /log/financial/validity
{ "from": "2026-06-18T00:00:00Z", "to": "2026-06-18T23:59:59Z", "min": 60000, "valid": false }

…replaces the daily migration that invalidated 2026-06-18 entries with totalBalanceChf > 60000.

Tests

Service spec covers the validation branches and repository delegation (5 tests). Locally green: format:check, lint, type-check, jest.

Note: this is operational tooling for the symptom. The underlying booking-order race (root cause) is tracked separately.

@TaprootFreak TaprootFreak marked this pull request as ready for review June 18, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant