feat(app): Flutter-клиент — логин, дашборд, потоки, категории, транзакции, правила

Riverpod + go_router с auth-guard, NavigationRail на широком экране и bottom bar
на узком. Токены в flutter_secure_storage, на web access живёт в памяти.
Интерцептор подставляет токен и делает ровно один refresh на 401.

Деньги приходят строками и форматируются через Decimal: парсить их в double
значило бы терять копейки ровно там, где бэкенд их бережёт.
This commit is contained in:
Dmitry
2026-09-18 13:44:09 +03:00
parent b9c12fa1a1
commit ce0966fca2
99 changed files with 6284 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import 'package:dio/dio.dart';
import 'package:fintracker_app/core/api/api_client.dart';
import 'package:flutter_test/flutter_test.dart';
/// Captures whatever `onRequest` passes on, so the rewritten query can be inspected.
class _Capture extends RequestInterceptorHandler {
RequestOptions? seen;
@override
void next(RequestOptions options) => seen = options;
}
void main() {
RequestOptions run(Map<String, dynamic> query) {
final handler = _Capture();
DateQueryInterceptor().onRequest(
RequestOptions(path: '/networth/series', queryParameters: query),
handler,
);
return handler.seen!;
}
test('a DateTime becomes a plain YYYY-MM-DD date', () {
// the value the generated client hands over: DateTime.now(), time and all
final out = run({'from': DateTime(2025, 9, 18, 10, 31, 29, 84)});
expect(out.queryParameters['from'], '2025-09-18');
});
test('single-digit months and days keep two digits', () {
final out = run({'from': DateTime(2026, 1, 5)});
expect(out.queryParameters['from'], '2026-01-05');
});
test('non-date parameters are passed through untouched', () {
final out = run({'page': 2, 'q': 'кофе', 'include_deleted': false});
expect(out.queryParameters, {'page': 2, 'q': 'кофе', 'include_deleted': false});
});
}