reafctor: all code without stream
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pub mod queries;
|
||||
@@ -0,0 +1,21 @@
|
||||
use crate::databases::errors::DbError;
|
||||
|
||||
use sqlx::PgPool;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub async fn upsert_user_activity(pool: &PgPool, user_id: &Uuid) -> Result<(), DbError> {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO auth.app_user (id, last_seen_at)
|
||||
VALUES ($1, now())
|
||||
ON CONFLICT (id)
|
||||
DO UPDATE SET last_seen_at = now()
|
||||
"#,
|
||||
user_id
|
||||
)
|
||||
.execute(pool)
|
||||
.await
|
||||
.map_err(DbError::Connection)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user