39 lines
1.2 KiB
Dart
39 lines
1.2 KiB
Dart
import 'package:injectable/injectable.dart';
|
|
import 'package:remever/database/database.dart';
|
|
import 'package:remever/inject.dart';
|
|
import 'package:remever/models/crud_collection_dto.dart';
|
|
import 'package:remever/services/collection/collections_interface.dart';
|
|
|
|
///
|
|
/// Сервис авторизации
|
|
///
|
|
|
|
@Singleton(as: CollectionsInterface)
|
|
final class CollectionsService implements CollectionsInterface {
|
|
@override
|
|
Stream<List<Collection>> watchCollectionsList({String? search}) {
|
|
return getIt<AppDatabase>().collectionsDao.getCollections(search);
|
|
}
|
|
|
|
@override
|
|
Future<void> createCollection(CrudCollectionDto dto) async {
|
|
return await getIt<AppDatabase>().collectionsDao.createCollection(dto);
|
|
}
|
|
|
|
@override
|
|
Future<void> updateCollection(CrudCollectionDto 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();
|
|
}
|
|
}
|