feat: 实现 API 接口对接功能 (删除作品、作品搜索、修改密码)

按照 TDD 规范完成三个核心功能的接口对接:

## 新增功能

### 1. 删除作品功能 (app/generationRecord.tsx)
- 新增 use-template-generation-actions.ts hook
- 支持单个删除和批量删除作品
- 删除确认对话框
- 删除成功后自动刷新列表
- 完整的错误处理和加载状态

### 2. 作品搜索功能 (app/searchWorksResults.tsx)
- 新增 use-works-search.ts hook
- 替换模拟数据为真实 SDK 接口
- 支持关键词搜索和分类筛选
- 支持分页加载
- 完整的加载、错误、空结果状态处理

### 3. 修改密码功能 (app/changePassword.tsx)
- 新增 use-change-password.ts hook
- 使用 Better Auth 的 changePassword API
- 客户端表单验证(密码长度、确认密码匹配等)
- 成功后自动返回并提示

## 技术实现
- 严格遵循 TDD 规范(先写测试,后写实现)
- 新增 3 个 hooks 和对应的单元测试
- 更新中英文翻译文件
- 更新 jest.setup.js 添加必要的 mock

## 文档
- 新增 api_integration_report.md - API 对接分析报告
- 新增 api_integration_development_plan.md - 开发计划和完成汇总

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
imeepos
2026-01-23 19:15:24 +08:00
parent 4c01d8e9e7
commit e1340fa101
19 changed files with 2273 additions and 299 deletions

View File

@@ -184,9 +184,27 @@ jest.mock('react-native', () => {
...RN,
// Ensure RefreshControl is properly mocked for tests
RefreshControl: 'RefreshControl',
// Mock DevMenu to avoid TurboModuleRegistry errors
NativeModules: {
...RN.NativeModules,
DevMenu: {},
SettingsManager: {},
},
}
})
// Mock DevMenu module
jest.mock('react-native/src/private/devsupport/devmenu/DevMenu', () => ({
default: {},
}))
// Mock SettingsManager module
jest.mock('react-native/src/private/specs_DEPRECATED/modules/NativeSettingsManager', () => ({
default: {
getConstants: () => ({}),
},
}))
// Mock lib/auth to avoid TypeScript compilation errors
jest.mock('@/lib/auth', () => ({
OWNER_ID: 'test-owner-id',