Optimized db queries

This commit is contained in:
2025-01-26 14:20:50 +01:00
parent 07afb25be2
commit 2dd3f7f5be
5 changed files with 24 additions and 7 deletions

View File

@@ -12,4 +12,13 @@ internal sealed class TimelineRepository(IHttpClientFactory factory) : ITimeline
var data = await result.Content.ReadFromJsonAsync<IEnumerable<TimelineEntry>>(ct);
return data ?? [];
}
public async Task<IEnumerable<TimelineEntry>> GetFeaturedTimeline(CancellationToken ct) {
var client = factory.CreateClient("api");
var result = await client.GetAsync("api/timeline/featured", ct);
if (!result.IsSuccessStatusCode) return [];
var data = await result.Content.ReadFromJsonAsync<IEnumerable<TimelineEntry>>(ct);
return data ?? [];
}
}