feat(hub): add RunTicketImportNow and ticket fallback list endpoints
This commit is contained in:
@@ -1028,11 +1028,15 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public async Task<bool> RunDailyPrepNow()
|
||||
public Task<bool> RunDailyPrepNow() => RunPrimeNowAsync(ClaudeDo.Data.Models.PrimeActionKind.FillMyDay);
|
||||
|
||||
/// <summary>The "Tickets + plan day" button: ticket import, then FillMyDay, through the same Prime gate.</summary>
|
||||
public Task<bool> RunTicketImportNow() => RunPrimeNowAsync(ClaudeDo.Data.Models.PrimeActionKind.ImportTickets);
|
||||
|
||||
// A button means its own kind no matter how the schedules are configured — hence a synthetic schedule.
|
||||
private async Task<bool> RunPrimeNowAsync(ClaudeDo.Data.Models.PrimeActionKind kind)
|
||||
{
|
||||
var schedule = new PrimeScheduleDto(
|
||||
Guid.Empty, 0, TimeSpan.Zero, true, null, null,
|
||||
ClaudeDo.Data.Models.PrimeActionKind.FillMyDay);
|
||||
var schedule = new PrimeScheduleDto(Guid.Empty, 0, TimeSpan.Zero, true, null, null, kind);
|
||||
var firedAt = DateTimeOffset.Now;
|
||||
var outcome = await _primeRunner.FireAsync(schedule, Context.ConnectionAborted);
|
||||
await _broadcaster.PrimeFired(Guid.Empty, outcome.Success, outcome.Message, firedAt);
|
||||
@@ -1363,8 +1367,19 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
|
||||
// Liefert die EFFEKTIVE Base-URL (inkl. ergänztem Schema), nicht den rohen Feldwert: sonst
|
||||
// sieht der Nutzer im Tab weiter "host.local", während der Client "http://host.local" ruft.
|
||||
public TicketSettingsDto GetTicketSettings()
|
||||
=> new(_ticketConfig.BaseUrl, _ticketConfig.Token is not null);
|
||||
public async Task<TicketSettingsDto> GetTicketSettings()
|
||||
{
|
||||
using var ctx = _dbFactory.CreateDbContext();
|
||||
var settings = await new AppSettingsRepository(ctx).GetAsync(Context.ConnectionAborted);
|
||||
return new TicketSettingsDto(_ticketConfig.BaseUrl, _ticketConfig.Token is not null, settings.TicketFallbackListId);
|
||||
}
|
||||
|
||||
/// <summary>Sets the list that import_ticket uses when Claude passes no list; null clears it.</summary>
|
||||
public async Task SetTicketFallbackList(string? listId)
|
||||
{
|
||||
using var ctx = _dbFactory.CreateDbContext();
|
||||
await new AppSettingsRepository(ctx).SetTicketFallbackListIdAsync(listId, Context.ConnectionAborted);
|
||||
}
|
||||
|
||||
public void SetTicketApiBaseUrl(string? baseUrl)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user