Creates a simple planning

This commit is contained in:
2019-01-30 14:21:37 +01:00
parent 874a9f86f8
commit 5e92e30f51
6 changed files with 45 additions and 2 deletions

View File

@@ -21,6 +21,18 @@ pub fn establish_connection() -> SqliteConnection {
.expect(&format!("Error connecting to {}", db_url))
}
pub mod recipes {
use crate::models::{Recipe, NewRecipe};
use super::{SqliteConnection, schema};
use super::diesel::prelude::*;
pub fn load_all(conn: &SqliteConnection) -> Vec<Recipe> {
use self::schema::recipes::dsl::*;
recipes.load::<Recipe>(conn)
.expect("Error loading recipe's list")
}
}
pub mod ingredients {
use crate::models::{Ingredient, NewIngredient};