From 6671f81a9ac0cf77562ab2350457a0199dde8d82 Mon Sep 17 00:00:00 2001 From: Luke Harding Date: Fri, 3 May 2024 16:20:48 -0400 Subject: [PATCH] Fix dsl again --- server/src/db/mod.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/server/src/db/mod.rs b/server/src/db/mod.rs index eaae32b..76c9e12 100644 --- a/server/src/db/mod.rs +++ b/server/src/db/mod.rs @@ -14,7 +14,7 @@ use uuid::Uuid; use models::Task; use crate::db::models::NewTask; -use crate::schema::tasks; +use crate::schema; pub mod models; @@ -33,7 +33,7 @@ pub fn run_migrations( } pub async fn get_tasks(database_url: String) -> Result, Box> { - use tasks::dsl::*; + use schema::tasks::dsl::*; let conn = &mut establish_connection(&database_url)?; @@ -41,14 +41,11 @@ pub async fn get_tasks(database_url: String) -> Result, Box Result> { - use tasks::dsl::*; + use schema::tasks::dsl::*; let conn = &mut establish_connection(&database_url)?; - Ok(tasks - .find(uuid) - .select(Task::as_select()) - .first(conn)?) + Ok(tasks.find(uuid).select(Task::as_select()).first(conn)?) } pub async fn create_task( @@ -67,14 +64,14 @@ pub async fn create_task( due_date, }; - Ok(diesel::insert_into(tasks::table) + Ok(diesel::insert_into(schema::tasks::table) .values(&new_task) .returning(Task::as_returning()) .get_result(conn)?) } pub async fn delete_task(database_url: String, uuid: Uuid) -> Result> { - use tasks::dsl::*; + use schema::tasks::dsl::*; let conn = &mut establish_connection(&database_url)?;