Convert PocketBase dates to Berlin time; document code conventions

This commit is contained in:
tleininger committed 2026-09-24 08:53:47 +02:00
1 parent 4b93434679
commit aef05fb090
11 files changed
+406 -129

No files matched your search

+45 -13
View File
@@ -3,45 +3,77 @@ using System.Text.Json.Serialization;
namespace Elternbeirat.Contracts;
/// <summary>
/// A content page. Pages also drive the site navigation: <see cref="Location"/>
/// and <see cref="Order"/> decide where and in which order a page appears in the
/// header or footer menu, and <see cref="Embed"/> lists dynamic blocks (posts,
/// events, faqs) rendered below the page body.
/// A content page of the site, as stored in PocketBase.
/// </summary>
/// <remarks>
/// Pages also drive the site navigation: <see cref="Location"/> and
/// <see cref="Order"/> decide where and in which order a page appears in the
/// header or footer menu. <see cref="Embed"/> lists dynamic blocks rendered
/// below the page body.
/// </remarks>
public record Page
{
/// <summary>PocketBase record id.</summary>
/// <summary>
/// Gets the PocketBase record id.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; init; } = "";
/// <summary>Heading shown to visitors; may contain umlauts and spaces.</summary>
/// <summary>
/// Gets the heading shown to visitors.
/// </summary>
/// <remarks>
/// Free text; may contain umlauts and spaces. For the URL, see <see cref="Slug"/>.
/// </remarks>
[JsonPropertyName("title")]
public string Title { get; init; } = "";
/// <summary>Page body in Markdown.</summary>
/// <summary>
/// Gets the page body as Markdown.
/// </summary>
[JsonPropertyName("body")]
public string Body { get; init; } = "";
/// <summary>Where the page appears in the navigation: "header" or "footer".</summary>
/// <summary>
/// Gets the navigation menu the page appears in.
/// </summary>
/// <value>
/// Either <c>"header"</c> or <c>"footer"</c>.
/// </value>
[JsonPropertyName("location")]
public string Location { get; init; } = "";
/// <summary>Sort order within its navigation location; smaller is earlier.</summary>
/// <summary>
/// Gets the sort order within the navigation menu given by <see cref="Location"/>.
/// </summary>
/// <value>
/// The sort key; pages with smaller values appear first.
/// </value>
[JsonPropertyName("order")]
public double Order { get; init; }
/// <summary>URL slug (lowercase, no umlauts), e.g. "board" -> /board.</summary>
/// <summary>
/// Gets the URL slug of the page, e.g. <c>"board"</c> for <c>/board</c>.
/// </summary>
/// <value>
/// A lowercase path segment without umlauts.
/// </value>
[JsonPropertyName("slug")]
public string Slug { get; init; } = "";
/// <summary>
/// Dynamic blocks to render below the body: any of "posts", "events", "faqs".
/// Empty for a plain text page.
/// Gets the dynamic blocks rendered below the <see cref="Body"/>.
/// </summary>
/// <value>
/// Any of <c>"posts"</c>, <c>"events"</c> and <c>"faqs"</c>, or an empty list
/// for a plain text page.
/// </value>
[JsonPropertyName("embed")]
public IReadOnlyList<string> Embed { get; init; } = [];
/// <summary>Whether the page is visible to visitors.</summary>
/// <summary>
/// Gets a value indicating whether the page is visible to visitors of the site.
/// </summary>
[JsonPropertyName("public")]
public bool Public { get; init; }
}