list archive
This commit is contained in:
@@ -199,6 +199,13 @@ impl ListService {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn list_archived_summaries(&self) -> DomainResult<Vec<GroceryList>> {
|
||||
let lists = Arc::clone(&self.lists);
|
||||
self.db
|
||||
.run(move |txn| Box::pin(async move { lists.list_archived_summaries(txn).await }))
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_list(&self, name: String) -> DomainResult<GroceryList> {
|
||||
let lists = Arc::clone(&self.lists);
|
||||
self.db
|
||||
@@ -213,6 +220,20 @@ impl ListService {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn archive_list(&self, list_id: i64) -> DomainResult<()> {
|
||||
let lists = Arc::clone(&self.lists);
|
||||
self.db
|
||||
.run(move |txn| Box::pin(async move { lists.set_archived(txn, list_id, true).await }))
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn unarchive_list(&self, list_id: i64) -> DomainResult<()> {
|
||||
let lists = Arc::clone(&self.lists);
|
||||
self.db
|
||||
.run(move |txn| Box::pin(async move { lists.set_archived(txn, list_id, false).await }))
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn items(&self, list_id: i64) -> DomainResult<Vec<Item>> {
|
||||
let items = Arc::clone(&self.items);
|
||||
self.db
|
||||
|
||||
Reference in New Issue
Block a user