mirror of
https://github.com/zaphar/kitchen.git
synced 2025-07-22 19:40:14 -04:00
Clean plan data on plan save
This commit is contained in:
parent
55cfb013a8
commit
2ffb3be114
@ -490,6 +490,16 @@
|
|||||||
},
|
},
|
||||||
"query": "select session_value from sessions where id = ?"
|
"query": "select session_value from sessions where id = ?"
|
||||||
},
|
},
|
||||||
|
"93af0c367a0913d49c92aa69022fa30fc0564bd4dbab7f3ae78673a01439cd6e": {
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"nullable": [],
|
||||||
|
"parameters": {
|
||||||
|
"Right": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"query": "delete from plan_recipes where user_id = ? and plan_date = ?"
|
||||||
|
},
|
||||||
"95fbc362a2e17add05218a2dac431275b5cc55bd7ac8f4173ee10afefceafa3b": {
|
"95fbc362a2e17add05218a2dac431275b5cc55bd7ac8f4173ee10afefceafa3b": {
|
||||||
"describe": {
|
"describe": {
|
||||||
"columns": [
|
"columns": [
|
||||||
|
@ -534,6 +534,13 @@ impl APIStore for SqliteStore {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let user_id = user_id.as_ref();
|
let user_id = user_id.as_ref();
|
||||||
let mut transaction = self.pool.as_ref().begin().await?;
|
let mut transaction = self.pool.as_ref().begin().await?;
|
||||||
|
sqlx::query!(
|
||||||
|
"delete from plan_recipes where user_id = ? and plan_date = ?",
|
||||||
|
user_id,
|
||||||
|
date,
|
||||||
|
)
|
||||||
|
.execute(&mut transaction)
|
||||||
|
.await?;
|
||||||
for (id, count) in recipe_counts {
|
for (id, count) in recipe_counts {
|
||||||
sqlx::query_file!(
|
sqlx::query_file!(
|
||||||
"src/web/storage/save_meal_plan.sql",
|
"src/web/storage/save_meal_plan.sql",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user