Add transfer tracking and secure admin access
This commit is contained in:
@@ -45,7 +45,9 @@ public class BudgetsController(
|
||||
var (start, end) = ChinaClock.MonthRangeUtc(year, month);
|
||||
var spentByCat = await db.Transactions
|
||||
.Where(t => t.UserId == Uid && t.LedgerId == targetLedgerId &&
|
||||
t.Type == TransactionType.Expense && t.OccurredAt >= start && t.OccurredAt < end)
|
||||
(t.Type == TransactionType.Expense ||
|
||||
t.Type == TransactionType.Transfer && t.TransferDirection == TransferDirection.Out) &&
|
||||
t.OccurredAt >= start && t.OccurredAt < end)
|
||||
.GroupBy(t => t.CategoryId)
|
||||
.Select(g => new { g.Key, Amount = g.Sum(t => t.Amount) })
|
||||
.ToDictionaryAsync(x => x.Key, x => x.Amount);
|
||||
@@ -152,7 +154,8 @@ public class BudgetsController(
|
||||
|
||||
var transactions = await db.Transactions
|
||||
.Where(t => t.UserId == Uid && t.LedgerId == ledgerId &&
|
||||
t.Type == TransactionType.Expense &&
|
||||
(t.Type == TransactionType.Expense ||
|
||||
t.Type == TransactionType.Transfer && t.TransferDirection == TransferDirection.Out) &&
|
||||
t.OccurredAt >= historyStart && t.OccurredAt < currentEnd)
|
||||
.Select(t => new { t.CategoryId, t.Amount, t.OccurredAt })
|
||||
.ToListAsync();
|
||||
|
||||
Reference in New Issue
Block a user