Define the all-day rule once as Event.HasTime
This commit is contained in:
1 parent
31b114982e
commit
66bc76af1c
4 files changed
+87
-57
No files matched your search
@@ -14,6 +14,12 @@ namespace Elternbeirat.PocketBase;
|
||||
/// PocketBase via query parameters.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Responses are deserialized with the web defaults. Date conversion from UTC
|
||||
/// to Berlin wall-clock time is declared on the contracts themselves via
|
||||
/// <c>[JsonConverter]</c> (e.g. <see cref="Event.Start"/>, <see cref="Post.Date"/>),
|
||||
/// so no serializer options are configured here.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Register the class as a typed client via <c>AddHttpClient</c>, with
|
||||
/// <see cref="HttpClient.BaseAddress"/> set to the PocketBase base URL.
|
||||
/// </para>
|
||||
@@ -23,11 +29,6 @@ namespace Elternbeirat.PocketBase;
|
||||
/// </param>
|
||||
public sealed class PocketBaseClient(HttpClient http)
|
||||
{
|
||||
/// <summary>
|
||||
/// Shared serializer options for every request; see <see cref="CreateJsonOptions"/>.
|
||||
/// </summary>
|
||||
private static readonly JsonSerializerOptions JsonOptions = CreateJsonOptions();
|
||||
|
||||
/// <summary>
|
||||
/// Gets all public pages, ordered by <see cref="Page.Order"/>.
|
||||
/// </summary>
|
||||
@@ -82,18 +83,6 @@ public sealed class PocketBaseClient(HttpClient http)
|
||||
public Task<IReadOnlyList<Faq>> GetFaqsAsync(CancellationToken ct = default)
|
||||
=> GetRecordsAsync<Faq>("faqs", "topic", ct);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the serializer options. Date handling lives on the contracts
|
||||
/// themselves via <c>[JsonConverter]</c> on each date field (e.g.
|
||||
/// <see cref="Contracts.Event.Start"/>, <see cref="Contracts.Post.Date"/>), so
|
||||
/// nothing date-related is registered here.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// The configured options.
|
||||
/// </returns>
|
||||
private static JsonSerializerOptions CreateJsonOptions() =>
|
||||
new() { PropertyNameCaseInsensitive = true };
|
||||
|
||||
/// <summary>
|
||||
/// Gets all public records of a collection in a single request.
|
||||
/// </summary>
|
||||
@@ -123,7 +112,7 @@ public sealed class PocketBaseClient(HttpClient http)
|
||||
+ $"?perPage=500&filter={Uri.EscapeDataString("public=true")}"
|
||||
+ $"&sort={Uri.EscapeDataString(sort)}";
|
||||
|
||||
var result = await http.GetFromJsonAsync<RecordList<T>>(url, JsonOptions, ct);
|
||||
var result = await http.GetFromJsonAsync<RecordList<T>>(url, ct);
|
||||
return result?.Items ?? [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user