31 lines
636 B
Rust
31 lines
636 B
Rust
use serde::Serialize;
|
|
use uuid::Uuid;
|
|
|
|
use crate::domain::warren::models::user::User;
|
|
|
|
pub mod admin;
|
|
pub mod auth;
|
|
pub mod extractors;
|
|
pub mod warrens;
|
|
|
|
#[derive(Debug, Clone, Serialize, PartialEq)]
|
|
#[serde(rename_all = "camelCase")]
|
|
/// A user that can be safely sent to the client
|
|
pub(super) struct UserData {
|
|
id: Uuid,
|
|
name: String,
|
|
email: String,
|
|
admin: bool,
|
|
}
|
|
|
|
impl From<User> for UserData {
|
|
fn from(value: User) -> Self {
|
|
Self {
|
|
id: *value.id(),
|
|
name: value.name().to_string(),
|
|
email: value.email().to_string(),
|
|
admin: value.admin(),
|
|
}
|
|
}
|
|
}
|