summaryrefslogtreecommitdiff
path: root/schist_desktop_gui/src/dummy_data.rs
blob: 079b6878e080ddb634ffe1c0d28fc60a27e58508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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"),
        },
    ])
}