Minor refactoring
This commit is contained in:
@@ -21,22 +21,6 @@ pub fn establish_connection() -> SqliteConnection {
|
||||
.expect(&format!("Error connecting to {}", db_url))
|
||||
}
|
||||
|
||||
pub fn create_recipe(conn: &SqliteConnection, title: &str, ingdts: &str) -> usize {
|
||||
use self::schema::recipes;
|
||||
|
||||
let new_recipe = NewRecipe {
|
||||
title: title,
|
||||
category: 0,
|
||||
ingredients: ingdts.to_string(),
|
||||
preparation: &String::new(),
|
||||
};
|
||||
|
||||
diesel::insert_into(recipes::table)
|
||||
.values(&new_recipe)
|
||||
.execute(conn)
|
||||
.expect("Error inserting recipe")
|
||||
|
||||
}
|
||||
|
||||
pub mod ingredients {
|
||||
use crate::models::{Ingredient, NewIngredient};
|
||||
|
||||
Reference in New Issue
Block a user