WIP
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::model::schema;
|
||||
use diesel::prelude::*;
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
#[derive(Queryable, Selectable, serde::Serialize, serde::Deserialize)]
|
||||
#[diesel(table_name = schema::categories)]
|
||||
@@ -66,7 +67,6 @@ pub struct BookForm {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Queryable, Selectable, serde::Serialize, serde::Deserialize)]
|
||||
#[diesel(table_name = schema::accounts)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
@@ -88,6 +88,57 @@ pub struct AccountForm {
|
||||
pub account_type: i64,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Selectable, serde::Serialize, serde::Deserialize)]
|
||||
#[diesel(table_name = schema::transactions)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
pub struct Transaction {
|
||||
pub id: i64,
|
||||
uid: i64,
|
||||
pub book_id: i64,
|
||||
pub description: String,
|
||||
pub category_id: i64,
|
||||
pub time: chrono::DateTime<Utc>,
|
||||
is_delete: bool,
|
||||
create_at: chrono::NaiveDateTime,
|
||||
update_at: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, Insertable)]
|
||||
#[diesel(table_name = schema::transactions)]
|
||||
pub struct TransactionForm {
|
||||
pub id: Option<i64>,
|
||||
pub uid: i64,
|
||||
pub book_id: i64,
|
||||
pub description: String,
|
||||
pub category_id: i64,
|
||||
pub time: chrono::DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Selectable, serde::Serialize, serde::Deserialize)]
|
||||
#[diesel(table_name = schema::amounts)]
|
||||
#[diesel(check_for_backend(diesel::pg::Pg))]
|
||||
pub struct Amount {
|
||||
pub id: i64,
|
||||
uid: i64,
|
||||
transaction_id: i64,
|
||||
value: i64,
|
||||
expo: i64,
|
||||
currency: String,
|
||||
is_delete: bool,
|
||||
create_at: chrono::NaiveDateTime,
|
||||
update_at: chrono::NaiveDateTime,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, Insertable)]
|
||||
#[diesel(table_name = schema::amounts)]
|
||||
pub struct AmountForm {
|
||||
pub uid: i64,
|
||||
pub transaction_id: i64,
|
||||
pub value: i64,
|
||||
pub expo: i64,
|
||||
pub currency: String,
|
||||
}
|
||||
|
||||
#[derive(Queryable, Selectable, serde::Serialize)]
|
||||
#[diesel(table_name = schema::users)]
|
||||
pub struct User {
|
||||
|
||||
Reference in New Issue
Block a user