Contributors: leaderboard endpoint with period filters (Phase 5.3)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- csharp, postgresql
调研方向
先检查 dependency #6,然后通过 IEndpointModule.MapEndpoints 和现有的 Members/Identity public contract 追踪 endpoint module 模式。在 tests/CommunityPro.Tests// 下添加 xUnit 覆盖之前,先阅读 ContributionEvent 和 MembersTestHarness.cs 的模式。完成的标准是:提供分页的匿名响应、确定性排名、UTC 时间段边界覆盖、稳定的错误映射,以及仅包含活跃成员的 profile 数据。
由索引模型根据 Issue 内容生成。
描述
Scope
GET /contributors?period=all|90d|30d (anonymous, paginated) returning the ranked leaderboard the Top Contributors page renders (ISR, revalidate 300s).
Shape
{ "rank": 1, "login": "octocat", "avatarUrl": "…", "memberId": "…|null", "displayName": "…|null", "mergedPrs": 42 }
Rules
- Aggregate with a plain grouped query over
ContributionEventfirst (materialize into acontributor_statsview/table only if it proves slow — don't pre-optimize). - Join to member profiles via
GithubUserIdthrough a public module contract on the Members/Identity side (e.g. a bulk lookupIReadOnlyDictionary<long, MemberRef>by GitHub id) — no cross-module DbContext access. - Non-member org contributors still appear (login + GitHub avatar,
memberId: null). Deactivated members appear as non-members (no profile link). - Period boundaries computed in UTC off
MergedAt.
Error codes
contributors.invalid_period
Dependencies
Blocked by #6. Backfill #7 makes the data real but isn't a code dependency.
Acceptance criteria
- Ranking is stable (ties broken deterministically, e.g. earliest merge first)
- Period filters tested at the boundary (e.g. a PR merged exactly 90d ago)
- Member join returns profile info only for active members
- Paginated; default page size sensible (~20)
Conventions (project-wide, non-negotiable)
- .NET 9, records for immutable shapes, file-scoped namespaces, primary constructors where they read well. Minimal-API endpoints grouped per module via
IEndpointModule.MapEndpoints. Result<T>(SharedKernel) instead of exception-driven control flow. Endpoint results map failures to ProblemDetails with the stable error codes listed above — the frontend keys off them.- Module owns its EF Core
DbContextmapped to its own Postgres schema. Modules never reference each other's internals — cross-module needs go through a public contract interface or an in-process domain event (IEventPublisher). - All external calls (GitHub, Stripe, Brevo, Cloudinary, Meilisearch) behind interfaces owned by the consuming module.
- Every list endpoint paginated (offset is fine). xUnit tests in
tests/CommunityPro.Tests/<Module>/following the existing harness patterns (seeMembers/MembersTestHarness.cs).
- 主要语言
- C#
- 星标
- 0
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CommunityPro/community-pro-api 的其他 Issue
-
cross-cutting decision
难度 5/5 一周以上 新手友好度 35/100
-
cross-cutting
难度 4/5 3-5 天 新手友好度 58/100
-
admin
难度 5/5 一周以上 新手友好度 35/100
-
admin
难度 5/5 一周以上 新手友好度 35/100
-
sponsorship
难度 4/5 3-5 天 新手友好度 48/100
查看 CommunityPro/community-pro-api 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
RadicalCSG/com.chisel#192 ·
维护者通常 1 天内回复
-
area-testing p2-post-1.0 technical-debt
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
Bug good first issue
难度 2/5 1-3 小时 新手友好度 72/100
RazorConsole/RazorConsole#447 ·
维护者通常 1 天内回复
-
CloudEventsMiddleware decodes JSON string data for `+json` content types可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
dapr/dotnet-sdk#1964 ·
维护者通常 1 天内回复
-
bug P3
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复