1
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 32s
Docker Build & Deploy / Deploy to Production (push) Successful in 13s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

This commit is contained in:
孙诚
2026-01-15 22:10:57 +08:00
parent 71a8707241
commit 9069e3dbcf
5 changed files with 426 additions and 217 deletions

View File

@@ -273,7 +273,13 @@ public class TransactionRecordController(
try
{
var statistics = await transactionRepository.GetDailyStatisticsAsync(year, month);
var result = statistics.Select(s => new DailyStatisticsDto(s.Key, s.Value.count, s.Value.amount)).ToList();
var result = statistics.Select(s => new DailyStatisticsDto(
s.Key,
s.Value.count,
s.Value.expense,
s.Value.income,
s.Value.income - s.Value.expense // Balance = Income - Expense
)).ToList();
return result.Ok();
}
@@ -300,7 +306,13 @@ public class TransactionRecordController(
var effectiveStartDate = startDate.Date;
var statistics = await transactionRepository.GetDailyStatisticsByRangeAsync(effectiveStartDate, effectiveEndDate);
var result = statistics.Select(s => new DailyStatisticsDto(s.Key, s.Value.count, s.Value.amount)).ToList();
var result = statistics.Select(s => new DailyStatisticsDto(
s.Key,
s.Value.count,
s.Value.expense,
s.Value.income,
s.Value.income - s.Value.expense
)).ToList();
return result.Ok();
}
@@ -755,7 +767,9 @@ public record UpdateTransactionDto(
public record DailyStatisticsDto(
string Date,
int Count,
decimal Amount
decimal Expense,
decimal Income,
decimal Balance
);
/// <summary>