mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 01:54:37 +00:00 
			
		
		
		
	 5facb61e23
			
		
	
	
		5facb61e23
		
			
		
	
	
	
	
		
			
			* chore: rename flowy-folder2 to flowy-folder * chore: rename flowy-document2 to flowy-document * chore: fix test * chore: move lib-infra crate * chore: remove shared-lib * chore: fix clippy
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.0 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 FolderEventListTrashItems().send();
 | |
|   }
 | |
| 
 | |
|   Future<Either<Unit, FlowyError>> putback(String trashId) {
 | |
|     final id = TrashIdPB.create()..id = trashId;
 | |
| 
 | |
|     return FolderEventRestoreTrashItem(id).send();
 | |
|   }
 | |
| 
 | |
|   Future<Either<Unit, FlowyError>> deleteViews(List<String> trash) {
 | |
|     final items = trash.map((trash) {
 | |
|       return TrashIdPB.create()..id = trash;
 | |
|     });
 | |
| 
 | |
|     final ids = RepeatedTrashIdPB(items: items);
 | |
|     return FolderEventPermanentlyDeleteTrashItem(ids).send();
 | |
|   }
 | |
| 
 | |
|   Future<Either<Unit, FlowyError>> restoreAll() {
 | |
|     return FolderEventRecoverAllTrashItems().send();
 | |
|   }
 | |
| 
 | |
|   Future<Either<Unit, FlowyError>> deleteAll() {
 | |
|     return FolderEventPermanentlyDeleteAllTrashItem().send();
 | |
|   }
 | |
| }
 |