Initial project import
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
namespace MiaoJiZhang.Api.Contracts;
|
||||
|
||||
// ---- Auth(当前仅用户名密码;快捷登录接口预留不实现)----
|
||||
public record RegisterRequest(string Username, string Password, bool AgreedToTerms = false);
|
||||
public record LoginRequest(string Username, string Password);
|
||||
public record AuthResponse(long UserId, string Username, string Token, DateTime ExpiresAt, bool AccountClosureCancelled = false);
|
||||
|
||||
// ---- Onboarding ----
|
||||
public record OnboardingRequest(string AppMode, string AvatarKey, string PersonaKey, string? CustomName);
|
||||
public record SwitchModeRequest(string AppMode);
|
||||
public record UpdateCompanionRequest(string? AvatarKey, string? PersonaKey, string? CustomName, int? RoastLevel, int? StickerFrequency, int? ProactiveLevel);
|
||||
|
||||
// ---- User profile ----
|
||||
public record AiCompanionDto(string AvatarKey, string PersonaKey, string? CustomName, int RoastLevel, int StickerFrequency, int ProactiveLevel);
|
||||
public record UserPermissionsDto(bool Ai);
|
||||
public record AiChatQuotaDto(int Limit, int Used, int Remaining, string Period, DateTime ResetAt);
|
||||
public record UserProfileResponse(long UserId, string Username, string? Nickname, string AppMode, AiCompanionDto? AiCompanion, bool OnboardingDone, UserPermissionsDto Permissions, AiChatQuotaDto AiChatQuota);
|
||||
public record UpdateProfileRequest(string? Nickname);
|
||||
public record ChangePasswordRequest(string CurrentPassword, string NewPassword);
|
||||
public record DeleteAccountRequest(string Password, string? ConfirmationText = null);
|
||||
public record AccountClosureResponse(DateTime RequestedAt, DateTime ScheduledAt);
|
||||
public record UpdateUserPermissionsRequest(bool Ai);
|
||||
public record UpdateAiChatQuotaRequest(int Limit, string Period, bool ResetUsage = false);
|
||||
|
||||
// ---- 通用 ----
|
||||
public record ApiError(string Code, string Message);
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
namespace MiaoJiZhang.Api.Contracts;
|
||||
|
||||
// ---- Ledger / Category ----
|
||||
public record LedgerDto(long Id, string Name, string IconKey, bool IsDefault);
|
||||
public record CategoryDto(
|
||||
long Id, string Name, string IconKey, string Type,
|
||||
int SortOrder, bool IsCustom, string ColorKey = "mint");
|
||||
public record CreateCategoryRequest(
|
||||
string Name, string IconKey, string Type, string? ColorKey = null);
|
||||
public record UpdateCategoryRequest(
|
||||
string Name, string IconKey, int SortOrder, string? ColorKey = null);
|
||||
|
||||
// ---- Transaction ----
|
||||
public record CreateTransactionRequest(
|
||||
long? LedgerId, // null = 默认账本
|
||||
long CategoryId,
|
||||
string Type, // expense | income
|
||||
decimal Amount,
|
||||
string? Note,
|
||||
string? PaymentMethod,
|
||||
DateTime? OccurredAt, // null = 现在
|
||||
string? Source, // manual | voice | ocr
|
||||
string? SourceText,
|
||||
string? ClientRequestId = null);
|
||||
|
||||
public record UpdateTransactionRequest(
|
||||
long LedgerId,
|
||||
long CategoryId,
|
||||
string Type,
|
||||
decimal Amount,
|
||||
string? Note,
|
||||
string? PaymentMethod,
|
||||
DateTime OccurredAt,
|
||||
DateTime? BaseUpdatedAt = null);
|
||||
|
||||
public record TransactionDto(
|
||||
long Id, long LedgerId, long CategoryId, string CategoryName, string CategoryIcon,
|
||||
string Type, decimal Amount, string? Note, string? PaymentMethod,
|
||||
DateTime OccurredAt, string Source, string? SourceText,
|
||||
bool IsDeleted = false, string CategoryColor = "mint",
|
||||
DateTime? UpdatedAt = null);
|
||||
|
||||
public record DailyGroupDto(DateOnly Date, decimal Expense, decimal Income, List<TransactionDto> Items);
|
||||
|
||||
public record MonthSummaryDto(
|
||||
int Year, int Month, decimal Income, decimal Expense, decimal Balance,
|
||||
int Count, List<DailyGroupDto> Days);
|
||||
|
||||
public record CategoryStatDto(
|
||||
long CategoryId, string Name, string IconKey,
|
||||
decimal Amount, double Percent, string ColorKey = "mint");
|
||||
public record MonthStatsDto(int Year, int Month, decimal TotalExpense, decimal TotalIncome, List<CategoryStatDto> ByCategory, List<decimal> DailyExpenses)
|
||||
{
|
||||
public string? AiAnalysis { get; set; }
|
||||
}
|
||||
public record PeriodTrendPointDto(
|
||||
string Label, DateTime Date, decimal Expense, decimal Income);
|
||||
public record PeriodStatsDto(
|
||||
string PeriodType, string PeriodLabel, DateTime StartDate, DateTime EndDate,
|
||||
decimal TotalExpense, decimal TotalIncome, decimal Balance, int Count,
|
||||
List<CategoryStatDto> ByCategory, List<PeriodTrendPointDto> Trend,
|
||||
string? Analysis);
|
||||
|
||||
// ---- Budget ----
|
||||
public record BudgetItemDto(
|
||||
long? CategoryId, string? CategoryName, string? CategoryIcon,
|
||||
decimal Amount, decimal Spent, bool IsRecurring,
|
||||
string? CategoryColor = null);
|
||||
public record BudgetsResponse(int Year, int Month, BudgetItemDto? Total, List<BudgetItemDto> Categories);
|
||||
public record UpsertBudgetRequest(long? CategoryId, decimal Amount, bool Recurring = false); // Amount<=0 表示删除该预算
|
||||
public record BudgetAmountRequest(long? CategoryId, decimal Amount);
|
||||
public record ApplyBudgetBatchRequest(bool Recurring, List<BudgetAmountRequest> Items);
|
||||
public record BudgetRecommendationItemDto(
|
||||
long CategoryId,
|
||||
string CategoryName,
|
||||
string CategoryIcon,
|
||||
decimal SuggestedAmount,
|
||||
decimal CurrentSpent,
|
||||
decimal HistoricalAverage,
|
||||
string Confidence,
|
||||
string ColorKey = "mint");
|
||||
public record BudgetRecommendationResponse(
|
||||
int Year,
|
||||
int Month,
|
||||
decimal SuggestedTotal,
|
||||
string Message,
|
||||
List<BudgetRecommendationItemDto> Items,
|
||||
string? AdjustmentSummary = null,
|
||||
List<string>? Warnings = null);
|
||||
public record BudgetDraftItemRequest(long CategoryId, decimal Amount);
|
||||
public record BudgetDraftRequest(
|
||||
decimal SuggestedTotal,
|
||||
List<BudgetDraftItemRequest> Items);
|
||||
public record BudgetRefinementTurn(string Role, string Content);
|
||||
public record RefineBudgetRecommendationRequest(
|
||||
long? LedgerId,
|
||||
int Year,
|
||||
int Month,
|
||||
string Instruction,
|
||||
BudgetDraftRequest CurrentDraft,
|
||||
List<BudgetRefinementTurn>? History = null);
|
||||
|
||||
// ---- Sticker ----
|
||||
public record StickerDto(string Key, string Label, string GroupKey);
|
||||
|
||||
// ---- Monthly report ----
|
||||
public record MonthlyReportDto(
|
||||
int Year, int Month, decimal Income, decimal Expense, decimal Balance, int Count,
|
||||
double AiRatio,
|
||||
string? TopDay, decimal TopDayAmount, string? TopDayNote,
|
||||
string? TopCategory, decimal TopCategoryAmount, double TopCategoryPercent,
|
||||
List<CategoryRankDto> CategoryRanking,
|
||||
string Roast);
|
||||
|
||||
public record CategoryRankDto(
|
||||
string Name, string IconKey, decimal Amount, double Percent,
|
||||
string ColorKey = "mint");
|
||||
|
||||
public record PeriodReportDto(
|
||||
string PeriodType, string PeriodLabel, DateTime StartDate, DateTime EndDate,
|
||||
decimal Income, decimal Expense, decimal Balance, int Count, double AiRatio,
|
||||
string? PeakLabel, decimal PeakAmount, string? PeakNote,
|
||||
string? TopCategory, decimal TopCategoryAmount, double TopCategoryPercent,
|
||||
List<CategoryRankDto> CategoryRanking,
|
||||
string Commentary);
|
||||
|
||||
// ---- OCR ----
|
||||
public record OcrParseRequest(string Text, string? Source = null);
|
||||
public record OcrParseResponse(
|
||||
bool Matched, long CategoryId, string CategoryName, string CategoryIcon,
|
||||
decimal Amount, string? PaymentMethod, string Note, string Type);
|
||||
public record ImageParseItemResponse(
|
||||
bool Matched, long CategoryId, string CategoryName, string CategoryIcon,
|
||||
string Type, decimal Amount, string? PaymentMethod, string Note,
|
||||
DateTime? OccurredAt);
|
||||
public record ImageParseResponse(
|
||||
bool Matched, long CategoryId, string CategoryName, string CategoryIcon,
|
||||
decimal Amount, string? PaymentMethod, string Note, string Type,
|
||||
List<ImageParseItemResponse> Items, DateTime? OccurredAt);
|
||||
|
||||
// ---- Chat ----
|
||||
public record SendChatRequest(string Content, string Type = "text", long? LedgerId = null); // text | sticker
|
||||
public record ChatMessageDto(
|
||||
long Id, string Role, string Type, string Content,
|
||||
TransactionDto? Transaction, DateTime CreatedAt);
|
||||
public record SendChatResponse(List<ChatMessageDto> Messages);
|
||||
|
||||
Reference in New Issue
Block a user