From 4967cbabfc2fddc903dfaa17b11b2baa006fb218 Mon Sep 17 00:00:00 2001 From: Joe Carstairs Date: Sun, 17 Nov 2024 16:37:38 +0000 Subject: actualbudget queries integration tests --- .../actualbudget_models/src/actualbudget_schema.rs | 25 ++++++++++++++-------- .../src/actualbudget_transaction.rs | 10 ++++----- 2 files changed, 21 insertions(+), 14 deletions(-) (limited to 'rust/actualbudget_models/src') diff --git a/rust/actualbudget_models/src/actualbudget_schema.rs b/rust/actualbudget_models/src/actualbudget_schema.rs index a872231..02907c0 100644 --- a/rust/actualbudget_models/src/actualbudget_schema.rs +++ b/rust/actualbudget_models/src/actualbudget_schema.rs @@ -13,22 +13,29 @@ diesel::table! { } diesel::table! { - transactions (id) { + v_transactions (id) { id -> Text, - #[sql_name = "isParent"] is_parent -> Bool, - #[sql_name = "isChild"] is_child -> Bool, - #[sql_name = "acct"] + parent_id -> Nullable, + #[sql_name = "account"] account_id -> Text, #[sql_name = "category"] - category_id -> Text, + category_id -> Nullable, amount -> Integer, - #[sql_name = "description"] - payee -> Text, - notes -> Text, + payee -> Nullable, + notes -> Nullable, date -> Integer, - parent_id -> Nullable, + // imported_id -> Text, + // error -> Text, + // imported_payee -> Text, + // starting_balance_flag -> Integer, + // transfer_id -> Text, + // sort_order -> Real, + // cleared -> Integer, + // reconciled -> Integer, + // tombstone -> Integer, + // schedule -> Text, } } diff --git a/rust/actualbudget_models/src/actualbudget_transaction.rs b/rust/actualbudget_models/src/actualbudget_transaction.rs index 2b2f67b..04ece16 100644 --- a/rust/actualbudget_models/src/actualbudget_transaction.rs +++ b/rust/actualbudget_models/src/actualbudget_transaction.rs @@ -3,16 +3,16 @@ use diesel::prelude::{Identifiable, Queryable, QueryableByName, Selectable}; use crate::actualbudget_date::ActualbudgetDate; #[derive(Identifiable, QueryableByName, Queryable, Selectable, Clone)] -#[diesel(table_name = crate::actualbudget_schema::transactions)] +#[diesel(table_name = crate::actualbudget_schema::v_transactions)] pub struct ActualbudgetTransaction { pub id: String, pub is_parent: bool, pub is_child: bool, + pub parent_id: Option, pub account_id: String, - pub category_id: String, + pub category_id: Option, pub amount: i32, - pub payee: String, - pub notes: String, + pub payee: Option, + pub notes: Option, pub date: ActualbudgetDate, - pub parent_id: Option, } -- cgit v1.2.3