init: scaffold from k-template with postgres + worker
This commit is contained in:
2
crates/domain/src/entities/mod.rs
Normal file
2
crates/domain/src/entities/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
mod user;
|
||||
pub use user::User;
|
||||
17
crates/domain/src/entities/user.rs
Normal file
17
crates/domain/src/entities/user.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use chrono::{DateTime, Utc};
|
||||
use crate::value_objects::{Email, PasswordHash, Role, UserId};
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct User {
|
||||
pub id: UserId,
|
||||
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() }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user