Compare commits
	
		
			No commits in common. "af579811a9bb9a3eb84140650981d779d47bd0a3" and "528f40c58a25a62879a3b7f377883cb536ed5ffd" have entirely different histories.
		
	
	
		
			af579811a9
			...
			528f40c58a
		
	
		
					 2 changed files with 3 additions and 23 deletions
				
			
		|  | @ -3,12 +3,6 @@ name = "alexandria" | ||||||
| version = "0.1.0" | version = "0.1.0" | ||||||
| edition = "2024" | 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] | [dependencies] | ||||||
| axum = { version = "0.8.4", features = [ "macros", "ws", "tokio" ] } | axum = { version = "0.8.4", features = [ "macros", "ws", "tokio" ] } | ||||||
| axum-extra = { version = "0.10.1", features = ["typed-header"] } | axum-extra = { version = "0.10.1", features = ["typed-header"] } | ||||||
|  |  | ||||||
|  | @ -1,11 +1,11 @@ | ||||||
| use std::{fmt::Display, sync::Arc}; | use std::{fmt::Display, sync::Arc}; | ||||||
| 
 | 
 | ||||||
| use argon2::{password_hash::{SaltString}, Argon2, PasswordHasher}; | 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 password_hash::rand_core::OsRng; | ||||||
| use sea_orm::{ActiveModelTrait, ActiveValue::{NotSet, Set}, ColumnTrait, DatabaseConnection, EntityTrait, ModelTrait, QueryFilter}; | 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)] | #[derive(Debug, Copy, Clone)] | ||||||
| enum Action { | enum Action { | ||||||
|  | @ -66,21 +66,7 @@ pub async fn manage_users(db: Arc<DatabaseConnection>) { | ||||||
|                                 username: Set(username), |                                 username: Set(username), | ||||||
|                                 hashed_password: Set(hash_password(password)) |                                 hashed_password: Set(hash_password(password)) | ||||||
|                             }; |                             }; | ||||||
|                             let res = new_user.insert(db.as_ref()).await.unwrap(); |                             let _ = new_user.insert(db.as_ref()).await; | ||||||
| 
 |  | ||||||
|                             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(); |  | ||||||
|                             } |  | ||||||
|                         } |                         } | ||||||
|                     }, |                     }, | ||||||
|                     Action::Delete => { |                     Action::Delete => { | ||||||
|  |  | ||||||
		Reference in a new issue