Minor refactoring

This commit is contained in:
2019-01-29 21:44:05 +01:00
parent 4576ffb03b
commit 874a9f86f8
4 changed files with 31 additions and 23 deletions

View File

@@ -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};