feat: implement email updates for sqlx postgres

This commit is contained in:
realaravinth 2022-05-11 15:25:43 +05:30
parent 58216f0f63
commit 66226f893a
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88

View file

@ -174,6 +174,20 @@ impl MCDatabase for Database {
Ok(resp)
}
/// update a user's email
async fn update_email(&self, p: &UpdateEmail) -> DBResult<()> {
sqlx::query!(
"UPDATE mcaptcha_users set email = $1
WHERE name = $2",
&p.new_email,
&p.username,
)
.execute(&self.pool)
.await
.map_err(map_register_err)?;
Ok(())
}
}
fn now_unix_time_stamp() -> i64 {