Add PocketBase client with contracts and sharp build tooling
This commit is contained in:
1 parent
56922707ea
commit
251f2d818b
24 files changed
+578
-20
No files matched your search
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Elternbeirat.Contracts;
|
||||
|
||||
/// <summary>A calendar entry. Sorted by <see cref="Start"/>.</summary>
|
||||
public record Event
|
||||
{
|
||||
/// <summary>PocketBase record id.</summary>
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; init; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Start of the event with date and time. Stored as UTC by PocketBase but
|
||||
/// read as local time (Europe/Berlin) by convention. An all-day event uses
|
||||
/// 00:00 as the time.
|
||||
/// </summary>
|
||||
[JsonPropertyName("start")]
|
||||
public DateTime Start { get; init; }
|
||||
|
||||
/// <summary>Optional end of the event; null when unset.</summary>
|
||||
[JsonPropertyName("end")]
|
||||
public DateTime? End { get; init; }
|
||||
|
||||
/// <summary>Event name, e.g. "Elternbeiratssitzung".</summary>
|
||||
[JsonPropertyName("title")]
|
||||
public string Title { get; init; } = "";
|
||||
|
||||
/// <summary>Optional location, e.g. "Aula".</summary>
|
||||
[JsonPropertyName("location")]
|
||||
public string Location { get; init; } = "";
|
||||
|
||||
/// <summary>Optional note, e.g. "Anmeldung erforderlich".</summary>
|
||||
[JsonPropertyName("note")]
|
||||
public string Note { get; init; } = "";
|
||||
|
||||
/// <summary>Whether the event is visible to visitors.</summary>
|
||||
[JsonPropertyName("public")]
|
||||
public bool Public { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Elternbeirat.Contracts;
|
||||
|
||||
/// <summary>
|
||||
/// A single question and answer, grouped on the FAQ page by <see cref="Topic"/>.
|
||||
/// </summary>
|
||||
public record Faq
|
||||
{
|
||||
/// <summary>PocketBase record id.</summary>
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; init; } = "";
|
||||
|
||||
/// <summary>The question as a parent would phrase it.</summary>
|
||||
[JsonPropertyName("question")]
|
||||
public string Question { get; init; } = "";
|
||||
|
||||
/// <summary>The answer in Markdown.</summary>
|
||||
[JsonPropertyName("answer")]
|
||||
public string Answer { get; init; } = "";
|
||||
|
||||
/// <summary>Topic the question is grouped under, e.g. "mensa".</summary>
|
||||
[JsonPropertyName("topic")]
|
||||
public string Topic { get; init; } = "";
|
||||
|
||||
/// <summary>Whether the question is visible to visitors.</summary>
|
||||
[JsonPropertyName("public")]
|
||||
public bool Public { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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.
|
||||
/// </summary>
|
||||
public record Page
|
||||
{
|
||||
/// <summary>PocketBase record id.</summary>
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; init; } = "";
|
||||
|
||||
/// <summary>Heading shown to visitors; may contain umlauts and spaces.</summary>
|
||||
[JsonPropertyName("title")]
|
||||
public string Title { get; init; } = "";
|
||||
|
||||
/// <summary>Page body in Markdown.</summary>
|
||||
[JsonPropertyName("body")]
|
||||
public string Body { get; init; } = "";
|
||||
|
||||
/// <summary>Where the page appears in the navigation: "header" or "footer".</summary>
|
||||
[JsonPropertyName("location")]
|
||||
public string Location { get; init; } = "";
|
||||
|
||||
/// <summary>Sort order within its navigation location; smaller is earlier.</summary>
|
||||
[JsonPropertyName("order")]
|
||||
public double Order { get; init; }
|
||||
|
||||
/// <summary>URL slug (lowercase, no umlauts), e.g. "board" -> /board.</summary>
|
||||
[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.
|
||||
/// </summary>
|
||||
[JsonPropertyName("embed")]
|
||||
public IReadOnlyList<string> Embed { get; init; } = [];
|
||||
|
||||
/// <summary>Whether the page is visible to visitors.</summary>
|
||||
[JsonPropertyName("public")]
|
||||
public bool Public { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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; }
|
||||
}
|
||||
Reference in new issue
Block a user