Added backend API project to segregate responsibilites - Data is now handled in API project and business is all handled in UI project.
This commit is contained in:
46
ReportingServicesAPIs/Controllers/FabTimeController.cs
Normal file
46
ReportingServicesAPIs/Controllers/FabTimeController.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReportingServices.Shared.Models.ProductionReport;
|
||||
using ReportingServices.Shared.Repositories;
|
||||
|
||||
namespace ReportingServices.API.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class FabTimeController : ControllerBase
|
||||
{
|
||||
private readonly IFabTimeReportingRepository _fabTimeReportingRepository;
|
||||
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
|
||||
|
||||
public FabTimeController(IFabTimeReportingRepository fabTimeReportingRepository, IScrapeDatabaseRepository scrapeDBRepository)
|
||||
{
|
||||
_fabTimeReportingRepository = fabTimeReportingRepository;
|
||||
_scrapeDBRepository = scrapeDBRepository;
|
||||
}
|
||||
|
||||
[HttpGet("ReactorOuts")]
|
||||
public async Task<YieldInformation> GetReactorOuts(string startDate, string endDate)
|
||||
{
|
||||
List<ReactorOutsByRDS> outs = await _fabTimeReportingRepository.GetMovesTrendData(startDate, endDate);
|
||||
YieldInformation yieldInformation = new()
|
||||
{
|
||||
Outs = outs,
|
||||
Scrap = _scrapeDBRepository.GetScrapByDay(outs)
|
||||
};
|
||||
|
||||
return yieldInformation;
|
||||
}
|
||||
|
||||
[HttpGet("ToolStateTrend")]
|
||||
public async Task<List<EquipmentStateByDay>> GetToolStateTrendData(string toolType)
|
||||
{
|
||||
return await _fabTimeReportingRepository.GetToolStateTrendData(toolType);
|
||||
}
|
||||
|
||||
[HttpGet("ToolState")]
|
||||
public async Task<List<ToolStateCurrent>> GetToolStateData(string toolType)
|
||||
{
|
||||
return await _fabTimeReportingRepository.GetToolStateData(toolType);
|
||||
}
|
||||
}
|
||||
}
|
50
ReportingServicesAPIs/Controllers/ScrapeDBController.cs
Normal file
50
ReportingServicesAPIs/Controllers/ScrapeDBController.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ReportingServices.Shared.Models.PlanningReport;
|
||||
using ReportingServices.Shared.Models.ProductionReport;
|
||||
using ReportingServices.Shared.Repositories;
|
||||
|
||||
namespace ReportingServices.API.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ScrapeDBController : ControllerBase
|
||||
{
|
||||
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
|
||||
|
||||
public ScrapeDBController(IScrapeDatabaseRepository scrapeDBRepository)
|
||||
{
|
||||
_scrapeDBRepository = scrapeDBRepository;
|
||||
}
|
||||
|
||||
[HttpGet("PSNWO")]
|
||||
public List<ReactorPSNWORuns> GetReactorPSNWORuns(string startDate, string endDate)
|
||||
{
|
||||
return _scrapeDBRepository.GetReactorPSNWORuns(startDate, endDate);
|
||||
}
|
||||
|
||||
[HttpGet("PartChanges")]
|
||||
public int GetNumberOfPartChanges(string startDate, string endDate)
|
||||
{
|
||||
return _scrapeDBRepository.GetNumberOfPartChanges(startDate, endDate);
|
||||
}
|
||||
|
||||
[HttpGet("Targets")]
|
||||
public QuarterlyTargets GetQuarterlyTargets()
|
||||
{
|
||||
return _scrapeDBRepository.GetQuarterlyTargets();
|
||||
}
|
||||
|
||||
[HttpGet("Reactors")]
|
||||
public List<Reactor> GetReactors()
|
||||
{
|
||||
return _scrapeDBRepository.GetReactors();
|
||||
}
|
||||
|
||||
[HttpGet("RDS")]
|
||||
public List<RDS> GetRDSForLastDay()
|
||||
{
|
||||
return _scrapeDBRepository.GetRDSForLastDay();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ReportingServicesAPIs.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateTime.Now.AddDays(index),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user