feat(daily-prep): persist last prep run to a log file and serve it via GetLastPrepLog

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-04 09:39:11 +02:00
parent 3a40e39fc8
commit 4d82079cac
4 changed files with 48 additions and 1 deletions

View File

@@ -582,6 +582,19 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
await new DailyNoteRepository(ctx).DeleteAsync(id);
}
public Task<string> GetLastPrepLog()
{
var path = DailyPrepPrompt.LogPath();
if (!File.Exists(path)) return Task.FromResult(string.Empty);
const int maxBytes = 256 * 1024;
var bytes = File.ReadAllBytes(path);
var text = bytes.Length <= maxBytes
? System.Text.Encoding.UTF8.GetString(bytes)
: System.Text.Encoding.UTF8.GetString(bytes, bytes.Length - maxBytes, maxBytes);
return Task.FromResult(text);
}
public async Task<int> ClearMyDay()
{
await using var ctx = await _dbFactory.CreateDbContextAsync();