Recipe can now be scheduled

This commit is contained in:
Greg Burri 2025-02-04 22:29:56 +01:00
parent ae6da1a5ae
commit fbef990022
18 changed files with 233 additions and 51 deletions

View file

@ -752,7 +752,7 @@ VALUES ($1, $2)
Ok(())
}
pub async fn add_schedule_recipe(
pub async fn add_scheduled_recipe(
&self,
user_id: i64,
recipe_id: i64,
@ -775,7 +775,7 @@ VALUES ($1, $2, $3, $4)
.map_err(DBError::from)
}
pub async fn remove_scheduled_recipe(
pub async fn rm_scheduled_recipe(
&self,
user_id: i64,
recipe_id: i64,
@ -964,13 +964,13 @@ VALUES
let tomorrow = today + Days::new(1);
connection
.add_schedule_recipe(user_id, recipe_id_1, today, 4)
.add_scheduled_recipe(user_id, recipe_id_1, today, 4)
.await?;
connection
.add_schedule_recipe(user_id, recipe_id_2, yesterday, 4)
.add_scheduled_recipe(user_id, recipe_id_2, yesterday, 4)
.await?;
connection
.add_schedule_recipe(user_id, recipe_id_1, tomorrow, 4)
.add_scheduled_recipe(user_id, recipe_id_1, tomorrow, 4)
.await?;
assert_eq!(
@ -1008,13 +1008,13 @@ VALUES
);
connection
.remove_scheduled_recipe(user_id, recipe_id_1, today)
.rm_scheduled_recipe(user_id, recipe_id_1, today)
.await?;
connection
.remove_scheduled_recipe(user_id, recipe_id_2, yesterday)
.rm_scheduled_recipe(user_id, recipe_id_2, yesterday)
.await?;
connection
.remove_scheduled_recipe(user_id, recipe_id_1, tomorrow)
.rm_scheduled_recipe(user_id, recipe_id_1, tomorrow)
.await?;
assert_eq!(