Content: public read endpoints, Meilisearch posts index, ISR revalidation (Phase 4.4)

未关闭
#5 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
42/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
csharp, postgres

调研方向

从 CommunityPro.Search 模块模式、现有的 reindex 命令以及使用现有 search fake 的测试开始;Members/MembersTestHarness.cs 展示了项目的测试工具约定。跟踪由 #4 发出的 PostPublished 事件以及公共 endpoint 的分组约定。完成意味着所有验收标准都通过,包括过滤未发布的 post、具备韧性的同步和重新验证、稳定的错误代码,以及批量 reindex。

由索引模型根据 Issue 内容生成。

描述

content

Scope

Public read surface + search sync + frontend cache invalidation for the blog.

Endpoints (anonymous)

Method Path Notes
GET /posts published only, tag filter, paginated, newest first
GET /posts/{slug} published only; feeds the ISR post page
GET /posts/featured the single featured published post

Meilisearch posts index

  • Follow the CommunityPro.Search module patterns exactly (hand-rolled REST client, index+settings ensured at boot, sync-on-write handler that logs failures and never throws).
  • Document shape mirrors public card data only: id, slug, title, excerpt, tags, authorId, publishedAt. Searchable: title, excerpt, tags; filterable: tags; sortable: publishedAt. Never index drafts/submitted/rejected posts — publish adds, unpublish/reject removes.
  • Extend the existing reindex command (dotnet run -- reindex) to rebuild posts alongside members in 500-doc batches.

ISR revalidation

On PostPublished: POST {FRONTEND_URL}/api/revalidate?tag=post-{slug} with a shared secret header (REVALIDATE_SECRET — treat like any credential). Best-effort with logging; never fail the pipeline.

Error codes

content.not_found, search.unavailable (degrade like members search does)

Dependencies

Blocked by #3; consumes the PostPublished event emitted by #4.

Acceptance criteria

  • Unpublished posts are unreachable via every public endpoint and absent from the index (query-level filtering, tested)
  • PostPublished handler upserts the search doc; failure is logged, not thrown
  • Revalidation call sends the secret and swallows/logs failures
  • reindex rebuilds posts (test via the existing search fakes)
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 DbContext mapped 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 (see Members/MembersTestHarness.cs).
主要语言
C#
星标
0
派生
0
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CommunityPro/community-pro-api 的其他 Issue

查看 CommunityPro/community-pro-api 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。