Harden the content contracts and enforce the slug rule

This commit is contained in:
tleininger committed 2026-09-24 12:08:56 +02:00
1 parent d06af2891a
commit 0f7e968c16
13 files changed
+157 -81

No files matched your search

+21 -10
View File
@@ -13,30 +13,41 @@ public record Faq
/// <summary>
/// Gets the PocketBase record id.
/// </summary>
/// <remarks>
/// <see langword="required"/>: every stored record has an id. Modeling it as
/// required states which fields a record must carry, independent of the store,
/// so a future data source has to supply them too.
/// </remarks>
[JsonPropertyName("id")]
public string Id { get; init; } = "";
public required string Id { get; init; }
/// <summary>
/// Gets the question as a parent would phrase it.
/// </summary>
/// <remarks>
/// <see langword="required"/>: a FAQ entry without a question is incomplete, and
/// the field is required in PocketBase.
/// </remarks>
[JsonPropertyName("question")]
public string Question { get; init; } = "";
public required string Question { get; init; }
/// <summary>
/// Gets the answer as Markdown.
/// </summary>
/// <remarks>
/// <see langword="required"/>: a FAQ entry exists to answer its question, so an
/// entry without an answer is incomplete. The field is required in PocketBase.
/// </remarks>
[JsonPropertyName("answer")]
public string Answer { get; init; } = "";
public required string Answer { get; init; }
/// <summary>
/// Gets the topic the question is grouped under, e.g. <c>"mensa"</c>.
/// </summary>
/// <remarks>
/// <see langword="required"/>: the FAQ page groups entries by topic, so an entry
/// without one has no place. The field is required in PocketBase.
/// </remarks>
[JsonPropertyName("topic")]
public string Topic { get; init; } = "";
/// <summary>
/// Gets a value indicating whether the question is visible to visitors of the site.
/// </summary>
[JsonPropertyName("public")]
public bool Public { get; init; }
public required string Topic { get; init; }
}