fix(reset): scope family financial data resets (#1835)

Centralize family financial reset cleanup behind an explicitly scoped service, update reset status docs, and add two-family regression coverage for destructive reset behavior.
This commit is contained in:
ghost
2026-05-30 15:21:34 -07:00
committed by GitHub
parent bc7e16ff16
commit 7580325418
7 changed files with 887 additions and 45 deletions

View File

@@ -70,14 +70,8 @@ class Api::V1::UsersController < Api::V1::BaseController
end
def reset_target_counts(family)
{
accounts: family.accounts.count,
categories: family.categories.count,
tags: family.tags.count,
merchants: family.merchants.count,
plaid_items: family.plaid_items.count,
imports: family.imports.count,
budgets: family.budgets.count
}
counts = Family::FinancialDataReset.new(family: family, dry_run: true, confirmed: false).call.before_counts.except(:syncs)
counts.merge(plaid_items: family.plaid_items.count)
end
end