server: Delete all ingredients when deleting households

This commit is contained in:
traxys 2023-06-17 18:19:16 +02:00
parent b354741245
commit c64dcc1400

View file

@ -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(())