aboutsummaryrefslogtreecommitdiff
path: root/src/model/payment.rs
blob: 5ce6bb90f7259e041dc59b420b175216c03d3086 (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
use chrono::NaiveDate;
use serde::Serialize;

use crate::model::frequency::Frequency;

#[derive(Debug, sqlx::FromRow, Serialize)]
pub struct Table {
    pub id: i64,
    pub name: String,
    pub cost: i64,
    pub user: String,
    pub category_name: String,
    pub category_color: String,
    pub date: String,
    pub frequency: Frequency,
}

#[derive(Debug, sqlx::FromRow, Serialize)]
pub struct Form {
    pub id: i64,
    pub name: String,
    pub cost: i64,
    pub user_id: i64,
    pub category_id: i64,
    pub date: String,
    pub frequency: Frequency,
}

#[derive(Debug, sqlx::FromRow, Serialize)]
pub struct Stat {
    pub start_date: String,
    pub cost: i64,
    pub category_id: i64,
}

#[derive(Debug)]
pub struct Create {
    pub name: String,
    pub cost: i64,
    pub user_id: i64,
    pub category_id: i64,
    pub date: NaiveDate,
    pub frequency: Frequency,
}

#[derive(Debug)]
pub struct Update {
    pub name: String,
    pub cost: i64,
    pub user_id: i64,
    pub category_id: i64,
    pub date: NaiveDate,
}