Slightly more expressive expressions.
This commit is contained in:
@@ -2,7 +2,7 @@ use uuid::Uuid;
|
||||
|
||||
use super::{QueryConversionError, RepositoryError, dtos::Upsert};
|
||||
use crate::{
|
||||
database::{Constraint, DatabaseError, dtos::UserAppRow, user_apps as db},
|
||||
database::{self, Constraint, DatabaseError, dtos::UserAppRow},
|
||||
domain::UserApp,
|
||||
repository::DecodeError,
|
||||
};
|
||||
@@ -20,7 +20,7 @@ pub async fn list<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let query = db::Query {
|
||||
let query = database::user_apps::Query {
|
||||
limit: query
|
||||
.limit
|
||||
.map(|limit| i64::try_from(limit).map_err(|_| QueryConversionError::Limit(limit)))
|
||||
@@ -31,7 +31,7 @@ where
|
||||
.transpose()?,
|
||||
};
|
||||
|
||||
let apps = db::list(executor, user_id, query)
|
||||
let apps = database::user_apps::list(executor, user_id, query)
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(decode)
|
||||
@@ -48,7 +48,7 @@ pub async fn get_by_id<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let app = db::get_by_id(executor, user_id, id)
|
||||
let app = database::user_apps::get_by_id(executor, user_id, id)
|
||||
.await?
|
||||
.map(decode)
|
||||
.transpose()?;
|
||||
@@ -63,7 +63,7 @@ pub async fn get_by_id_unscoped<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let app = db::get_by_id_unscoped(executor, id)
|
||||
let app = database::user_apps::get_by_id_unscoped(executor, id)
|
||||
.await?
|
||||
.map(decode)
|
||||
.transpose()?;
|
||||
@@ -78,7 +78,7 @@ pub async fn upsert<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let app = db::upsert(executor, encode(app))
|
||||
let app = database::user_apps::upsert(executor, encode(app))
|
||||
.await
|
||||
.map_err(classify_upsert_error)?
|
||||
.map(|upserted| upserted.try_map(decode))
|
||||
@@ -110,7 +110,7 @@ pub async fn delete_by_id<'e, E>(
|
||||
where
|
||||
E: sqlx::Executor<'e, Database = sqlx::Postgres>,
|
||||
{
|
||||
let app = db::delete_by_id(executor, user_id, id)
|
||||
let app = database::user_apps::delete_by_id(executor, user_id, id)
|
||||
.await?
|
||||
.map(decode)
|
||||
.transpose()?;
|
||||
|
||||
Reference in New Issue
Block a user