feat(version): add version history list#476
Open
155TuT wants to merge 17 commits into
Open
Conversation
…t endpoint
- New version_history table with GORM soft-delete for audit trail
- GetVersionHistoryList RPC returns all version records ordered by created_at desc
- UploadVersion now persists each uploaded version (release/beta) to version_history
- New Thrift structs: VersionHistory, GetVersionHistoryList{Request,Response}
- Fix incorrect error messages in UploadVersion UPYUN upload paths
…ersionHistory to model - Move VersionHistory struct from version.thrift to model.thrift (PR review) - Split GetVersionHistoryList into separate DB file (PR review) - Rewrite GetReleaseVersion/GetBetaVersion to read from DB with Redis cache instead of UPYUN - Add GetLatestVersionByType DB query with ErrRecordNotFound handling - Add Redis cache (get/set/delete) for latest version per type - Update UploadVersion to refresh cache after DB write - Add boundary tests: empty list, cache hit/miss, DB error, no record
ee51ad7 to
08593b1
Compare
Contributor
Author
|
变基并重新推送以补充SSH签名。对不起我不知道为什么昨天提交的又没有签名 |
renbaoshuo
requested changes
Apr 30, 2026
| return nil, fmt.Errorf("getLatestVersion: no %s version found in database", versionType) | ||
| } | ||
| // Populate cache (ignore cache write errors — non-critical path) | ||
| _ = s.cache.Version.SetLatestVersionCache(s.ctx, vh) |
| `deleted_at` timestamp NULL DEFAULT NULL, | ||
| PRIMARY KEY (`id`), | ||
| INDEX `idx_created_at` (`created_at`), | ||
| INDEX `idx_type` (`type`) |
Comment on lines
+76
to
+79
| // Refresh the latest version cache for this type so GetReleaseVersion/GetBetaVersion | ||
| // return the newly uploaded version immediately. Cache write failure is non-critical. | ||
| _ = s.cache.Version.SetLatestVersionCache(s.ctx, vh) | ||
|
|
Member
There was a problem hiding this comment.
这个地方应该是删掉旧缓存,不然你的请求永远不会打到数据库里面其实
| PaperFileDirKeyExpire = 2 * ONE_DAY // [paper] 历年卷文件目录 | ||
| AcademicScoresExpire = 5 * ONE_MINUTE // [academic] 成绩信息 | ||
| VisitExpire = 1 * ONE_DAY // [version]访问统计 | ||
| LatestVersionKeyExpire = 10 * ONE_MINUTE // [version]最新版本缓存 |
Member
|
对了,加个分页 |
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #476 +/- ##
==========================================
- Coverage 63.81% 63.46% -0.35%
==========================================
Files 230 234 +4
Lines 6027 6142 +115
==========================================
+ Hits 3846 3898 +52
- Misses 2057 2120 +63
Partials 124 124
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 4 files with indirect coverage changes 🚀 New features to boost your workflow:
|
renbaoshuo
reviewed
May 21, 2026
Comment on lines
+34
to
+44
| type getVersionHistoryListRequest struct { | ||
| Password string `form:"password,required" query:"password,required" json:"password,required"` | ||
| Limit *int64 `form:"limit" query:"limit" json:"limit,omitempty"` | ||
| PageToken *int64 `form:"page_token" query:"page_token" json:"page_token,omitempty"` | ||
| } | ||
|
|
||
| type getVersionHistoryListResponse struct { | ||
| Data any `json:"data"` | ||
| PageToken *int64 `json:"page_token,omitempty"` | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
第一个提交(6ad6de8)
第二个提交(a1aa076)
GetReleaseVersion/GetBetaVersion 现在从 version_history DB 读取 10 分钟 Redis 缓存
具体改动:
自查 PR 结构
PR 标题符合这个格式: <type>(optional scope): <description>
此 PR 标题的描述以用户为导向,足够清晰,其他人可以理解。
我已经对所有 commit 提供了签名(GPG 密钥签名、SSH 密钥签名)
这个 PR 属于强制变更/破坏性更改
这个 PR 的类型是什么?
feat
这个 PR 做了什么 / 我们为什么需要这个 PR?
新增版本历史列表接口,用于:“发版了以后撤回一类的,还有就是对接一下我们后面的对API请求头版本信息相关的统计,方便看一下什么时间发的版本还在有人用,算是一个比较小的需求” ----baoshuo
(可选)这个 PR 解决了哪个/些 issue?
用以解决issues 446,新增版本历史列表接口,开一个pr先给大家审查,确保理解的标准和规范无误再增加其他接口
对 Reviewer 预留的一些提醒
已使用 SKILL.md 自查、通过本地编译,但未进行服务器部署测试(还不熟悉 + 没权限操作服务器)