feat(hole): add favorite/subscription count stats #183
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.
实现了洞的收藏和订阅计数功能,以及相关的计数更新逻辑。
变更内容
favorite_count
/subscription_count
到 Hole 模型,默认值为 0recalculate_stats()
,支持收藏/订阅数量的聚合更新(含 DB + cache)AddUserSubscription
确保幂等性RemoveUserSubscription
处理取消订阅dbresolver.Write
保证写事务一致性为什么需要这个功能
测试情况
已添加相关测试用例并确保全部通过,覆盖了计数逻辑的各种情况。
Closes #182