44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
//! Request and Response DTOs
|
|
//!
|
|
//! Data Transfer Objects for the API.
|
|
//! Uses domain newtypes for validation instead of the validator crate.
|
|
|
|
use chrono::{DateTime, Utc};
|
|
use domain::{Email, Password};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
/// Login request with validated email and password newtypes
|
|
#[derive(Debug, Deserialize)]
|
|
#[allow(dead_code)]
|
|
pub struct LoginRequest {
|
|
/// Email is validated on deserialization
|
|
pub email: Email,
|
|
/// Password is validated on deserialization (min 6 chars)
|
|
pub password: Password,
|
|
}
|
|
|
|
/// Register request with validated email and password newtypes
|
|
#[derive(Debug, Deserialize)]
|
|
#[allow(dead_code)]
|
|
pub struct RegisterRequest {
|
|
/// Email is validated on deserialization
|
|
pub email: Email,
|
|
/// Password is validated on deserialization (min 6 chars)
|
|
pub password: Password,
|
|
}
|
|
|
|
/// User response DTO
|
|
#[derive(Debug, Serialize)]
|
|
pub struct UserResponse {
|
|
pub id: Uuid,
|
|
pub email: String,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
/// System configuration response
|
|
#[derive(Debug, Serialize)]
|
|
pub struct ConfigResponse {
|
|
pub allow_registration: bool,
|
|
}
|