tsk-14: Update user profile (#15)
Release Tagging / release (push) Successful in 16s
soaricarus_auth Build / build (push) Successful in 1m5s
soaricarus_auth Build / Rustfmt (push) Successful in 1m10s
soaricarus_auth Build / Check (push) Successful in 1m16s
soaricarus_auth Build / Clippy (push) Successful in 1m19s
soaricarus_auth Build / Test Suite (push) Successful in 1m19s
Release Tagging / release (push) Successful in 16s
soaricarus_auth Build / build (push) Successful in 1m5s
soaricarus_auth Build / Rustfmt (push) Successful in 1m10s
soaricarus_auth Build / Check (push) Successful in 1m16s
soaricarus_auth Build / Clippy (push) Successful in 1m19s
soaricarus_auth Build / Test Suite (push) Successful in 1m19s
Closes #14 Reviewed-on: http://git.kundeng.us/phoenix/soaricarus_auth/pulls/15
This commit was merged in pull request #15.
This commit is contained in:
1 parent
14259c6c38
commit
e82a62dec4
7 files changed
+420
-148
No files matched your search
@@ -132,6 +132,34 @@ pub mod user {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_user_profile(
|
||||
pool: &sqlx::PgPool,
|
||||
id: &uuid::Uuid,
|
||||
firstname: &str,
|
||||
lastname: &str,
|
||||
) -> Result<bool, sqlx::Error> {
|
||||
match sqlx::query(
|
||||
r#"
|
||||
UPDATE "user" SET firstname = $1, lastname = $2 WHERE id = $3
|
||||
"#,
|
||||
)
|
||||
.bind(firstname)
|
||||
.bind(lastname)
|
||||
.bind(id)
|
||||
.execute(pool)
|
||||
.await
|
||||
{
|
||||
Ok(r) => {
|
||||
if r.rows_affected() > 0 {
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
}
|
||||
Err(err) => Err(err),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn update_last_login(
|
||||
pool: &sqlx::PgPool,
|
||||
user: &simodels::user::User,
|
||||
|
||||
Reference in new issue
Block a user