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

+16 -11
View File
@@ -14,8 +14,13 @@ public record Event
/// <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 start of the event as Europe/Berlin wall-clock time.
@@ -24,10 +29,12 @@ public record Event
/// PocketBase stores the value in UTC; it is converted to Berlin local time on
/// deserialization, with daylight saving applied. An all-day event uses 00:00
/// as the time.
/// <see langword="required"/>: an event without a start has no place on the
/// calendar, and the field is required in PocketBase.
/// </remarks>
[JsonPropertyName("start")]
[JsonConverter(typeof(LocalDateTimeConverter))]
public DateTime Start { get; init; }
public required DateTime Start { get; init; }
/// <summary>
/// Gets the optional end of the event as Europe/Berlin wall-clock time.
@@ -42,8 +49,12 @@ public record Event
/// <summary>
/// Gets the event name, e.g. <c>"Elternbeiratssitzung"</c>.
/// </summary>
/// <remarks>
/// <see langword="required"/>: an event without a name is incomplete, and the
/// field is required in PocketBase.
/// </remarks>
[JsonPropertyName("title")]
public string Title { get; init; } = "";
public required string Title { get; init; }
/// <summary>
/// Gets the optional location, e.g. <c>"Aula"</c>.
@@ -52,7 +63,7 @@ public record Event
/// The location, or <see cref="string.Empty"/> if none is set.
/// </value>
[JsonPropertyName("location")]
public string Location { get; init; } = "";
public string Location { get; init; } = string.Empty;
/// <summary>
/// Gets the optional note, e.g. <c>"Anmeldung erforderlich"</c>.
@@ -61,13 +72,7 @@ public record Event
/// The note, or <see cref="string.Empty"/> if none is set.
/// </value>
[JsonPropertyName("note")]
public string Note { get; init; } = "";
/// <summary>
/// Gets a value indicating whether the event is visible to visitors of the site.
/// </summary>
[JsonPropertyName("public")]
public bool Public { get; init; }
public string Note { get; init; } = string.Empty;
/// <summary>
/// Gets a value indicating whether the event has a wall-clock time, as opposed