59 lines
1.7 KiB
C#
59 lines
1.7 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Elternbeirat.Contracts;
|
|
|
|
/// <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>
|
|
/// Gets the PocketBase record id.
|
|
/// </summary>
|
|
[JsonPropertyName("id")]
|
|
public string Id { get; init; } = "";
|
|
|
|
/// <summary>
|
|
/// 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>
|
|
/// 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>
|
|
/// Gets the post body as Markdown.
|
|
/// </summary>
|
|
[JsonPropertyName("body")]
|
|
public string Body { get; init; } = "";
|
|
|
|
/// <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>
|
|
/// Gets a value indicating whether the post is visible to visitors of the site.
|
|
/// </summary>
|
|
[JsonPropertyName("public")]
|
|
public bool Public { get; init; }
|
|
}
|