Removes user-specific repository methods

Removes the now-unnecessary user-specific methods from the category and tag repositories. The repositories are now user-specific at the box level, so filtering by user ID within the repository methods is redundant.

Also, removes now-unused imports related to user logic in category and tag list pages, and the add transaction dialog.
This commit is contained in:
2025-07-12 21:56:39 +03:00
parent 8b75299d41
commit fd0c3dd9a8
5 changed files with 0 additions and 42 deletions
@@ -71,39 +71,6 @@ class HiveCategoryRepository implements ICategoryRepository {
}
}
// Новые методы для работы с пользователями
@override
Future<List<Category>> getAllByUser(String userId) async {
try {
return _box.values.toList();
} catch (e) {
throw Exception('Ошибка получения категорий пользователя: $e');
}
}
@override
Future<List<Category>> getIncomeCategoriesByUser(String userId) async {
try {
return _box.values
.where((c) => c.isIncome)
.toList();
} catch (e) {
throw Exception('Ошибка получения категорий доходов пользователя: $e');
}
}
@override
Future<List<Category>> getExpenseCategoriesByUser(String userId) async {
try {
return _box.values
.where((c) => !c.isIncome)
.toList();
} catch (e) {
throw Exception('Ошибка получения категорий расходов пользователя: $e');
}
}
@override
Future<void> addAll(List<Category> categories) async {
try {
@@ -40,12 +40,6 @@ class HiveTagRepository implements ITagRepository {
await _box.delete(id);
}
@override
Future<List<Tag>> getAllByUser(String userId) async {
// Фильтрация по userId больше не требуется, так как бокс уже пользовательский
return _box.values.toList();
}
@override
Future<void> addAll(List<Tag> tags) async {
final Map<String, Tag> tagMap = {
@@ -4,7 +4,6 @@ import 'package:budget_app/models/category.dart';
import 'package:budget_app/pages/category/category_edit_page.dart';
import 'package:budget_app/pages/category/widgets/add_category_button.dart';
import 'package:budget_app/pages/category/widgets/category_list_item.dart';
import 'package:budget_app/logic/user/user_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';
@@ -12,7 +12,6 @@ import '../../../data/repositories/interfaces/itag_repository.dart';
import '../../../models/category.dart';
import '../../../models/tag.dart';
import '../../../models/transaction_record.dart';
import '../../../logic/user/user_cubit.dart';
import '../../../utils/category_utils.dart';
class AddTransactionDialog extends StatefulWidget {
-1
View File
@@ -5,7 +5,6 @@ import 'package:budget_app/models/tag.dart';
import 'package:budget_app/pages/tag/tag_edit_page.dart';
import 'package:budget_app/pages/tag/widgets/add_tag_button.dart';
import 'package:budget_app/pages/tag/widgets/tag_list_item.dart';
import 'package:budget_app/logic/user/user_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';