Add transfer tracking and secure admin access
This commit is contained in:
@@ -206,9 +206,12 @@ public class UsersController(
|
||||
}),
|
||||
transactions = transactions.Select(t => new
|
||||
{
|
||||
t.Id, t.LedgerId, t.CategoryId,
|
||||
type = t.Type.ToString().ToLowerInvariant(),
|
||||
t.Amount, t.Note, t.PaymentMethod, t.OccurredAt,
|
||||
t.Id, t.LedgerId, t.CategoryId,
|
||||
type = t.Type.ToString().ToLowerInvariant(),
|
||||
transferDirection = t.TransferDirection.ToWire(),
|
||||
t.Counterparty, t.Amount, t.Note, t.PaymentMethod, t.OccurredAt,
|
||||
t.Provider, t.ProviderTransactionId, t.RecognitionOccurrenceId,
|
||||
t.EvidenceFingerprint, t.RecognitionConfidence,
|
||||
source = t.Source.ToString(), t.SourceText,
|
||||
t.IsDeleted, t.DeletedAt, t.CreatedAt, t.UpdatedAt,
|
||||
}),
|
||||
@@ -225,14 +228,26 @@ public class UsersController(
|
||||
|
||||
var ledgerNames = ledgers.ToDictionary(l => l.Id, l => l.Name);
|
||||
var transactionCsv = new StringBuilder(
|
||||
"ID,账本,类型,金额,分类,备注,支付方式,发生时间,来源,已删除\r\n");
|
||||
"ID,账本,类型,转账方向,对方,金额,分类,备注,支付方式,发生时间,来源,已删除\r\n");
|
||||
foreach (var tx in transactions)
|
||||
{
|
||||
transactionCsv.AppendJoin(',', new[]
|
||||
{
|
||||
Csv(tx.Id),
|
||||
Csv(ledgerNames.GetValueOrDefault(tx.LedgerId, "")),
|
||||
Csv(tx.Type == TransactionType.Income ? "收入" : "支出"),
|
||||
Csv(tx.Type switch
|
||||
{
|
||||
TransactionType.Income => "收入",
|
||||
TransactionType.Transfer => "转账",
|
||||
_ => "支出",
|
||||
}),
|
||||
Csv(tx.TransferDirection switch
|
||||
{
|
||||
TransferDirection.In => "转入",
|
||||
TransferDirection.Out => "转出",
|
||||
_ => "",
|
||||
}),
|
||||
Csv(tx.Counterparty),
|
||||
Csv(tx.Amount),
|
||||
Csv(tx.Category.Name),
|
||||
Csv(tx.Note),
|
||||
|
||||
Reference in New Issue
Block a user