2021-10-12 22:31:38 +08:00
|
|
|
use crate::{
|
|
|
|
entities::{trash::RepeatedTrash, view::RepeatedView},
|
|
|
|
errors::WorkspaceError,
|
2021-10-13 11:10:29 +08:00
|
|
|
services::TrashCan,
|
2021-10-12 22:31:38 +08:00
|
|
|
};
|
|
|
|
use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
|
|
|
|
use std::{convert::TryInto, sync::Arc};
|
|
|
|
|
|
|
|
#[tracing::instrument(skip(data, controller), err)]
|
2021-10-13 11:10:29 +08:00
|
|
|
pub(crate) async fn read_trash_handler(controller: Unit<Arc<TrashCan>>) -> DataResult<RepeatedTrash, WorkspaceError> {
|
2021-10-12 22:31:38 +08:00
|
|
|
let repeated_trash = controller.read_trash()?;
|
|
|
|
data_result(repeated_trash)
|
|
|
|
}
|