diff --git a/Cargo.toml b/Cargo.toml index 57d09c9..111794b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,12 +3,6 @@ name = "alexandria" version = "0.1.0" edition = "2024" -[profile.release] -opt-level = 'z' # Optimize for size -lto = true # Enable link-time optimization -codegen-units = 1 # Reduce number of codegen units to increase optimizations -strip = true # Strip symbols from binary* - [dependencies] axum = { version = "0.8.4", features = [ "macros", "ws", "tokio" ] } axum-extra = { version = "0.10.1", features = ["typed-header"] } diff --git a/src/utils/cli.rs b/src/utils/cli.rs index 55722a6..0c1ce3e 100644 --- a/src/utils/cli.rs +++ b/src/utils/cli.rs @@ -1,11 +1,11 @@ use std::{fmt::Display, sync::Arc}; use argon2::{password_hash::{SaltString}, Argon2, PasswordHasher}; -use inquire::{min_length, prompt_text, Confirm, Password, Select, Text}; +use inquire::{min_length, Confirm, Password, Select, Text}; use password_hash::rand_core::OsRng; use sea_orm::{ActiveModelTrait, ActiveValue::{NotSet, Set}, ColumnTrait, DatabaseConnection, EntityTrait, ModelTrait, QueryFilter}; -use crate::entities::{owner, prelude::User, user::{self, ActiveModel}}; +use crate::entities::{prelude::User, user::{self, ActiveModel}}; #[derive(Debug, Copy, Clone)] enum Action { @@ -66,21 +66,7 @@ pub async fn manage_users(db: Arc) { username: Set(username), hashed_password: Set(hash_password(password)) }; - let res = new_user.insert(db.as_ref()).await.unwrap(); - - if Confirm::new("Add an owner corresponding to this user ?").with_default(true).prompt().is_ok_and(|choice| choice==true) { - let first_name = prompt_text("First Name: ").unwrap(); - let last_name = prompt_text("Last Name: ").unwrap(); - let contact = prompt_text("Contact: ").unwrap(); - let new_owner = owner::ActiveModel { - id: NotSet, - user_id: Set(res.id), - first_name: Set(first_name), - last_name: Set(last_name), - contact: Set(contact) - }; - let _ = new_owner.insert(db.as_ref()).await.unwrap(); - } + let _ = new_user.insert(db.as_ref()).await; } }, Action::Delete => {