Files
EnvelopeGenerator/EnvelopeGenerator.ServiceHost/Controllers/WorkerController.cs
TekH 6a9792bb57 Refactor WorkerController to manage job state via API
Removed endpoints for starting/stopping/restarting the Worker service. Controller now uses JobStateManager to get and set the state of specific jobs (e.g., FinalizeDocumentJob) through new GET and POST endpoints. Focus shifts from service lifecycle control to job state management.
2026-04-13 16:31:54 +02:00

21 lines
711 B
C#

using EnvelopeGenerator.ServiceHost.Jobs;
using Microsoft.AspNetCore.Mvc;
namespace EnvelopeGenerator.ServiceHost.Controllers;
[Route("api/[controller]")]
[ApiController]
public class WorkerController(JobStateManager jobStateManager) : ControllerBase
{
private readonly JobStateManager _jobStateManager = jobStateManager;
[HttpGet(nameof(FinalizeDocumentJob))]
public IActionResult GetStateOfFinalizeDocumentJob() => Ok(_jobStateManager.GetState<FinalizeDocumentJob>());
[HttpPost(nameof(FinalizeDocumentJob))]
public IActionResult SetStateOfFinalizeDocumentJob([FromQuery] State state)
{
_jobStateManager.SetState<FinalizeDocumentJob>(state);
return Ok();
}
}