Prepping account members for enriching user data.

This commit is contained in:
2026-10-12 13:43:43 +02:00
parent d2993eafe0
commit 945ae46dbe
7 changed files with 154 additions and 29 deletions
+24
View File
@@ -1,3 +1,5 @@
use std::collections::HashMap;
use uuid::Uuid;
use super::{
@@ -47,6 +49,28 @@ where
Ok(user)
}
pub async fn get_by_ids<'e, E>(
executor: E,
ids: &[Uuid],
) -> Result<HashMap<Uuid, User>, RepositoryError>
where
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
{
if ids.is_empty() {
return Ok(HashMap::new());
}
let users = db::get_by_ids(executor, ids)
.await?
.into_iter()
.map(decode)
.collect::<Result<Vec<_>, _>>()?;
let user_map = users.into_iter().map(|user| (user.id, user)).collect();
Ok(user_map)
}
pub async fn upsert<'e, E>(executor: E, user: User) -> Result<Upsert<User>, RepositoryError>
where
E: sqlx::Executor<'e, Database = sqlx::Postgres>,