Implement deletion of shopping list items (#163)

* Disable unstable Gradle features

* Implement deletion of shopping list items

* Hide deleted items even before they're deleted

* Check/uncheck items locally while the BE is updated
This commit is contained in:
Kirill Kamakin
2023-07-15 21:55:06 +02:00
committed by GitHub
parent 950805aa55
commit 3ae784df97
14 changed files with 192 additions and 83 deletions

View File

@@ -64,4 +64,6 @@ interface MealieDataSourceV1 {
suspend fun getShoppingList(id: String): GetShoppingListResponseV1
suspend fun updateIsShoppingListItemChecked(id: String, isChecked: Boolean)
suspend fun deleteShoppingListItem(id: String)
}

View File

@@ -188,4 +188,12 @@ class MealieDataSourceV1Impl @Inject constructor(
}
updateShoppingListItem(id, JsonObject(updatedItem))
}
override suspend fun deleteShoppingListItem(
id: String,
) = networkRequestWrapper.makeCallAndHandleUnauthorized(
block = { service.deleteShoppingListItem(id) },
logMethod = { "deleteShoppingListItem" },
logParameters = { "id = $id" }
)
}

View File

@@ -89,4 +89,9 @@ interface MealieServiceV1 {
@Path("id") id: String,
@Body request: JsonElement,
)
@DELETE("/api/groups/shopping/items/{id}")
suspend fun deleteShoppingListItem(
@Path("id") id: String,
)
}