Create/update scheduled transactions.

This commit is contained in:
2026-09-24 22:40:32 +02:00
parent ffe516d197
commit 17f11deae0
11 changed files with 584 additions and 87 deletions
+40
View File
@@ -0,0 +1,40 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum Direction {
In,
Out,
}
impl Direction {
pub fn as_str(&self) -> &'static str {
match self {
Self::In => "in",
Self::Out => "out",
}
}
}
impl TryFrom<String> for Direction {
type Error = DirectionConversionError;
fn try_from(value: String) -> Result<Self, Self::Error> {
match value.as_str() {
"in" => Ok(Self::In),
"out" => Ok(Self::Out),
_ => Err(DirectionConversionError(value)),
}
}
}
#[derive(Debug)]
pub struct DirectionConversionError(pub String);
impl std::error::Error for DirectionConversionError {}
impl std::fmt::Display for DirectionConversionError {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "invalid direction value: {}", self.0)
}
}