Renamed AmountCents to just Cents.
This commit is contained in:
@@ -4,7 +4,7 @@ use uuid::Uuid;
|
||||
|
||||
use crate::database::dtos::transaction::TransactionRow;
|
||||
use crate::routes::dtos::{
|
||||
amount_cents::{AmountCents, AmountCentsConversionError},
|
||||
cents::{Cents, CentsConversionError},
|
||||
direction::{Direction, DirectionConversionError},
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ pub struct Transaction {
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionData {
|
||||
pub description: String,
|
||||
pub amount_cents: AmountCents,
|
||||
pub amount_cents: Cents,
|
||||
pub direction: Direction,
|
||||
pub date: DateTime<Utc>,
|
||||
}
|
||||
@@ -32,7 +32,7 @@ impl TryFrom<TransactionRow> for Transaction {
|
||||
id: row.id,
|
||||
data: TransactionData {
|
||||
description: row.description,
|
||||
amount_cents: AmountCents::try_from(row.amount_cents)?,
|
||||
amount_cents: Cents::try_from(row.amount_cents)?,
|
||||
direction: Direction::try_from(row.direction)
|
||||
.map_err(TransactionConversionError::Direction)?,
|
||||
date: row.date,
|
||||
@@ -44,7 +44,7 @@ impl TryFrom<TransactionRow> for Transaction {
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum TransactionConversionError {
|
||||
#[error(transparent)]
|
||||
AmountCents(#[from] AmountCentsConversionError),
|
||||
Cents(#[from] CentsConversionError),
|
||||
|
||||
#[error(transparent)]
|
||||
Direction(#[from] DirectionConversionError),
|
||||
|
||||
Reference in New Issue
Block a user