get complete session from login request instead of fetching again

This commit is contained in:
2025-07-18 14:05:19 +02:00
parent fe6cf2fb53
commit 4c3e54daca
9 changed files with 102 additions and 76 deletions

View File

@@ -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(),
}
}
}