Recipe can now be scheduled
This commit is contained in:
parent
ae6da1a5ae
commit
fbef990022
18 changed files with 233 additions and 51 deletions
|
|
@ -17,7 +17,7 @@ pub struct Id {
|
|||
pub id: i64,
|
||||
}
|
||||
|
||||
/// RECIPE ///
|
||||
/*** RECIPE ***/
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeTitle {
|
||||
|
|
@ -159,7 +159,7 @@ pub struct Ingredient {
|
|||
pub quantity_unit: String,
|
||||
}
|
||||
|
||||
/// PROFILE ///
|
||||
/*** PROFILE ***/
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct UpdateProfile {
|
||||
|
|
@ -168,6 +168,29 @@ pub struct UpdateProfile {
|
|||
pub password: Option<String>,
|
||||
}
|
||||
|
||||
/*** Calendar ***/
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ScheduledRecipes {
|
||||
// (Scheduled date, recipe title, recipe id).
|
||||
pub recipes: Vec<(NaiveDate, String, i64)>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ScheduleRecipe {
|
||||
pub recipe_id: i64,
|
||||
pub date: NaiveDate,
|
||||
pub servings: u32,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ScheduledRecipe {
|
||||
pub recipe_id: i64,
|
||||
pub date: NaiveDate,
|
||||
}
|
||||
|
||||
/*** Misc ***/
|
||||
|
||||
pub fn to_string<T>(ron: T) -> String
|
||||
where
|
||||
T: Serialize,
|
||||
|
|
@ -175,11 +198,3 @@ where
|
|||
// TODO: handle'unwrap'.
|
||||
to_string_pretty(&ron, PrettyConfig::new()).unwrap()
|
||||
}
|
||||
|
||||
/// Calendar ///
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct ScheduledRecipes {
|
||||
// (Scheduled date, recipe title, recipe id).
|
||||
pub recipes: Vec<(NaiveDate, String, i64)>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue