//! # Users service use crate::db_connection; use crate::models::{NewUser, User}; use crate::schema::users; use crate::utils::time_utils::time; use diesel::prelude::*; /// Create a new account pub async fn create_account(name: &str, email: &str) -> anyhow::Result { db_connection::execute(|conn| { let res = diesel::insert_into(users::table) .values(&NewUser { name: name.trim(), email: email.trim(), time_create: time() as i64, }) .get_result(conn)?; Ok(res) }) }