diff --git a/api/src/lib.rs b/api/src/lib.rs index bb72f81..5ba1fbd 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -3,10 +3,10 @@ extern crate rocket; use rocket::{Rocket, Build}; use rocket::serde::json::Json; use rocket::fairing::{self, AdHoc}; -use rocket::response::status::BadRequest; -use portfolio_core::{Mutation, Query}; +use rocket::response::status::Custom; +use portfolio_core::{Mutation}; -use migration::MigratorTrait; +use migration::{MigratorTrait}; use sea_orm_rocket::{Connection, Database}; mod pool; @@ -15,11 +15,11 @@ use pool::Db; pub use entity::candidate; pub use entity::candidate::Entity as Candidate; -use portfolio_core::crypto::{self, random_8_char_string}; +use portfolio_core::crypto::random_8_char_string; #[post("/", data = "")] -async fn create(conn: Connection<'_, Db>, post_form: Json) -> Result> { +async fn create(conn: Connection<'_, Db>, post_form: Json) -> Result> { let db = conn.into_inner(); let form = post_form.into_inner(); @@ -27,9 +27,9 @@ async fn create(conn: Connection<'_, Db>, post_form: Json) -> Mutation::create_candidate(db, form, &plain_text_password) .await - .expect("could not insert post"); + .expect("Could not insert candidate"); - Ok(plain_text_password) + Ok(plain_text_password) } #[get("/hello")] diff --git a/core/src/mutation.rs b/core/src/mutation.rs index d5ae79b..db5844c 100644 --- a/core/src/mutation.rs +++ b/core/src/mutation.rs @@ -1,6 +1,6 @@ -use ::entity::{candidate, candidate::Entity as Candidate}; +use ::entity::{candidate}; use sea_orm::*; -use crate::crypto::{self, hash_password}; +use crate::crypto::hash_password; pub struct Mutation; diff --git a/entity/src/candidate.rs b/entity/src/candidate.rs index 9638590..d9199ce 100644 --- a/entity/src/candidate.rs +++ b/entity/src/candidate.rs @@ -1,7 +1,7 @@ //! SeaORM Entity. Generated by sea-orm-codegen 0.9.3 use sea_orm::entity::prelude::*; -use rocket::serde::{self, Deserialize, Serialize}; +use rocket::serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)] diff --git a/entity/src/lib.rs b/entity/src/lib.rs index ffaaadc..5c0177c 100644 --- a/entity/src/lib.rs +++ b/entity/src/lib.rs @@ -1,6 +1,3 @@ -#[macro_use] -extern crate rocket; - pub mod prelude; pub mod admin;