Slightly more expressive expressions.
This commit is contained in:
@@ -6,7 +6,7 @@ use super::{
|
||||
encoding::{decode_direction, encode_direction},
|
||||
};
|
||||
use crate::{
|
||||
database::{Constraint, DatabaseError, dtos::TransactionRow, transactions as db},
|
||||
database::{self, Constraint, DatabaseError, dtos::TransactionRow},
|
||||
domain::{Cents, Transaction},
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@ pub async fn list<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let query = db::Query {
|
||||
let query = database::transactions::Query {
|
||||
limit: query
|
||||
.limit
|
||||
.map(|l| i64::try_from(l).map_err(|_| QueryConversionError::Limit(l)))
|
||||
@@ -34,7 +34,7 @@ where
|
||||
.transpose()?,
|
||||
};
|
||||
|
||||
let transactions = db::list(executor, user_id, query)
|
||||
let transactions = database::transactions::list(executor, user_id, query)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(decode)
|
||||
@@ -51,7 +51,7 @@ pub async fn get_by_id<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let transaction = db::get_by_id(executor, user_id, id)
|
||||
let transaction = database::transactions::get_by_id(executor, user_id, id)
|
||||
.await?
|
||||
.map(decode)
|
||||
.transpose()?;
|
||||
@@ -67,7 +67,7 @@ pub async fn upsert<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let upserted = db::upsert(executor, user_id, encode(transaction))
|
||||
let upserted = database::transactions::upsert(executor, user_id, encode(transaction))
|
||||
.await
|
||||
.map_err(classify_upsert_error)?
|
||||
.map(|upserted| upserted.try_map(decode))
|
||||
@@ -99,7 +99,7 @@ pub async fn delete_by_id<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let transaction = db::delete_by_id(executor, user_id, id)
|
||||
let transaction = database::transactions::delete_by_id(executor, user_id, id)
|
||||
.await?
|
||||
.map(decode)
|
||||
.transpose()?;
|
||||
|
||||
Reference in New Issue
Block a user