Remove redundant ShiftService and use IConfigurationService directly

Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-08-26 04:39:01 +00:00
parent 38096910d0
commit 380772503c
3 changed files with 2 additions and 23 deletions

View file

@ -8,20 +8,17 @@ namespace ShiftScheduler.Server.Controllers
[Route("api/[controller]")] [Route("api/[controller]")]
public class ShiftController : ControllerBase public class ShiftController : ControllerBase
{ {
private readonly ShiftService _shiftService;
private readonly IcsExportService _icsService; private readonly IcsExportService _icsService;
private readonly PdfExportService _pdfExportService; private readonly PdfExportService _pdfExportService;
private readonly ITransportService _transportService; private readonly ITransportService _transportService;
private readonly IConfigurationService _configurationService; private readonly IConfigurationService _configurationService;
public ShiftController( public ShiftController(
ShiftService shiftService,
IcsExportService icsService, IcsExportService icsService,
PdfExportService pdfExportService, PdfExportService pdfExportService,
ITransportService transportService, ITransportService transportService,
IConfigurationService configurationService) IConfigurationService configurationService)
{ {
_shiftService = shiftService;
_icsService = icsService; _icsService = icsService;
_pdfExportService = pdfExportService; _pdfExportService = pdfExportService;
_transportService = transportService; _transportService = transportService;
@ -31,13 +28,13 @@ namespace ShiftScheduler.Server.Controllers
[HttpGet("shifts")] [HttpGet("shifts")]
public IActionResult GetShifts() public IActionResult GetShifts()
{ {
return Ok(_shiftService.GetShifts()); return Ok(_configurationService.GetShifts());
} }
[HttpPost("shift_transport")] [HttpPost("shift_transport")]
public async Task<IActionResult> GetShiftTransport([FromBody] ShiftTransportRequest request) public async Task<IActionResult> GetShiftTransport([FromBody] ShiftTransportRequest request)
{ {
var shift = _shiftService.GetShifts().FirstOrDefault(s => s.Name == request.ShiftName); var shift = _configurationService.GetShifts().FirstOrDefault(s => s.Name == request.ShiftName);
if (shift == null) if (shift == null)
{ {
return NotFound($"Shift '{request.ShiftName}' not found"); return NotFound($"Shift '{request.ShiftName}' not found");

View file

@ -18,7 +18,6 @@ var appConfiguration = new ApplicationConfiguration
builder.Services.AddSingleton<IConfigurationService>(new ConfigurationService(appConfiguration)); builder.Services.AddSingleton<IConfigurationService>(new ConfigurationService(appConfiguration));
builder.Services.AddMemoryCache(); builder.Services.AddMemoryCache();
builder.Services.AddHttpClient<TransportApiService>(); builder.Services.AddHttpClient<TransportApiService>();
builder.Services.AddSingleton<ShiftService>();
builder.Services.AddSingleton<IcsExportService>(); builder.Services.AddSingleton<IcsExportService>();
builder.Services.AddSingleton<PdfExportService>(); builder.Services.AddSingleton<PdfExportService>();
builder.Services.AddSingleton<ITransportApiService, TransportApiService>(); builder.Services.AddSingleton<ITransportApiService, TransportApiService>();

View file

@ -1,17 +0,0 @@

using ShiftScheduler.Shared;
namespace ShiftScheduler.Services
{
public class ShiftService
{
private readonly IConfigurationService _configurationService;
public ShiftService(IConfigurationService configurationService)
{
_configurationService = configurationService;
}
public List<Shift> GetShifts() => _configurationService.GetShifts();
}
}