Return account details.

This commit is contained in:
2026-09-27 11:50:59 +02:00
parent 26a370aa31
commit 406f30ef80
7 changed files with 239 additions and 33 deletions
+25
View File
@@ -1,3 +1,5 @@
use std::collections::HashMap;
use uuid::Uuid;
use super::{
@@ -66,6 +68,29 @@ where
Ok(account)
}
pub async fn get_by_ids<'e, E>(
executor: E,
ids: &[Uuid],
) -> Result<HashMap<Uuid, Account>, RepositoryError>
where
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
{
if ids.is_empty() {
return Ok(HashMap::new());
}
let accounts = db::get_by_ids(executor, ids)
.await?
.into_iter()
.map(decode)
.collect::<Result<Vec<_>, DecodeError>>()?;
Ok(accounts
.into_iter()
.map(|account| (account.id, account))
.collect())
}
pub async fn upsert<'e, E>(
executor: E,
account: Account,