Implemented a domain layer, because the API DTO's where getting bloated.

This commit is contained in:
2026-09-26 17:22:10 +02:00
parent 04debfba7b
commit 4737bd5c81
24 changed files with 1103 additions and 538 deletions
+36
View File
@@ -0,0 +1,36 @@
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),
}
#[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),
}