Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de4c698836 | ||
|
|
db9d6f164e | ||
|
|
647bb6a379 | ||
|
|
0c0e1bdde3 |
No files matched your search
@@ -17,7 +17,7 @@ jobs:
|
|||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.97
|
toolchain: 1.99
|
||||||
components: cargo
|
components: cargo
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.97
|
toolchain: 1.99
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:18.4-alpine
|
image: postgres:18.6-alpine
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: ${{ secrets.DB_TEST_USER || 'testuser' }}
|
POSTGRES_USER: ${{ secrets.DB_TEST_USER || 'testuser' }}
|
||||||
POSTGRES_PASSWORD: ${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}
|
POSTGRES_PASSWORD: ${{ secrets.DB_TEST_PASSWORD || 'testpassword' }}
|
||||||
@@ -49,7 +49,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.97
|
toolchain: 1.99
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- name: Verify Docker Environment
|
- name: Verify Docker Environment
|
||||||
run: |
|
run: |
|
||||||
@@ -88,7 +88,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.97
|
toolchain: 1.99
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: rustup component add rustfmt
|
- run: rustup component add rustfmt
|
||||||
- run: |
|
- run: |
|
||||||
@@ -108,7 +108,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.97
|
toolchain: 1.99
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: rustup component add clippy
|
- run: rustup component add clippy
|
||||||
- run: |
|
- run: |
|
||||||
@@ -128,7 +128,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: 1.97
|
toolchain: 1.99
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
|
|||||||
Generated
+210
-267
File diff suppressed because it is too large.
Load diff
+9
-9
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "soaricarus_auth"
|
name = "soaricarus_auth"
|
||||||
version = "0.8.3"
|
version = "0.8.6"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
rust-version = "1.95"
|
rust-version = "1.95"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
@@ -10,20 +10,20 @@ description = "Auth API for soaricarus"
|
|||||||
axum = { version = "0.8.9" }
|
axum = { version = "0.8.9" }
|
||||||
openssl = { version = "0.10.81", features = ["vendored"] }
|
openssl = { version = "0.10.81", features = ["vendored"] }
|
||||||
serde = { version = "1.0.229", features = ["derive"] }
|
serde = { version = "1.0.229", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.151" }
|
serde_json = { version = "1.0.154" }
|
||||||
tokio = { version = "1.53.1", features = ["rt-multi-thread"] }
|
tokio = { version = "1.54.1", features = ["rt-multi-thread"] }
|
||||||
tracing-subscriber = { version = "0.3.23" }
|
tracing-subscriber = { version = "0.3.23" }
|
||||||
tower = { version = "0.5.3", features = ["full"] }
|
tower = { version = "0.5.3", features = ["full"] }
|
||||||
tower-http = { version = "0.7.0", features = ["cors"] }
|
tower-http = { version = "0.7.1", features = ["cors"] }
|
||||||
sqlx = { version = "0.9.0", features = ["postgres", "runtime-tokio", "tls-native-tls", "time", "uuid"] }
|
sqlx = { version = "0.9.0", features = ["postgres", "runtime-tokio", "tls-native-tls", "time", "uuid"] }
|
||||||
uuid = { version = "1.24.1", features = ["v4", "serde"] }
|
uuid = { version = "1.29.0", features = ["v4", "serde"] }
|
||||||
argon2 = { version = "0.5.3", features = ["std"] }
|
argon2 = { version = "0.5.3", features = ["std"] }
|
||||||
time = { version = "0.3.55", features = ["macros", "serde"] }
|
time = { version = "0.3.55", features = ["macros", "serde"] }
|
||||||
josekit = { version = "0.10.3" }
|
josekit = { version = "0.10.3" }
|
||||||
utoipa = { version = "5.5.0", features = ["axum_extras"] }
|
utoipa = { version = "6.0.0", features = ["axum_extras", "uuid", "time"] }
|
||||||
utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] }
|
utoipa-swagger-ui = { version = "10.0.2", features = ["axum"] }
|
||||||
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.6" }
|
simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.7" }
|
||||||
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.1" }
|
sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.2" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
http-body-util = { version = "0.1.5" }
|
http-body-util = { version = "0.1.5" }
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM rust:1.97 as builder
|
FROM rust:1.99 as builder
|
||||||
|
|
||||||
# Set the working directory inside the container
|
# Set the working directory inside the container
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|||||||
+1
-3
@@ -1,5 +1,3 @@
|
|||||||
version: '3.8' # Use a recent version
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
auth_api:
|
auth_api:
|
||||||
build:
|
build:
|
||||||
@@ -16,7 +14,7 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
auth_db:
|
auth_db:
|
||||||
image: postgres:18.4-alpine
|
image: postgres:18.6-alpine
|
||||||
container_name: soaricarus_auth_db
|
container_name: soaricarus_auth_db
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: ${POSTGRES_AUTH_USER:-soaricarus_op}
|
POSTGRES_USER: ${POSTGRES_AUTH_USER:-soaricarus_op}
|
||||||
|
|||||||
@@ -79,6 +79,16 @@ pub mod response {
|
|||||||
pub data: Vec<uuid::Uuid>,
|
pub data: Vec<uuid::Uuid>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub mod get_user_profile {
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Default, Deserialize, Serialize, utoipa::ToSchema)]
|
||||||
|
pub struct GetUserProfileResponse {
|
||||||
|
pub message: String,
|
||||||
|
pub data: Vec<simodels::user::UserProfile>,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Module for login endpoints
|
/// Module for login endpoints
|
||||||
@@ -388,4 +398,51 @@ pub mod endpoint {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Endpoint to get user profile
|
||||||
|
#[utoipa::path(
|
||||||
|
get,
|
||||||
|
path = super::super::endpoints::GET_USER_PROFILE,
|
||||||
|
params(("id" = uuid::Uuid, Path, description = "Get user profile")),
|
||||||
|
responses(
|
||||||
|
(status = 200, description = "User profile found", body = super::response::get_user_profile::GetUserProfileResponse),
|
||||||
|
(status = 404, description = "Song not found", body = super::response::get_user_profile::GetUserProfileResponse),
|
||||||
|
(status = 400, description = "Error downloading song", body = super::response::get_user_profile::GetUserProfileResponse),
|
||||||
|
)
|
||||||
|
)]
|
||||||
|
pub async fn get_user_profile(
|
||||||
|
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||||
|
axum::extract::Path(id): axum::extract::Path<uuid::Uuid>,
|
||||||
|
) -> (
|
||||||
|
axum::http::StatusCode,
|
||||||
|
axum::Json<super::response::get_user_profile::GetUserProfileResponse>,
|
||||||
|
) {
|
||||||
|
let mut response = super::response::get_user_profile::GetUserProfileResponse::default();
|
||||||
|
if id.is_nil() {
|
||||||
|
response.message = "Invalid request".to_string();
|
||||||
|
(axum::http::StatusCode::BAD_REQUEST, axum::Json(response))
|
||||||
|
} else {
|
||||||
|
match repo::user::get_with_id(&pool, &id).await {
|
||||||
|
Ok(user) => {
|
||||||
|
let user_profile = simodels::user::UserProfile {
|
||||||
|
firstname: user.firstname,
|
||||||
|
lastname: user.lastname,
|
||||||
|
username: user.username,
|
||||||
|
email: user.email,
|
||||||
|
};
|
||||||
|
|
||||||
|
response.message = "SUCCESSFUL".to_string();
|
||||||
|
response.data.push(user_profile);
|
||||||
|
(axum::http::StatusCode::OK, axum::Json(response))
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
response.message = err.to_string();
|
||||||
|
(
|
||||||
|
axum::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||||
|
axum::Json(response),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,4 +10,5 @@ pub mod endpoints {
|
|||||||
pub const UPDATE_PASSWORD: &str = "/api/v2/user/password";
|
pub const UPDATE_PASSWORD: &str = "/api/v2/user/password";
|
||||||
pub const SERVICE_LOGIN: &str = "/api/v2/service/login";
|
pub const SERVICE_LOGIN: &str = "/api/v2/service/login";
|
||||||
pub const REFRESH_TOKEN: &str = "/api/v2/token/refresh";
|
pub const REFRESH_TOKEN: &str = "/api/v2/token/refresh";
|
||||||
|
pub const GET_USER_PROFILE: &str = "/api/v2/user/profile/{id}";
|
||||||
}
|
}
|
||||||
+104
-2
@@ -38,11 +38,11 @@ mod init {
|
|||||||
paths(
|
paths(
|
||||||
common_callers::endpoint::db_ping, common_callers::endpoint::root,
|
common_callers::endpoint::db_ping, common_callers::endpoint::root,
|
||||||
register_caller::register_user,
|
register_caller::register_user,
|
||||||
login_endpoints::login, login_endpoints::update_password, login_endpoints::service_login, login_endpoints::refresh_token
|
login_endpoints::login, login_endpoints::update_password, login_endpoints::service_login, login_endpoints::refresh_token, login_endpoints::get_user_profile,
|
||||||
),
|
),
|
||||||
components(schemas(common_callers::response::TestResult,
|
components(schemas(common_callers::response::TestResult,
|
||||||
register_responses::Response,
|
register_responses::Response,
|
||||||
login_responses::Response, login_responses::service_login::Response, login_responses::update_password::Response, login_responses::refresh_token::Response)),
|
login_responses::Response, login_responses::service_login::Response, login_responses::update_password::Response, login_responses::refresh_token::Response, login_responses::get_user_profile::GetUserProfileResponse)),
|
||||||
tags(
|
tags(
|
||||||
(name = "soaricarus Auth API", description = "Auth API for soaricarus API")
|
(name = "soaricarus Auth API", description = "Auth API for soaricarus API")
|
||||||
)
|
)
|
||||||
@@ -128,6 +128,10 @@ mod init {
|
|||||||
callers::endpoints::REFRESH_TOKEN,
|
callers::endpoints::REFRESH_TOKEN,
|
||||||
post(callers::login::endpoint::refresh_token),
|
post(callers::login::endpoint::refresh_token),
|
||||||
)
|
)
|
||||||
|
.route(
|
||||||
|
callers::endpoints::GET_USER_PROFILE,
|
||||||
|
get(callers::login::endpoint::get_user_profile),
|
||||||
|
)
|
||||||
.layer(cors::configure_cors().await)
|
.layer(cors::configure_cors().await)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,6 +323,23 @@ mod tests {
|
|||||||
|
|
||||||
app.clone().oneshot(req).await
|
app.clone().oneshot(req).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_user_profile(
|
||||||
|
app: &axum::Router,
|
||||||
|
user_id: &uuid::Uuid,
|
||||||
|
) -> Result<axum::response::Response, std::convert::Infallible> {
|
||||||
|
let raw_uri = String::from(crate::callers::endpoints::GET_USER_PROFILE);
|
||||||
|
let end_index = raw_uri.len() - 4;
|
||||||
|
|
||||||
|
let uri = format!("{}{user_id}", (&raw_uri[..end_index]).to_string());
|
||||||
|
let req = axum::http::Request::builder()
|
||||||
|
.method(axum::http::Method::GET)
|
||||||
|
.uri(uri)
|
||||||
|
.header(axum::http::header::CONTENT_TYPE, "application/json")
|
||||||
|
.body(axum::body::Body::empty())
|
||||||
|
.unwrap();
|
||||||
|
app.clone().oneshot(req).await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@@ -689,4 +710,85 @@ mod tests {
|
|||||||
|
|
||||||
let _ = db_mgr::drop_database(&tm_pool, &db_name).await;
|
let _ = db_mgr::drop_database(&tm_pool, &db_name).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn test_get_user_profile() {
|
||||||
|
let tm_pool = db_mgr::get_pool().await.unwrap();
|
||||||
|
|
||||||
|
let db_name = db_mgr::generate_db_name().await;
|
||||||
|
|
||||||
|
match db_mgr::create_database(&tm_pool, &db_name).await {
|
||||||
|
Ok(_) => {
|
||||||
|
println!("Success");
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
assert!(false, "Error: {:?}", e.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let pool = db_mgr::connect_to_db(&db_name).await.unwrap();
|
||||||
|
|
||||||
|
db::init::migrations(&pool).await;
|
||||||
|
|
||||||
|
let app = init::routes().await.layer(axum::Extension(pool));
|
||||||
|
|
||||||
|
let usr = get_test_register_request();
|
||||||
|
|
||||||
|
let response = requests::register(&app, &usr).await;
|
||||||
|
|
||||||
|
match response {
|
||||||
|
Ok(resp) => {
|
||||||
|
assert_eq!(
|
||||||
|
resp.status(),
|
||||||
|
StatusCode::CREATED,
|
||||||
|
"Message: {:?} {:?}",
|
||||||
|
resp,
|
||||||
|
usr.username
|
||||||
|
);
|
||||||
|
let body = axum::body::to_bytes(resp.into_body(), usize::MAX)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let parsed_body: callers::register::response::Response =
|
||||||
|
serde_json::from_slice(&body).unwrap();
|
||||||
|
let returned_usr = &parsed_body.data[0];
|
||||||
|
|
||||||
|
let user_id = returned_usr.id;
|
||||||
|
assert_eq!(false, user_id.is_nil(), "Id is not populated");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
usr.username, returned_usr.username,
|
||||||
|
"Usernames do not match"
|
||||||
|
);
|
||||||
|
assert!(returned_usr.date_created.is_some(), "Date Created is empty");
|
||||||
|
|
||||||
|
let mut n_usr = callers::login::request::Request::default();
|
||||||
|
n_usr.username = usr.username.clone();
|
||||||
|
n_usr.password = usr.password.clone();
|
||||||
|
|
||||||
|
match requests::get_user_profile(&app, &user_id).await {
|
||||||
|
Ok(resp) => {
|
||||||
|
assert_eq!(StatusCode::OK, resp.status(), "Status is not right");
|
||||||
|
let body = axum::body::to_bytes(resp.into_body(), usize::MAX)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let parsed_body: callers::login::response::get_user_profile::GetUserProfileResponse =
|
||||||
|
serde_json::from_slice(&body).unwrap();
|
||||||
|
let user_profile = &parsed_body.data[0];
|
||||||
|
assert!(
|
||||||
|
!user_profile.username.is_empty(),
|
||||||
|
"Username should not be null is nil"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {:?}", err.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
assert!(false, "Error: {:?}", err.to_string());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let _ = db_mgr::drop_database(&tm_pool, &db_name).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+76
-14
@@ -24,26 +24,88 @@ pub mod user {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(r) => match r {
|
Ok(r) => match r {
|
||||||
Some(r) => Ok(simodels::user::User {
|
Some(r) => parse_row(&r).await,
|
||||||
id: r.try_get("id")?,
|
|
||||||
username: r.try_get("username")?,
|
|
||||||
password: r.try_get("password")?,
|
|
||||||
email: r.try_get("email")?,
|
|
||||||
email_verified: r.try_get("email_verified")?,
|
|
||||||
phone: r.try_get("phone")?,
|
|
||||||
salt_id: r.try_get("salt_id")?,
|
|
||||||
firstname: r.try_get("firstname")?,
|
|
||||||
lastname: r.try_get("lastname")?,
|
|
||||||
date_created: r.try_get("date_created")?,
|
|
||||||
last_login: r.try_get("last_login")?,
|
|
||||||
status: r.try_get("status")?,
|
|
||||||
}),
|
|
||||||
None => Err(sqlx::Error::RowNotFound),
|
None => Err(sqlx::Error::RowNotFound),
|
||||||
},
|
},
|
||||||
Err(e) => Err(e),
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_with_id(
|
||||||
|
pool: &sqlx::PgPool,
|
||||||
|
id: &uuid::Uuid,
|
||||||
|
) -> Result<simodels::user::User, sqlx::Error> {
|
||||||
|
let result = sqlx::query(
|
||||||
|
r#"
|
||||||
|
SELECT * FROM "user" WHERE id = $1
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.bind(id)
|
||||||
|
.fetch_optional(pool)
|
||||||
|
.await;
|
||||||
|
|
||||||
|
match result {
|
||||||
|
Ok(r) => match r {
|
||||||
|
Some(roww) => parse_row(&roww).await,
|
||||||
|
None => Err(sqlx::Error::RowNotFound),
|
||||||
|
},
|
||||||
|
Err(e) => Err(e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn parse_row(row: &sqlx::postgres::PgRow) -> Result<simodels::user::User, sqlx::Error> {
|
||||||
|
Ok(simodels::user::User {
|
||||||
|
id: row
|
||||||
|
.try_get("id")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
username: row
|
||||||
|
.try_get("username")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
password: row
|
||||||
|
.try_get("password")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
email: row
|
||||||
|
.try_get("email")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
phone: row
|
||||||
|
.try_get("phone")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
firstname: row
|
||||||
|
.try_get("firstname")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
lastname: row
|
||||||
|
.try_get("lastname")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
email_verified: row
|
||||||
|
.try_get("email_verified")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
date_created: row
|
||||||
|
.try_get("date_created")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
status: row
|
||||||
|
.try_get("status")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
last_login: row
|
||||||
|
.try_get("last_login")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
salt_id: row
|
||||||
|
.try_get("salt_id")
|
||||||
|
.map_err(|_e| sqlx::Error::RowNotFound)
|
||||||
|
.unwrap(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn update_password(
|
pub async fn update_password(
|
||||||
pool: &sqlx::PgPool,
|
pool: &sqlx::PgPool,
|
||||||
user: &simodels::user::User,
|
user: &simodels::user::User,
|
||||||
|
|||||||
Reference in new issue
Block a user