domain: add cross-cutting value objects (SystemId, DateTimeStamp, Checksum, StructuredData)

This commit is contained in:
2026-05-31 03:16:28 +02:00
parent f9cb142c3b
commit 3571c94bec
28 changed files with 320 additions and 122 deletions

View File

@@ -1,17 +1,16 @@
use chrono::{DateTime, Utc};
use crate::value_objects::{Email, PasswordHash, Role, UserId};
use crate::value_objects::{Email, PasswordHash, SystemId};
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct User {
pub id: UserId,
pub id: SystemId,
pub email: Email,
pub password_hash: PasswordHash,
pub role: Role,
pub created_at: DateTime<Utc>,
}
impl User {
pub fn new(id: UserId, email: Email, password_hash: PasswordHash) -> Self {
Self { id, email, password_hash, role: Role::User, created_at: Utc::now() }
pub fn new(id: SystemId, email: Email, password_hash: PasswordHash) -> Self {
Self { id, email, password_hash, created_at: Utc::now() }
}
}