deleteProject method

  1. @override
Future<Either<Failure, bool>> deleteProject(
  1. String id
)
override

Implementation

@override
Future<Either<Failure, bool>> deleteProject(String id) async {
  try {
    if (await isConnected()) {
      final result = await remoteDataSource.deleteProjects(id);
      await localDataSource.deleteProject(id);
      return Right(result);
    } else {
      await localDataSource.deleteProject(id);
      await syncQueue.addOperation(SyncOperation(
          type: 'delete', id: id, entityType: 'project', data: {}));
      return const Right(true);
    }
  } catch (e) {
    return const Left(ServerFailure(message: 'Failed to delete project'));
  }
}