// src/auth/models.rs use serde::{Deserialize, Serialize}; use validator::Validate; #[derive(Debug, Validate, Deserialize)] pub struct RegisterRequest { #[validate(length(min = 1, max = 30))] pub username: String, #[validate(email)] pub email: String, #[validate(length(min = 1))] pub password: String, pub password_confirmation: String, } #[derive(Debug, thiserror::Error)] pub enum AuthError { #[error("Passwords do not match")] PasswordMismatch, #[error("User already exists")] UserExists, #[error("Database error: {0}")] DatabaseError(String), #[error("Hashing error: {0}")] HashingError(String), }