we compiled
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
// src/auth/handlers/register.rs
|
||||
|
||||
use bcrypt::{hash, DEFAULT_COST};
|
||||
use tonic::{Request, Response, Status};
|
||||
use uuid::Uuid;
|
||||
use crate::{auth::{models::{RegisterRequest, AuthResponse, AuthError}, db::PgPool}};
|
||||
use common::proto::multieko2::auth::{auth_service_server, RegisterRequest, AuthResponse};
|
||||
use crate::db::PgPool;
|
||||
use crate::auth::models::AuthError;
|
||||
|
||||
pub struct AuthService {
|
||||
pool: PgPool,
|
||||
@@ -14,11 +17,11 @@ impl AuthService {
|
||||
}
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl multieko2::auth::auth_service_server::AuthService for AuthService {
|
||||
impl auth_service_server::AuthService for AuthService {
|
||||
async fn register(
|
||||
&self,
|
||||
request: Request<multieko2::auth::RegisterRequest>,
|
||||
) -> Result<Response<multieko2::auth::AuthResponse>, Status> {
|
||||
request: Request<RegisterRequest>,
|
||||
) -> Result<Response<AuthResponse>, Status> {
|
||||
let payload = request.into_inner();
|
||||
|
||||
// Validate passwords match
|
||||
@@ -51,10 +54,10 @@ impl multieko2::auth::auth_service_server::AuthService for AuthService {
|
||||
}
|
||||
})?;
|
||||
|
||||
Ok(Response::new(multieko2::auth::AuthResponse {
|
||||
Ok(Response::new(AuthResponse {
|
||||
id: user.id.to_string(),
|
||||
username: user.username,
|
||||
email: user.email,
|
||||
email: user.email.unwrap_or_default(),
|
||||
role: user.role,
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user