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

+32 -8
View File
@@ -2,33 +2,57 @@ using System.Text.Json.Serialization;
namespace Elternbeirat.Contracts;
/// <summary>A news post. Sorted by <see cref="Date"/>, newest first.</summary>
/// <summary>
/// A news post of the site, as stored in PocketBase.
/// </summary>
/// <remarks>
/// Post lists are ordered by <see cref="Date"/>, newest first.
/// </remarks>
public record Post
{
/// <summary>PocketBase record id.</summary>
/// <summary>
/// Gets the PocketBase record id.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; init; } = "";
/// <summary>
/// Publication date. Stored as UTC by PocketBase but read as local time
/// (Europe/Berlin) by convention; only the date part is shown.
/// Gets the publication date as Europe/Berlin wall-clock time.
/// </summary>
/// <remarks>
/// PocketBase stores the value in UTC; it is converted to Berlin local time on
/// deserialization, with daylight saving applied. Only the date part is shown.
/// </remarks>
[JsonPropertyName("date")]
public DateTime Date { get; init; }
/// <summary>Post 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>Post body in Markdown.</summary>
/// <summary>
/// Gets the post body as Markdown.
/// </summary>
[JsonPropertyName("body")]
public string Body { get; init; } = "";
/// <summary>URL slug (lowercase, no umlauts), e.g. "herbstbasar" -> /posts/herbstbasar.</summary>
/// <summary>
/// Gets the URL slug of the post, e.g. <c>"herbstbasar"</c> for <c>/posts/herbstbasar</c>.
/// </summary>
/// <value>
/// A lowercase path segment without umlauts.
/// </value>
[JsonPropertyName("slug")]
public string Slug { get; init; } = "";
/// <summary>Whether the post is visible to visitors.</summary>
/// <summary>
/// Gets a value indicating whether the post is visible to visitors of the site.
/// </summary>
[JsonPropertyName("public")]
public bool Public { get; init; }
}