get complete session from login request instead of fetching again
This commit is contained in:
@@ -1,2 +1,28 @@
|
||||
use serde::Serialize;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::domain::warren::models::user::User;
|
||||
|
||||
pub mod auth;
|
||||
pub mod warrens;
|
||||
|
||||
#[derive(Debug, Clone, Serialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
/// A session user that can be safely sent to the client
|
||||
pub struct SessionUser {
|
||||
id: Uuid,
|
||||
name: String,
|
||||
email: String,
|
||||
admin: bool,
|
||||
}
|
||||
|
||||
impl From<User> for SessionUser {
|
||||
fn from(value: User) -> Self {
|
||||
Self {
|
||||
id: *value.id(),
|
||||
name: value.name().to_string(),
|
||||
email: value.email().to_string(),
|
||||
admin: value.admin(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user