Files
EmailBill/openspec/changes/remove-v1-calendar-stats-budget/specs/transaction-api/spec.md
SunCheng a7954f55ad feat: remove V1 calendar/budget/stats modules
- 删除 V1 前端页面 (CalendarView, BudgetView, statisticsV1)
- 移除 V1 路由配置 (/calendar, /budget, /)
- 清理路由守卫中的 V1 版本切换逻辑
- 移除设置页面中的版本切换功能
- 更新底部导航和登录重定向到 V2 路由
- 移除 App.vue 中 V1 页面的缓存配置
- 删除后端 TransactionRecordController.GetDailyStatisticsAsync (Obsolete)
- 删除 TransactionStatisticsController.GetBalanceStatisticsAsync
- 保留 V2 仍在使用的共享 API (GetUncoveredCategories, GetArchiveSummary, GetDailyStatistics)
- 保留 V2 使用的全局事件监听机制
- 所有测试通过 (210/210)

Breaking Change: V1 API 端点和路由将不可用
2026-02-14 00:01:44 +08:00

3.3 KiB
Raw Blame History

REMOVED Requirements

Requirement: Get Daily Statistics (Obsolete)

Reason: 该接口已标记 [Obsolete],仅被 V1 日历页面使用。V2 使用 TransactionStatisticsController.GetDailyStatisticsAsync 替代。
Migration: 前端应调用 GET /api/TransactionStatistics/GetDailyStatistics 接口,后端应使用 TransactionStatisticsService.GetDailyStatisticsAsync 方法。

原有功能:

  • 接口: GET /api/TransactionRecord/GetDailyStatistics
  • Controller: TransactionRecordController.GetDailyStatisticsAsync
  • 参数: year (int), month (int)
  • 返回: List<DailyStatisticDto> (包含每日的支出、收入、余额统计)

被以下代码调用:

  • Web/src/views/CalendarView.vue 中的 fetchDailyStatistics 方法

Context

本规范定义了 EmailBill 后端 TransactionRecordController 中废弃的 V1 专用接口的移除操作。

接口历史

  • 创建时间: V1 版本早期,用于支持日历视图的日度统计
  • 废弃原因: 职责不清晰,日度统计应由 TransactionStatisticsController 统一管理
  • 废弃标记: 已标记 [Obsolete] 属性,建议开发者使用新接口
  • 当前使用: 仅被 CalendarView.vue (V1) 调用V2 日历页面不使用此接口

新接口对比

维度 V1 接口 (待删除) V2 接口 (推荐)
路径 /api/TransactionRecord/GetDailyStatistics /api/TransactionStatistics/GetDailyStatistics
Controller TransactionRecordController TransactionStatisticsController
职责 混杂在交易记录 CRUD 中 专注于统计查询
返回格式 List<DailyStatisticDto> 相同
性能 相同 相同

移除影响

  • 前端: CalendarView.vue 删除后,无其他前端代码调用此接口
  • 后端: TransactionRecordController 移除此方法后,不影响其他交易记录相关接口
  • 数据库: 无影响,底层查询逻辑由 TransactionStatisticsService 处理

Validation

验证标准

  1. 代码搜索验证:

    • 全局搜索 GetDailyStatistics,确认仅在以下位置出现:
      • TransactionRecordController.GetDailyStatisticsAsync (待删除)
      • CalendarView.vue (已删除)
      • TransactionStatisticsController.GetDailyStatisticsAsync (保留)
  2. 编译验证:

    • 删除 TransactionRecordController.GetDailyStatisticsAsync 方法后,后端项目编译通过
    • 无其他 Controller 或 Application 层代码引用此方法
  3. API 文档验证:

    • Swagger/Scalar 文档中不再显示 /api/TransactionRecord/GetDailyStatistics 端点
    • /api/TransactionStatistics/GetDailyStatistics 端点正常显示
  4. 运行时验证:

    • 前端调用 /api/TransactionRecord/GetDailyStatistics 返回 404
    • V2 日历页面调用 /api/TransactionStatistics/GetDailyStatistics 正常返回数据

Dependencies

移除此接口的前置条件:

  1. CalendarView.vue (V1 日历页面) 已删除
  2. V2 日历页面已完全使用 TransactionStatisticsController.GetDailyStatisticsAsync 接口

移除后不影响:

  • TransactionStatisticsController 中的同名方法 (不同 Controller)
  • 其他交易记录相关接口 (GetById, GetByDate, Update, Delete 等)
  • TransactionRecordRepository 的查询逻辑 (仍被 V2 接口使用)