Implement logic
This commit is contained in:
81
firefly-client/src/models.rs
Normal file
81
firefly-client/src/models.rs
Normal file
@@ -0,0 +1,81 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AccountRead {
|
||||
pub id: String,
|
||||
pub attributes: Account,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Account {
|
||||
pub name: String,
|
||||
pub iban: Option<String>,
|
||||
#[serde(rename = "type")]
|
||||
pub account_type: String,
|
||||
pub active: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AccountArray {
|
||||
pub data: Vec<AccountRead>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionRead {
|
||||
pub id: String,
|
||||
pub attributes: Transaction,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Transaction {
|
||||
pub transactions: Vec<TransactionSplit>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionSplit {
|
||||
pub date: String,
|
||||
pub amount: String,
|
||||
pub description: String,
|
||||
pub external_id: Option<String>,
|
||||
pub currency_code: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionArray {
|
||||
pub data: Vec<TransactionRead>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionSplitStore {
|
||||
#[serde(rename = "type")]
|
||||
pub transaction_type: String,
|
||||
pub date: String,
|
||||
pub amount: String,
|
||||
pub description: String,
|
||||
pub source_id: Option<String>,
|
||||
pub source_name: Option<String>,
|
||||
pub destination_id: Option<String>,
|
||||
pub destination_name: Option<String>,
|
||||
pub currency_code: Option<String>,
|
||||
pub foreign_amount: Option<String>,
|
||||
pub foreign_currency_code: Option<String>,
|
||||
pub external_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionStore {
|
||||
pub transactions: Vec<TransactionSplitStore>,
|
||||
pub apply_rules: Option<bool>,
|
||||
pub fire_webhooks: Option<bool>,
|
||||
pub error_if_duplicate_hash: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionUpdate {
|
||||
pub transactions: Vec<TransactionSplitUpdate>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct TransactionSplitUpdate {
|
||||
pub external_id: Option<String>,
|
||||
}
|
||||
Reference in New Issue
Block a user