summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/dummy_data.rs
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-08-13 07:50:21 +0000
committerjoeac <me@joeac.net>2025-08-13 07:50:21 +0000
commitee3cd780e21260257b401c3f5cbababd9e27a15a (patch)
treeb0571649a1a1a7644dbc50183cc4c3a29966a963 /schist_desktop_gui/src/dummy_data.rs
parent49342e8b553d5c92f1c043b3b0ce18bdf1c2cd44 (diff)
task-073
Co-authored-by: Joe Carstairs <jcarstairs@scottlogic.com> Reviewed-on: https://git.joeac.net/joeac/schist/pulls/1 Co-authored-by: Joe Carstairs <me@joeac.net> Co-committed-by: Joe Carstairs <me@joeac.net>
Diffstat (limited to 'schist_desktop_gui/src/dummy_data.rs')
-rw-r--r--schist_desktop_gui/src/dummy_data.rs70
1 files changed, 70 insertions, 0 deletions
diff --git a/schist_desktop_gui/src/dummy_data.rs b/schist_desktop_gui/src/dummy_data.rs
new file mode 100644
index 0000000..079b687
--- /dev/null
+++ b/schist_desktop_gui/src/dummy_data.rs
@@ -0,0 +1,70 @@
+use schist_models::{
+ account::Account, bucket::Bucket, budget_period_unit::BudgetPeriodUnit, date_utc::DateUtc,
+};
+
+#[derive(Clone, Debug)]
+pub struct Error {}
+
+impl From<anyhow::Error> for Error {
+ fn from(_value: anyhow::Error) -> Self {
+ Error {}
+ }
+}
+
+pub async fn fetch_accounts() -> Result<Vec<Account>, Error> {
+ Ok(vec![
+ Account {
+ id: 0,
+ name: String::from("Nationwide current account"),
+ opening_balance: 0,
+ opening_date: DateUtc::from_ymd(2024, 06, 12)?,
+ },
+ Account {
+ id: 1,
+ name: String::from("cash account"),
+ opening_balance: 0,
+ opening_date: DateUtc::from_ymd(2024, 06, 12)?,
+ },
+ Account {
+ id: 2,
+ name: String::from("YBS savings account"),
+ opening_balance: 0,
+ opening_date: DateUtc::from_ymd(2024, 06, 12)?,
+ },
+ ])
+}
+
+pub async fn fetch_buckets() -> Result<Vec<Bucket>, Error> {
+ Ok(vec![
+ Bucket {
+ id: 0,
+ name: String::from("groceries"),
+ balance: 123,
+ balance_date: DateUtc::from_ymd(2025, 8, 10)?,
+ budget_period: 1,
+ budget_period_unit: BudgetPeriodUnit::Month,
+ budget_quantity: 300,
+ group: String::from("normal expenses"),
+ },
+ Bucket {
+ id: 1,
+ name: String::from("outdoor trips"),
+ balance: -11,
+ balance_date: DateUtc::from_ymd(2025, 8, 10)?,
+ budget_period: 1,
+ budget_period_unit: BudgetPeriodUnit::Month,
+ budget_quantity: 110,
+ group: String::from("outdoors"),
+ },
+ Bucket {
+ id: 2,
+ name: String::from("salary"),
+ balance: 1018,
+ balance_date: DateUtc::from_ymd(2025, 8, 10)?,
+ budget_period: 1,
+ budget_period_unit: BudgetPeriodUnit::Month,
+ budget_quantity: -2196,
+ group: String::from("income"),
+ },
+ ])
+}