diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2021-07-29 13:09:48 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2021-07-29 13:17:09 +0200 |
| commit | f0dbf13ab231bfc913571487ae9394214a70f7b9 (patch) | |
| tree | bfb3cc38e65e999e73b2a1a56bc0b9c7bb31cc0e /cli/src/model.rs | |
| parent | ccda716764ae84dee9f18f66e383b66c9e30b3b9 (diff) | |
| download | money-f0dbf13ab231bfc913571487ae9394214a70f7b9.tar.gz | |
date
Diffstat (limited to 'cli/src/model.rs')
| -rw-r--r-- | cli/src/model.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cli/src/model.rs b/cli/src/model.rs index c70e43d..f4b9910 100644 --- a/cli/src/model.rs +++ b/cli/src/model.rs @@ -1,3 +1,4 @@ +use chrono::naive::NaiveDate; use rust_decimal::Decimal; use serde::{Deserialize, Serialize}; use std::convert::AsRef; @@ -37,6 +38,7 @@ impl std::str::FromStr for TransactionKind { #[derive(Deserialize, Serialize)] pub struct Transaction { pub description: String, + pub date: NaiveDate, pub category: Category, pub amount: Decimal, pub kind: TransactionKind, @@ -113,7 +115,7 @@ impl Transaction { fs::read_to_string(p).ok().as_ref().and_then(|s| serde_json::from_str(s).ok()) } - fn id(&self) -> u64 { + pub fn id(&self) -> u64 { let mut h = XxHash64::default(); self.hash(&mut h); h.finish() |
