diff --git a/apps/users/src/handlers/approvals.rs b/apps/users/src/handlers/approvals.rs index d721358..5b18604 100644 --- a/apps/users/src/handlers/approvals.rs +++ b/apps/users/src/handlers/approvals.rs @@ -96,7 +96,7 @@ async fn get_submission( "id": user.id, "name": user.name, "email": user.email, - "phone": user.phone, + "phone": null, "status": user.status, "email_verified": user.email_verified, "created_at": user.created_at, diff --git a/apps/users/src/handlers/auth.rs b/apps/users/src/handlers/auth.rs index 27e12a5..6701828 100644 --- a/apps/users/src/handlers/auth.rs +++ b/apps/users/src/handlers/auth.rs @@ -214,7 +214,6 @@ async fn register( let user = UserRepository::create(&state.pool, CreateUserPayload { name: full_name, email: email.clone(), - phone: payload.phone.filter(|p| !p.trim().is_empty()), password_hash, }) .await @@ -271,8 +270,8 @@ async fn register( Ok((StatusCode::CREATED, Json(RegisterResponse { user_id: user.id.to_string(), email: user.email, - phone: user.phone, - name: user.name.unwrap_or_default(), + phone: None, + name: user.name.unwrap_or_default(), status: user.status, email_verified: user.email_verified, created_at: user.created_at.to_rfc3339(), diff --git a/crates/db/src/models/user.rs b/crates/db/src/models/user.rs index d7a31bd..1e787f1 100644 --- a/crates/db/src/models/user.rs +++ b/crates/db/src/models/user.rs @@ -11,7 +11,6 @@ pub struct User { pub email: String, pub password_hash: String, pub name: Option, - pub phone: Option, pub email_verified: bool, pub phone_verified: bool, pub status: String, // ACTIVE, SUSPENDED, BANNED @@ -29,7 +28,6 @@ pub struct User { pub struct CreateUserPayload { pub name: String, pub email: String, - pub phone: Option, pub password_hash: String, } @@ -51,10 +49,10 @@ impl UserRepository { pub async fn create(pool: &PgPool, payload: CreateUserPayload) -> Result { let user = sqlx::query_as::<_, User>( r#" - INSERT INTO users (name, email, phone, password_hash, email_verified, phone_verified) - VALUES ($1, $2, $3, $4, false, false) + INSERT INTO users (name, email, password_hash, email_verified, phone_verified) + VALUES ($1, $2, $3, false, false) RETURNING - id, email, password_hash, name, phone, + id, email, password_hash, name, email_verified, phone_verified, status, email_verification_token, email_verification_expires_at, reset_password_token, reset_password_expires_at, @@ -63,7 +61,6 @@ impl UserRepository { ) .bind(&payload.name) .bind(payload.email.to_lowercase()) - .bind(payload.phone) .bind(payload.password_hash) .fetch_one(pool) .await?; @@ -74,7 +71,7 @@ impl UserRepository { pub async fn get_by_email(pool: &PgPool, email: &str) -> Result { sqlx::query_as::<_, User>( r#" - SELECT id, email, password_hash, name, phone, + SELECT id, email, password_hash, name, email_verified, phone_verified, status, email_verification_token, email_verification_expires_at, reset_password_token, reset_password_expires_at, @@ -91,7 +88,7 @@ impl UserRepository { pub async fn get_by_id(pool: &PgPool, id: Uuid) -> Result { sqlx::query_as::<_, User>( r#" - SELECT id, email, password_hash, name, phone, + SELECT id, email, password_hash, name, email_verified, phone_verified, status, email_verification_token, email_verification_expires_at, reset_password_token, reset_password_expires_at, @@ -148,7 +145,7 @@ impl UserRepository { pub async fn get_by_verification_token(pool: &PgPool, token: &str) -> Result { sqlx::query_as::<_, User>( r#" - SELECT id, email, password_hash, name, phone, + SELECT id, email, password_hash, name, email_verified, phone_verified, status, email_verification_token, email_verification_expires_at, reset_password_token, reset_password_expires_at, @@ -196,7 +193,7 @@ impl UserRepository { pub async fn get_by_reset_token(pool: &PgPool, token: &str) -> Result { sqlx::query_as::<_, User>( r#" - SELECT id, email, password_hash, name, phone, + SELECT id, email, password_hash, name, email_verified, phone_verified, status, email_verification_token, email_verification_expires_at, reset_password_token, reset_password_expires_at,