feat(daily-prep): add ClearMyDay hub method

This commit is contained in:
mika kuns
2026-06-04 08:05:33 +02:00
parent e48475d6cd
commit fa83d7f441
2 changed files with 120 additions and 0 deletions

View File

@@ -581,4 +581,19 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
using var ctx = _dbFactory.CreateDbContext();
await new DailyNoteRepository(ctx).DeleteAsync(id);
}
public async Task<int> ClearMyDay()
{
await using var ctx = await _dbFactory.CreateDbContextAsync();
var ids = await ctx.Tasks.Where(t => t.IsMyDay).Select(t => t.Id).ToListAsync();
if (ids.Count == 0) return 0;
await ctx.Tasks.Where(t => t.IsMyDay)
.ExecuteUpdateAsync(s => s.SetProperty(t => t.IsMyDay, false));
foreach (var id in ids)
await _broadcaster.TaskUpdated(id);
return ids.Count;
}
}