feat(app): экраны импорта отчётов, целей, доходов, ребалансировки, налогов и бенчмарков
Импорт (/imports, /instruments/pending) и фаза 4 (/goals, /income, /rebalance, /tax, аналитика-хаб с benchmarks_card) — по docs/ai/import-contract.md и docs/ai/phase4-contract.md. file_picker для загрузки отчёта.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../../core/api/api_client.dart';
|
||||
import 'data/goals_api.dart';
|
||||
|
||||
final goalsApiProvider = Provider<GoalsApi>((ref) => GoalsApi(ref.watch(apiProvider).dio));
|
||||
|
||||
final goalsProvider =
|
||||
FutureProvider.autoDispose<List<Goal>>((ref) => ref.watch(goalsApiProvider).list());
|
||||
|
||||
/// Progress is computed server-side and refetched per goal — the client never projects
|
||||
/// anything itself.
|
||||
final goalProgressProvider =
|
||||
FutureProvider.autoDispose.family<GoalProgress, int>((ref, id) async {
|
||||
return ref.watch(goalsApiProvider).progress(id);
|
||||
});
|
||||
|
||||
/// After any create/patch/delete the list and every progress card are refetched: the
|
||||
/// numbers are recomputed on the server, not patched in the app.
|
||||
void invalidateGoals(WidgetRef ref) {
|
||||
ref.invalidate(goalsProvider);
|
||||
ref.invalidate(goalProgressProvider);
|
||||
}
|
||||
Reference in New Issue
Block a user