feat(transactions): implement transaction management commands

This commit is contained in:
2026-02-25 10:58:03 +00:00
parent bfbb771cbf
commit e731c45a71
2 changed files with 67 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
pub mod accounts;
pub mod exchange_rate;
pub mod settings;
pub mod transactions;

View File

@@ -0,0 +1,66 @@
use crate::errors::CommandResult;
use crate::services::transactions::types::inputs::{CreateTransactionInput, TransactionFilter, UpdateTransactionInput};
use crate::services::transactions::types::outputs::TransactionWithTags;
use crate::state::AppState;
#[tauri::command]
pub async fn create_transaction(
state: tauri::State<'_, AppState>,
input: CreateTransactionInput,
) -> CommandResult<TransactionWithTags> {
state.transaction_service().create_transaction(input, None).await
}
#[tauri::command]
pub async fn get_transactions(
state: tauri::State<'_, AppState>,
filter: TransactionFilter,
) -> CommandResult<Vec<TransactionWithTags>> {
state.transaction_service().get_transactions(filter, None).await
}
#[tauri::command]
pub async fn get_transaction(
state: tauri::State<'_, AppState>,
id: String,
) -> CommandResult<TransactionWithTags> {
state.transaction_service().get_transaction(id, None).await
}
#[tauri::command]
pub async fn update_transaction(
state: tauri::State<'_, AppState>,
id: String,
updates: UpdateTransactionInput,
) -> CommandResult<TransactionWithTags> {
state
.transaction_service()
.update_transaction(id, updates, None)
.await
}
#[tauri::command]
pub async fn delete_transaction(
state: tauri::State<'_, AppState>,
id: String,
) -> CommandResult<()> {
state.transaction_service().delete_transaction(id, None).await
}
#[tauri::command]
pub async fn get_transactions_needing_review(
state: tauri::State<'_, AppState>,
) -> CommandResult<Vec<TransactionWithTags>> {
state
.transaction_service()
.get_transactions_needing_review(None)
.await
}
#[tauri::command]
pub async fn confirm_transaction(
state: tauri::State<'_, AppState>,
id: String,
) -> CommandResult<()> {
state.transaction_service().confirm_transaction(id, None).await
}