use super::User;
use crate::schema::*;
use crate::Permissions;
#[derive(Clone, Debug, Hash, PartialEq, Eq, Ord, PartialOrd)]
#[cfg_attr(
feature = "diesel-support",
derive(Queryable, Insertable, Identifiable),
primary_key(username),
table_name = "login_users"
)]
pub struct DieselUser {
pub username: String,
pub password: String,
pub permissions: Permissions,
}
impl From<User> for DieselUser {
fn from(them: User) -> Self {
Self {
username: them.username,
password: them.password,
permissions: them.permissions,
}
}
}
impl From<DieselUser> for User {
fn from(them: DieselUser) -> Self {
Self {
username: them.username,
password: them.password,
permissions: them.permissions,
logged_in: None,
expire: None,
}
}
}