Lines
100 %
Functions
40 %
Branches
//! Inventories of the form preflight.
use crate::db::DBError;
use crate::user::User;
use sqlx::types::Uuid;
/// The ids of the tenants of the directory, except the admin.
///
/// # Errors
/// [`DBError`] when the directory cannot be read.
pub async fn tenants(admin: Uuid) -> Result<Vec<Uuid>, DBError> {
let tenants = crate::fleet::inventory(admin).await?;
Ok(tenants.into_iter().map(|(id, _)| id).collect())
}
impl User {
/// The ids of every stored transaction, splits or not.
/// [`DBError`] on a connection or query error.
pub async fn transaction_ids(&self) -> Result<Vec<Uuid>, DBError> {
let mut conn = self.get_connection().await?;
sqlx::query_file_scalar!("sql/select/transactions/ids.sql")
.fetch_all(&mut *conn)
.await
.map_err(DBError::Sqlx)