server: Delete all ingredients when deleting households
This commit is contained in:
parent
b354741245
commit
c64dcc1400
1 changed files with 4 additions and 0 deletions
|
|
@ -136,6 +136,10 @@ async fn delete_household(
|
|||
household: household::Model,
|
||||
txn: &DatabaseTransaction,
|
||||
) -> Result<(), RouteError> {
|
||||
for ingredient in household.find_related(Ingredient).all(txn).await? {
|
||||
ingredient.delete(txn).await?;
|
||||
}
|
||||
|
||||
household.delete(txn).await?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue