Adds write script for recipes, adds ingredients migrations
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
use super::schema::recipes;
|
||||
use super::schema::ingredients;
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Recipe {
|
||||
pub id: i32,
|
||||
@@ -6,3 +9,24 @@ pub struct Recipe {
|
||||
pub ingredients: String,
|
||||
pub preparation: String,
|
||||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
#[table_name="recipes"]
|
||||
pub struct NewRecipe<'a> {
|
||||
pub title: &'a str,
|
||||
pub category: i32,
|
||||
pub ingredients: String,
|
||||
pub preparation: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Queryable)]
|
||||
pub struct Ingredient {
|
||||
pub id: i32,
|
||||
pub alias: String,
|
||||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
#[table_name="ingredients"]
|
||||
pub struct NewIngredient<'a> {
|
||||
pub alias: &'a str,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user