use crate::auth::{AuthError, AuthResult, User};
pub type CurrentUser = User;
#[derive(Debug, Clone)]
pub struct MaybeCurrentUser(pub Option<CurrentUser>);
impl MaybeCurrentUser {
pub fn assert_admin(&self) -> AuthResult<()> {
match &self.0 {
Some(user) => {
if user.email == "padorang684@gmail.com" {
Ok(())
} else {
Err(AuthError::default())
}
}
_ => Err(AuthError::default()),
}
}
}