Добавлено удаление коллекций
This commit is contained in:
@@ -6,8 +6,13 @@ import 'package:remever/models/collection_dto.dart';
|
||||
///
|
||||
abstract interface class CollectionsInterface {
|
||||
/// Получение списка коллекций
|
||||
Stream<List<Collection>> getCollectionsList();
|
||||
Stream<List<Collection>> watchCollectionsList();
|
||||
|
||||
/// Создание новой коллекции
|
||||
Future<void> createCollection(CollectionDto dto);
|
||||
Future<void> updateCollection(CollectionDto dto, String id);
|
||||
Future<void> deleteCollection(String id);
|
||||
|
||||
/// Сделать коллекцию публичной
|
||||
Future<bool> makeCollectionPublic(String id, bool isPublic);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:remever/services/collection/collections_interface.dart';
|
||||
@Singleton(as: CollectionsInterface)
|
||||
final class CollectionsService implements CollectionsInterface {
|
||||
@override
|
||||
Stream<List<Collection>> getCollectionsList() {
|
||||
Stream<List<Collection>> watchCollectionsList() {
|
||||
return getIt<AppDatabase>().collectionsDao.getCollections();
|
||||
}
|
||||
|
||||
@@ -19,4 +19,20 @@ final class CollectionsService implements CollectionsInterface {
|
||||
Future<void> createCollection(CollectionDto dto) async {
|
||||
return await getIt<AppDatabase>().collectionsDao.createCollection(dto);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateCollection(CollectionDto dto, String id) async {
|
||||
return await getIt<AppDatabase>().collectionsDao.updateCollection(dto, id);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteCollection(String id) async {
|
||||
return await getIt<AppDatabase>().collectionsDao.deleteCollection(id);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> makeCollectionPublic(String id, bool isPublic) {
|
||||
// TODO: implement makeCollectionPublic
|
||||
throw UnimplementedError();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user