Content: Post entity, tags, and approval workflow (Phase 4.1)
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 45/100
调研方向
阅读现有的 Members 模块作为参考,包括 tests/CommunityPro.Tests/Members/MembersTestHarness.cs,并追踪 IEndpointModule.MapEndpoints 和 DI 扩展的约定。然后梳理 ContentDbContext、content schema 迁移、Post 状态转换服务,以及针对每种转换和 featured-slot 行为的测试;当所有列出的验收标准和错误代码都得到覆盖时,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Scope
New CommunityPro.Content module: content Postgres schema, ContentDbContext, migrations, and the Post aggregate with its status workflow. Domain logic only — endpoints come in follow-up tickets.
Workflow
Draft → Submitted → (Approved ⇒ Published) | Rejected(reason) → Draft
Data model (content schema)
public sealed class Post
{
public Guid Id { get; set; }
public Guid AuthorId { get; set; }
public string Title { get; set; }
public string Slug { get; set; } // unique, generated from title, immutable after publish
public string Excerpt { get; set; }
public string ContentJson { get; set; } // TipTap JSON (stored for re-editing)
public string ContentHtml { get; set; } // sanitized render, produced server-side
public string? CoverImageUrl { get; set; } // Cloudinary
public List<string> Tags { get; set; } // jsonb; e.g. Engineering | Onboarding | Community Insights
public PostStatus Status { get; set; } // Draft | Submitted | Approved | Rejected | Published
public bool IsFeatured { get; set; } // single feature slot
public string? RejectionReason { get; set; }
public DateTimeOffset? PublishedAt { get; set; }
}
Rules
- Slug: generated, unique (DB constraint), immutable once published.
- Status transitions validated in a domain service returning
Result<T>— illegal transitions yieldcontent.invalid_state. IsFeaturedis a single slot: setting it clears the previous featured post (same pattern as members featured flag).- Rejection requires a reason; rejected posts return to
Draftkeeping the reason for the author to see.
Error codes
content.not_found, content.invalid_state, content.invalid_post
Acceptance criteria
- Module scaffold matches existing modules (Members is the reference): DbContext, schema,
IEndpointModulestub, DI extension - EF migration creates the table with slug unique constraint
- Transition table fully tested (every legal + illegal transition)
- Featured single-slot behavior tested
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
-
affected/v17 area/frontend type/bug
难度 2/5 1-3 小时 新手友好度 63/100
umbraco/Umbraco-CMS#24323 · 1 条评论 ·
维护者通常 2 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 73/100
dotnet/roslynator#1859 ·
维护者通常 1 天内回复
-
agent-ex documentation medium-priority testing
难度 2/5 1-3 小时 新手友好度 69/100
DigiBanks99/menlo#489 ·
维护者通常 1 天内回复
-
area:jobads-cv BE P3
难度 1/5 1-3 小时 新手友好度 74/100
klasolsson81/jobbliggaren#2240 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
k2-fsa/sherpa-onnx#4100 ·
维护者通常 2 天内回复