Lang change

This commit is contained in:
KD
2025-03-09 00:54:02 +00:00
parent f7720f151b
commit c4d636ee4d
10 changed files with 155 additions and 29 deletions

42
src/user.rs Normal file
View File

@@ -0,0 +1,42 @@
use std::default::Default;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct User {
pub id: i32,
pub username: String,
pub password: String,
pub email: String,
pub phone: String,
pub firstname: String,
pub lastname: String,
pub email_verified: bool,
pub date_created: String,
pub status: String,
pub last_login: String,
}
impl Default for User {
fn default() -> Self {
User {
id: -1,
username: String::new(),
password: String::new(),
email: String::new(),
phone: String::new(),
firstname: String::new(),
lastname: String::new(),
email_verified: false,
date_created: String::new(),
status: String::new(),
last_login: String::new(),
}
}
}
impl User {
pub fn _to_json(&self) -> Result<String, serde_json::Error> {
return serde_json::to_string_pretty(&self);
}
}