yangjianbo
|
682f546c0e
|
fix(lint): 修复 golangci-lint 报告的代码问题
- errcheck: 修复类型断言未检查返回值的问题
- pool.go: 添加 sync.Map 类型断言安全检查
- req_client_pool.go: 添加 sync.Map 类型断言安全检查
- concurrency_cache_benchmark_test.go: 显式忽略断言返回值
- gateway_service.go: 显式忽略 WriteString 返回值
- gofmt: 修复代码格式问题
- redis.go: 注释对齐
- api_key_repo.go: 结构体字段对齐
- concurrency_cache.go: 字段对齐
- http_upstream.go: 注释对齐
- unused: 删除未使用的代码
- user_repo.go: 删除未使用的 sql 字段
- usage_service.go: 删除未使用的 calculateStats 函数
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2025-12-31 14:51:58 +08:00 |
|
yangjianbo
|
5906f9ab98
|
fix(数据层): 修复数据完整性与仓储一致性问题
## 数据完整性修复 (fix-critical-data-integrity)
- 添加 error_translate.go 统一错误转换层
- 修复 nil 输入和 NotFound 错误处理
- 增强仓储层错误一致性
## 仓储一致性修复 (fix-high-repository-consistency)
- Group schema 添加 default_validity_days 字段
- Account schema 添加 proxy edge 关联
- 新增 UsageLog ent schema 定义
- 修复 UpdateBalance/UpdateConcurrency 受影响行数校验
## 数据卫生修复 (fix-medium-data-hygiene)
- UserSubscription 添加软删除支持 (SoftDeleteMixin)
- RedeemCode/Setting 添加硬删除策略文档
- account_groups/user_allowed_groups 的 created_at 声明 timestamptz
- 停止写入 legacy users.allowed_groups 列
- 新增迁移: 011-014 (索引优化、软删除、孤立数据审计、列清理)
## 测试补充
- 添加 UserSubscription 软删除测试
- 添加迁移回归测试
- 添加 NotFound 错误测试
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2025-12-31 14:11:57 +08:00 |
|
yangjianbo
|
042d82359c
|
fix(仓储): 修复 ApiKey 更新并发语义
ApiKey 更新时显式设置 updated_at 并回填,避免二次查询竞态
补充软删除范围注释以统一审计语义
|
2025-12-29 19:59:36 +08:00 |
|
yangjianbo
|
ae191f72a4
|
fix(仓储): 修复软删除过滤与事务测试
修复软删除拦截器使用错误,确保默认查询过滤已删记录
仓储层改用 ent.Tx 与扫描辅助,避免 sql.Tx 断言问题
同步更新集成测试以覆盖事务与统计变动
|
2025-12-29 19:23:49 +08:00 |
|
yangjianbo
|
e9c755f428
|
perf(后端): 优化删除操作的数据库查询性能
- 新增 ExistsByID 方法用于账号存在性检查,避免加载完整对象
- 新增 GetOwnerID 方法用于 API Key 所有权验证,仅查询 user_id 字段
- 优化 AccountService.Delete 使用轻量级存在性检查
- 优化 ApiKeyService.Delete 使用轻量级权限验证
- 改进前端删除错误提示,显示后端返回的具体错误消息
- 添加详细的中文注释说明优化原因
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
2025-12-29 14:06:38 +08:00 |
|
yangjianbo
|
3d617de577
|
refactor(数据库): 迁移持久层到 Ent 并清理 GORM
将仓储层/基础设施改为 Ent + 原生 SQL 执行路径,并移除 AutoMigrate 与 GORM 依赖。
重构内容包括:
- 仓储层改用 Ent/SQL(含 usage_log/account 等复杂查询),统一错误映射
- 基础设施与 setup 初始化切换为 Ent + SQL migrations
- 集成测试与 fixtures 迁移到 Ent 事务模型
- 清理遗留 GORM 模型/依赖,补充迁移与文档说明
- 增加根目录 Makefile 便于前后端编译
测试:
- go test -tags unit ./...
- go test -tags integration ./...
|
2025-12-29 10:03:27 +08:00 |
|
IanShaw027
|
227d506c53
|
feat(backend): 增强使用统计和API密钥功能
- 优化使用统计处理逻辑
- 增强API密钥仓储层功能
- 改进账户使用服务
- 完善API契约测试覆盖
|
2025-12-27 16:03:57 +08:00 |
|
Forest
|
e5a77853b0
|
refactor: 调整项目结构为单向依赖
|
2025-12-26 16:45:40 +08:00 |
|
Forest
|
eeaff85e47
|
refactor: 自定义业务错误
|
2025-12-25 21:06:40 +08:00 |
|
Forest
|
836c4dda2b
|
refactor: 重命名 go module
|
2025-12-24 21:07:21 +08:00 |
|
Forest
|
e99b344b2b
|
refactor(backend): 引入端口接口模式
|
2025-12-19 21:26:19 +08:00 |
|
shaw
|
642842c29e
|
First commit
|
2025-12-18 13:50:39 +08:00 |
|