chore: cleaning code

This commit is contained in:
Maulana Sodiqin
2025-05-20 01:49:50 +07:00
parent d97095a38d
commit 1e5ed26f76
19 changed files with 274 additions and 236 deletions
+1 -30
View File
@@ -1,31 +1,8 @@
use imphnen_iam::UsersSchema;
use imphnen_utils::{get_iso_date, hash_password, Env};
use serde::{Deserialize, Serialize};
use std::error::Error;
use surrealdb::{engine::remote::ws::Ws, opt::auth::Root, sql::Thing, Surreal};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct UsersSchema {
pub id: Thing,
pub fullname: String,
pub email: String,
pub password: String,
pub avatar: Option<String>,
pub phone_number: String,
pub referral_code: Option<String>,
pub referred_by: Option<String>,
pub identity_number: Option<String>,
pub is_active: bool,
pub is_deleted: bool,
pub student_type: String,
pub religion: Option<String>,
pub gender: Option<String>,
pub birthdate: Option<String>,
pub is_profile_completed: bool,
pub role: Thing,
pub created_at: String,
pub updated_at: String,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let env = Env::new();
@@ -68,16 +45,10 @@ async fn main() -> Result<(), Box<dyn Error>> {
password: hash_password("password").unwrap(),
avatar: None,
phone_number: "081234567890".into(),
referral_code: None,
referred_by: None,
identity_number: None,
is_active: true,
is_deleted: false,
student_type: "TNI".into(),
religion: None,
gender: None,
birthdate: None,
is_profile_completed: false,
role: Thing::from(("app_roles", role_id)),
created_at: get_iso_date(),
updated_at: get_iso_date(),