fix coin stats and add transaction note (#31)

This commit is contained in:
Doh
2025-01-09 15:45:00 -05:00
committed by GitHub
parent 8bbd684873
commit aacf75e5f6
11 changed files with 438 additions and 132 deletions

View File

@@ -104,7 +104,8 @@ export async function addCoins(
amount: number,
description: string,
type: TransactionType = 'MANUAL_ADJUSTMENT',
relatedItemId?: string
relatedItemId?: string,
note?: string
): Promise<CoinsData> {
const data = await loadCoinsData()
const newTransaction: CoinTransaction = {
@@ -113,7 +114,8 @@ export async function addCoins(
type,
description,
timestamp: d2t({ dateTime: getNow({}) }),
...(relatedItemId && { relatedItemId })
...(relatedItemId && { relatedItemId }),
...(note && note.trim() !== '' && { note })
}
const newData: CoinsData = {
@@ -144,7 +146,8 @@ export async function removeCoins(
amount: number,
description: string,
type: TransactionType = 'MANUAL_ADJUSTMENT',
relatedItemId?: string
relatedItemId?: string,
note?: string
): Promise<CoinsData> {
const data = await loadCoinsData()
const newTransaction: CoinTransaction = {
@@ -153,7 +156,8 @@ export async function removeCoins(
type,
description,
timestamp: d2t({ dateTime: getNow({}) }),
...(relatedItemId && { relatedItemId })
...(relatedItemId && { relatedItemId }),
...(note && note.trim() !== '' && { note })
}
const newData: CoinsData = {