Tweaked user file for warning and set err to path

This commit is contained in:
Franklin 2023-10-03 08:01:21 -04:00
parent c784889623
commit 55b1ad0029
3 changed files with 6 additions and 8 deletions

1
Cargo.lock generated
View File

@ -280,7 +280,6 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]] [[package]]
name = "err" name = "err"
version = "0.1.1" version = "0.1.1"
source = "git+https://git.franklinblanco.dev/franklinblanco/err.git#18cc77b6266d0fc90237a7ccb297d3eeb574f78a"
dependencies = [ dependencies = [
"serde", "serde",
"sqlx", "sqlx",

View File

@ -19,4 +19,4 @@ data-encoding = "2.3.2"
futures-util = "0.3" futures-util = "0.3"
log = "0.4.19" log = "0.4.19"
err = { git = "https://git.franklinblanco.dev/franklinblanco/err.git" } err = { path = "/Users/franklinblanco/Desktop/Code/rust/libs/dev-deps/err" }

View File

@ -15,7 +15,7 @@ use crate::validation::user_validator::validate_user_for_creation;
use chrono::Utc; use chrono::Utc;
use err::{trace, Error, ErrorType, ServiceError, ValidationError, x_u_res_db_or_res, u_res_or_res}; use err::{trace, Error, ErrorType, ServiceError, ValidationError, x_u_res_db_or_res, u_res_or_res};
use log::error; use log::error;
use sqlx::{PgConnection, Postgres, Transaction}; use sqlx::PgConnection;
pub async fn register_user<'a>( pub async fn register_user<'a>(
transaction: &mut PgConnection, transaction: &mut PgConnection,
@ -144,9 +144,8 @@ pub async fn force_reset_password<'a>(
Ok(u_res_or_res!(change_password(conn, persisted_user, &new_password).await)) Ok(u_res_or_res!(change_password(conn, persisted_user, &new_password).await))
} }
/// pub async fn password_login(
pub async fn password_login<'a>( conn: &mut PgConnection,
conn: &mut Transaction<'a, Postgres>,
user: UserLoginPayload, user: UserLoginPayload,
) -> Result<Token, Error> { ) -> Result<Token, Error> {
let persisted_user_credential = match x_u_res_db_or_res!(get_credential(conn, user.credential.clone()).await) { let persisted_user_credential = match x_u_res_db_or_res!(get_credential(conn, user.credential.clone()).await) {
@ -166,8 +165,8 @@ pub async fn password_login<'a>(
} }
/// ///
pub async fn get_user_credentials<'a>( pub async fn get_user_credentials(
transaction: &mut Transaction<'a, Postgres>, transaction: &mut PgConnection,
user: AuthenticateUserDto, user: AuthenticateUserDto,
) -> Result<Vec<Credential>, Error> { ) -> Result<Vec<Credential>, Error> {
let persisted_user = u_res_or_res!(authenticate_user(transaction, user).await); let persisted_user = u_res_or_res!(authenticate_user(transaction, user).await);