Remove redundant ShiftService and use IConfigurationService directly
Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com>
This commit is contained in:
parent
38096910d0
commit
380772503c
3 changed files with 2 additions and 23 deletions
|
|
@ -8,20 +8,17 @@ namespace ShiftScheduler.Server.Controllers
|
|||
[Route("api/[controller]")]
|
||||
public class ShiftController : ControllerBase
|
||||
{
|
||||
private readonly ShiftService _shiftService;
|
||||
private readonly IcsExportService _icsService;
|
||||
private readonly PdfExportService _pdfExportService;
|
||||
private readonly ITransportService _transportService;
|
||||
private readonly IConfigurationService _configurationService;
|
||||
|
||||
public ShiftController(
|
||||
ShiftService shiftService,
|
||||
IcsExportService icsService,
|
||||
PdfExportService pdfExportService,
|
||||
ITransportService transportService,
|
||||
IConfigurationService configurationService)
|
||||
{
|
||||
_shiftService = shiftService;
|
||||
_icsService = icsService;
|
||||
_pdfExportService = pdfExportService;
|
||||
_transportService = transportService;
|
||||
|
|
@ -31,13 +28,13 @@ namespace ShiftScheduler.Server.Controllers
|
|||
[HttpGet("shifts")]
|
||||
public IActionResult GetShifts()
|
||||
{
|
||||
return Ok(_shiftService.GetShifts());
|
||||
return Ok(_configurationService.GetShifts());
|
||||
}
|
||||
|
||||
[HttpPost("shift_transport")]
|
||||
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)
|
||||
{
|
||||
return NotFound($"Shift '{request.ShiftName}' not found");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ var appConfiguration = new ApplicationConfiguration
|
|||
builder.Services.AddSingleton<IConfigurationService>(new ConfigurationService(appConfiguration));
|
||||
builder.Services.AddMemoryCache();
|
||||
builder.Services.AddHttpClient<TransportApiService>();
|
||||
builder.Services.AddSingleton<ShiftService>();
|
||||
builder.Services.AddSingleton<IcsExportService>();
|
||||
builder.Services.AddSingleton<PdfExportService>();
|
||||
builder.Services.AddSingleton<ITransportApiService, TransportApiService>();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue