broken only push user data

This commit is contained in:
filipriec
2025-03-24 21:46:04 +01:00
parent 8a248cab58
commit 70d83c284a
13 changed files with 608 additions and 6 deletions

34
server/src/auth/models.rs Normal file
View File

@@ -0,0 +1,34 @@
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use validator::Validate;
#[derive(Debug, Validate, Deserialize)]
pub struct RegisterRequest {
#[validate(length(min = 3, max = 30))]
pub username: String,
#[validate(email)]
pub email: String,
#[validate(length(min = 8))]
pub password: String,
pub password_confirmation: String,
}
#[derive(Debug, Serialize)]
pub struct AuthResponse {
pub id: Uuid,
pub username: String,
pub email: String,
pub role: 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),
}