diff --git a/src/ClaudeDo.App/Program.cs b/src/ClaudeDo.App/Program.cs index 6536cde..343ea94 100644 --- a/src/ClaudeDo.App/Program.cs +++ b/src/ClaudeDo.App/Program.cs @@ -4,6 +4,7 @@ using ClaudeDo.Data.Git; using ClaudeDo.Releases; using ClaudeDo.Ui; using ClaudeDo.Ui.Services; +using ClaudeDo.Ui.Services.Interfaces; using ClaudeDo.Ui.ViewModels; using ClaudeDo.Ui.ViewModels.Islands; using ClaudeDo.Ui.ViewModels.Modals; @@ -100,6 +101,7 @@ sealed class Program sc.AddTransient(); sc.AddTransient>(sp => () => sp.GetRequiredService()); sc.AddSingleton(); + sc.AddSingleton(); sc.AddTransient(); sc.AddTransient(); sc.AddTransient(); diff --git a/src/ClaudeDo.Ui/Services/Interfaces/INotesApi.cs b/src/ClaudeDo.Ui/Services/Interfaces/INotesApi.cs new file mode 100644 index 0000000..f5e121d --- /dev/null +++ b/src/ClaudeDo.Ui/Services/Interfaces/INotesApi.cs @@ -0,0 +1,11 @@ +using ClaudeDo.Ui.Services; + +namespace ClaudeDo.Ui.Services.Interfaces; + +public interface INotesApi +{ + Task> ListAsync(DateOnly day); + Task AddAsync(DateOnly day, string text); + Task UpdateAsync(string id, string text); + Task DeleteAsync(string id); +} diff --git a/src/ClaudeDo.Ui/Services/WorkerNotesApi.cs b/src/ClaudeDo.Ui/Services/WorkerNotesApi.cs new file mode 100644 index 0000000..f63768b --- /dev/null +++ b/src/ClaudeDo.Ui/Services/WorkerNotesApi.cs @@ -0,0 +1,13 @@ +using ClaudeDo.Ui.Services.Interfaces; + +namespace ClaudeDo.Ui.Services; + +public sealed class WorkerNotesApi : INotesApi +{ + private readonly WorkerClient _client; + public WorkerNotesApi(WorkerClient client) => _client = client; + public Task> ListAsync(DateOnly day) => _client.GetDailyNotesAsync(day); + public Task AddAsync(DateOnly day, string text) => _client.AddDailyNoteAsync(day, text); + public Task UpdateAsync(string id, string text) => _client.UpdateDailyNoteAsync(id, text); + public Task DeleteAsync(string id) => _client.DeleteDailyNoteAsync(id); +}