mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 09:01:21 +00:00

* refactor: rename structs * chore: read database id from view * chore: fix open database error because of create a database view for database id * chore: fix tests * chore: rename datbase id to view id in flutter * refactor: move grid and board to database view folder * refactor: rename functions * refactor: move calender to datbase view folder * refactor: rename app_flowy to appflowy_flutter * chore: reanming * chore: fix freeze gen * chore: remove todos * refactor: view process events * chore: add link database test * chore: just open view if there is opened database
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import 'dart:async';
|
|
import 'package:dartz/dartz.dart';
|
|
import 'package:appflowy_backend/dispatch/dispatch.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
|
|
|
|
class TrashService {
|
|
Future<Either<RepeatedTrashPB, FlowyError>> readTrash() {
|
|
return FolderEventReadTrash().send();
|
|
}
|
|
|
|
Future<Either<Unit, FlowyError>> putback(String trashId) {
|
|
final id = TrashIdPB.create()..id = trashId;
|
|
|
|
return FolderEventPutbackTrash(id).send();
|
|
}
|
|
|
|
Future<Either<Unit, FlowyError>> deleteViews(
|
|
List<Tuple2<String, TrashType>> trashList) {
|
|
final items = trashList.map((trash) {
|
|
return TrashIdPB.create()
|
|
..id = trash.value1
|
|
..ty = trash.value2;
|
|
});
|
|
|
|
final ids = RepeatedTrashIdPB(items: items);
|
|
return FolderEventDeleteTrash(ids).send();
|
|
}
|
|
|
|
Future<Either<Unit, FlowyError>> restoreAll() {
|
|
return FolderEventRestoreAllTrash().send();
|
|
}
|
|
|
|
Future<Either<Unit, FlowyError>> deleteAll() {
|
|
return FolderEventDeleteAllTrash().send();
|
|
}
|
|
}
|