60 lines
2.1 KiB
Dart
60 lines
2.1 KiB
Dart
import '../models/transaction_record.dart';
|
|
import '../models/category.dart';
|
|
import '../models/tag.dart';
|
|
import 'category_utils.dart';
|
|
import 'tag_utils.dart';
|
|
|
|
/// Утилиты для работы с тестовыми транзакциями
|
|
class TransactionUtils {
|
|
/// Возвращает список тестовых транзакций
|
|
static List<TransactionRecord> getSampleTransactions(String userId) {
|
|
final categories = CategoryUtils.getDefaultCategories(userId);
|
|
final tags = TagUtils.getDefaultTags(userId);
|
|
|
|
return [
|
|
// Доходы
|
|
TransactionRecord(
|
|
category: categories.firstWhere((c) => c.id == 'income_salary'),
|
|
tag: tags.firstWhere((t) => t.id == 'tag_work'),
|
|
amount: 100000,
|
|
dateTime: DateTime.now().subtract(const Duration(days: 5)),
|
|
vendor: 'ООО "Рога и копыта"',
|
|
currency: 'RUB',
|
|
),
|
|
TransactionRecord(
|
|
category: categories.firstWhere((c) => c.id == 'income_freelance'),
|
|
tag: tags.firstWhere((t) => t.id == 'tag_work'),
|
|
amount: 25000,
|
|
dateTime: DateTime.now().subtract(const Duration(days: 2)),
|
|
vendor: 'Фриланс проект',
|
|
currency: 'RUB',
|
|
),
|
|
|
|
// Расходы
|
|
TransactionRecord(
|
|
category: categories.firstWhere((c) => c.id == 'expense_food'),
|
|
tag: tags.firstWhere((t) => t.id == 'tag_family'),
|
|
amount: -3500,
|
|
dateTime: DateTime.now().subtract(const Duration(days: 1)),
|
|
vendor: 'Пятерочка',
|
|
currency: 'RUB',
|
|
),
|
|
TransactionRecord(
|
|
category: categories.firstWhere((c) => c.id == 'expense_transport'),
|
|
amount: -500,
|
|
dateTime: DateTime.now().subtract(const Duration(hours: 12)),
|
|
vendor: 'Яндекс Такси',
|
|
currency: 'RUB',
|
|
),
|
|
TransactionRecord(
|
|
category: categories.firstWhere((c) => c.id == 'expense_entertainment'),
|
|
tag: tags.firstWhere((t) => t.id == 'tag_friends'),
|
|
amount: -2000,
|
|
dateTime: DateTime.now().subtract(const Duration(hours: 6)),
|
|
vendor: 'Кинотеатр',
|
|
currency: 'RUB',
|
|
),
|
|
];
|
|
}
|
|
}
|