49 lines
1.1 KiB
Rust
49 lines
1.1 KiB
Rust
mod encoding;
|
|
pub mod recurring_transactions;
|
|
pub mod transactions;
|
|
|
|
pub use crate::database::common::{Delete, Upsert};
|
|
use crate::domain::{CentsConversionError, RecurrenceIntervalError, ValidationError};
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum RepositoryError {
|
|
#[error(transparent)]
|
|
Database(#[from] sqlx::Error),
|
|
|
|
#[error(transparent)]
|
|
Decode(#[from] DecodeError),
|
|
|
|
#[error(transparent)]
|
|
QueryConversion(#[from] QueryConversionError),
|
|
}
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum DecodeError {
|
|
#[error(transparent)]
|
|
Amount(#[from] CentsConversionError),
|
|
|
|
#[error(transparent)]
|
|
RecurrenceInterval(#[from] RecurrenceIntervalError),
|
|
|
|
#[error(transparent)]
|
|
Invalid(#[from] ValidationError),
|
|
|
|
#[error("invalid direction value: {0}")]
|
|
Direction(String),
|
|
|
|
#[error("invalid recurrence_unit value: {0}")]
|
|
RecurrenceUnit(String),
|
|
|
|
#[error("invalid weekend_adjustment value: {0}")]
|
|
WeekendAdjustment(String),
|
|
}
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum QueryConversionError {
|
|
#[error("Failed to convert limit: {0}")]
|
|
Limit(u64),
|
|
|
|
#[error("Failed to convert offset: {0}")]
|
|
Offset(u64),
|
|
}
|