Add transfer tracking and secure admin access

This commit is contained in:
2026-07-26 11:57:57 +08:00
parent 0738953e6d
commit 7df25edd96
111 changed files with 6379 additions and 1934 deletions
+39 -2
View File
@@ -17,12 +17,49 @@ public enum AppMode
}
/// <summary>账单类型</summary>
public enum TransactionType
public enum TransactionType
{
Expense = 0,
Income = 1,
Transfer = 2,
}
}
public enum TransferDirection
{
In = 0,
Out = 1,
}
public static class TransactionTypeRules
{
public static bool IsExpense(this TransactionType type, TransferDirection? direction = null) =>
type == TransactionType.Expense ||
type == TransactionType.Transfer && direction == TransferDirection.Out;
public static bool IsIncome(this TransactionType type, TransferDirection? direction = null) =>
type == TransactionType.Income ||
type == TransactionType.Transfer && direction == TransferDirection.In;
public static TransactionType CategoryType(
this TransactionType type,
TransferDirection? direction = null) => type == TransactionType.Transfer
? direction == TransferDirection.In ? TransactionType.Income : TransactionType.Expense
: type;
public static string ToWire(this TransactionType type) => type switch
{
TransactionType.Income => "income",
TransactionType.Transfer => "transfer",
_ => "expense",
};
public static string? ToWire(this TransferDirection? direction) => direction switch
{
TransferDirection.In => "in",
TransferDirection.Out => "out",
_ => null,
};
}
/// <summary>账单来源(决策:AI 记账可追溯)</summary>
public enum TransactionSource