Files
Elternbeirat/Elternbeirat.Contracts/Post.cs
T

35 lines
1.1 KiB
C#

using System.Text.Json.Serialization;
namespace Elternbeirat.Contracts;
/// <summary>A news post. Sorted by <see cref="Date"/>, newest first.</summary>
public record Post
{
/// <summary>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.
/// </summary>
[JsonPropertyName("date")]
public DateTime Date { get; init; }
/// <summary>Post heading shown to visitors; may contain umlauts and spaces.</summary>
[JsonPropertyName("title")]
public string Title { get; init; } = "";
/// <summary>Post body in Markdown.</summary>
[JsonPropertyName("body")]
public string Body { get; init; } = "";
/// <summary>URL slug (lowercase, no umlauts), e.g. "herbstbasar" -> /posts/herbstbasar.</summary>
[JsonPropertyName("slug")]
public string Slug { get; init; } = "";
/// <summary>Whether the post is visible to visitors.</summary>
[JsonPropertyName("public")]
public bool Public { get; init; }
}