feat: Start dummy in-memory database

This commit is contained in:
selfhoster selfhoster 2026-09-01 19:06:33 +02:00
commit bdb5008914
9 changed files with 181 additions and 3 deletions

37
src/db/user.rs Normal file
View file

@ -0,0 +1,37 @@
use std::fmt;
#[derive(Clone, Debug)]
pub struct UserRef {
pub username: String,
pub domain: String,
}
impl fmt::Display for UserRef {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}@{}", self.username, self.domain)
}
}
#[derive(Clone, Debug)]
pub struct User {
pub username: String,
pub domain: String,
pub password: String,
pub mail: String,
// recovery_mail: String,
}
impl User {
pub fn user_ref(&self) -> UserRef {
UserRef {
username: self.username.clone(),
domain: self.domain.clone(),
}
}
}
impl fmt::Display for User {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}@{}", self.username, self.domain)
}
}