Ran formatting through code
This commit is contained in:
@ -2,92 +2,57 @@
|
||||
using ReportingServices.Shared.Models.PlanningReport;
|
||||
using ReportingServices.Shared.Models.ProductionReport;
|
||||
using ReportingServices.Shared.Repositories;
|
||||
using ReportingServices.Shared.ViewModels.ProductionReport;
|
||||
|
||||
namespace ReportingServices.API.Controllers
|
||||
namespace ReportingServices.API.Controllers;
|
||||
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ScrapeDBController : ControllerBase
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ScrapeDBController : ControllerBase
|
||||
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
|
||||
|
||||
public ScrapeDBController(IScrapeDatabaseRepository scrapeDBRepository) => _scrapeDBRepository = scrapeDBRepository;
|
||||
|
||||
[HttpGet("ReactorOuts")]
|
||||
public YieldInformation GetReactorOuts(string startDate, string endDate)
|
||||
{
|
||||
private readonly IScrapeDatabaseRepository _scrapeDBRepository;
|
||||
|
||||
public ScrapeDBController(IScrapeDatabaseRepository scrapeDBRepository)
|
||||
List<ReactorOutsByRDS> outs = _scrapeDBRepository.GetRDSRunBetweenDates(startDate, endDate);
|
||||
YieldInformation yieldInformation = new()
|
||||
{
|
||||
_scrapeDBRepository = scrapeDBRepository;
|
||||
}
|
||||
Outs = outs,
|
||||
Scrap = _scrapeDBRepository.GetScrapByDay(outs)
|
||||
};
|
||||
|
||||
[HttpGet("ReactorOuts")]
|
||||
public YieldInformation GetReactorOuts(string startDate, string endDate)
|
||||
{
|
||||
List<ReactorOutsByRDS> outs = _scrapeDBRepository.GetRDSRunBetweenDates(startDate, endDate);
|
||||
YieldInformation yieldInformation = new()
|
||||
{
|
||||
Outs = outs,
|
||||
Scrap = _scrapeDBRepository.GetScrapByDay(outs)
|
||||
};
|
||||
|
||||
return yieldInformation;
|
||||
}
|
||||
|
||||
[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(string date)
|
||||
{
|
||||
return _scrapeDBRepository.GetRDSForLastDay(date);
|
||||
}
|
||||
|
||||
[HttpGet("ReactorEvents")]
|
||||
public List<ReactorEvent> GetReactorEvents(string startDate, string endDate, string reactorNumber)
|
||||
{
|
||||
return _scrapeDBRepository.GetReactorEvents(startDate, endDate, reactorNumber);
|
||||
}
|
||||
|
||||
[HttpGet("GetLastUpTransaction")]
|
||||
public int GetLastUpTransaction(string reactorNumber)
|
||||
{
|
||||
return _scrapeDBRepository.GetLastUpTransaction(reactorNumber);
|
||||
}
|
||||
|
||||
[HttpGet("ToolEvents")]
|
||||
public ToolEvent GetLatestToolEvent(string toolID)
|
||||
{
|
||||
return _scrapeDBRepository.GetLatestToolEvent(toolID);
|
||||
}
|
||||
|
||||
[HttpGet("GetOutsAndScrapTotals")]
|
||||
public OutsAndScrapTotal GetOutsAndScrapTotal(string startDate, string endDate)
|
||||
{
|
||||
return _scrapeDBRepository.GetOutsAndScrapTotals(startDate, endDate);
|
||||
}
|
||||
|
||||
[HttpGet("GetQuarterStartDate")]
|
||||
public DateTime GetQuarterStartDate()
|
||||
{
|
||||
return _scrapeDBRepository.GetQuarterStartDate();
|
||||
}
|
||||
return yieldInformation;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("PSNWO")]
|
||||
public List<ReactorPSNWORuns> GetReactorPSNWORuns(string startDate, string endDate) => _scrapeDBRepository.GetReactorPSNWORuns(startDate, endDate);
|
||||
|
||||
[HttpGet("PartChanges")]
|
||||
public int GetNumberOfPartChanges(string startDate, string endDate) => _scrapeDBRepository.GetNumberOfPartChanges(startDate, endDate);
|
||||
|
||||
[HttpGet("Targets")]
|
||||
public QuarterlyTargets GetQuarterlyTargets() => _scrapeDBRepository.GetQuarterlyTargets();
|
||||
|
||||
[HttpGet("Reactors")]
|
||||
public List<Reactor> GetReactors() => _scrapeDBRepository.GetReactors();
|
||||
|
||||
[HttpGet("RDS")]
|
||||
public List<RDS> GetRDSForLastDay(string date) => _scrapeDBRepository.GetRDSForLastDay(date);
|
||||
|
||||
[HttpGet("ReactorEvents")]
|
||||
public List<ReactorEvent> GetReactorEvents(string startDate, string endDate, string reactorNumber) => _scrapeDBRepository.GetReactorEvents(startDate, endDate, reactorNumber);
|
||||
|
||||
[HttpGet("GetLastUpTransaction")]
|
||||
public int GetLastUpTransaction(string reactorNumber) => _scrapeDBRepository.GetLastUpTransaction(reactorNumber);
|
||||
|
||||
[HttpGet("ToolEvents")]
|
||||
public ToolEvent GetLatestToolEvent(string toolID) => _scrapeDBRepository.GetLatestToolEvent(toolID);
|
||||
|
||||
[HttpGet("GetOutsAndScrapTotals")]
|
||||
public OutsAndScrapTotal GetOutsAndScrapTotal(string startDate, string endDate) => _scrapeDBRepository.GetOutsAndScrapTotals(startDate, endDate);
|
||||
|
||||
[HttpGet("GetQuarterStartDate")]
|
||||
public DateTime GetQuarterStartDate() => _scrapeDBRepository.GetQuarterStartDate();
|
||||
}
|
@ -1,47 +1,53 @@
|
||||
using ReportingServices.Shared.Repositories;
|
||||
using Serilog;
|
||||
|
||||
LoggerConfiguration loggerConfiguration = new();
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
Environment.SetEnvironmentVariable("workingDirectory", "D:\\tmp\\logging\\MesaReportingServices\\API");
|
||||
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, builder.Configuration);
|
||||
_ = SerilogHostBuilderExtensions.UseSerilog(builder.Host);
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
Serilog.ILogger log = Log.ForContext<Program>();
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.AddScoped<IScrapeDatabaseRepository, ScrapeDatabaseRepository>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
internal class Program
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
LoggerConfiguration loggerConfiguration = new();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
Environment.SetEnvironmentVariable("workingDirectory", "D:\\tmp\\logging\\MesaReportingServices\\API");
|
||||
_ = loggerConfiguration.ReadFrom.Configuration(builder.Configuration);
|
||||
_ = builder.Host.UseSerilog();
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
Serilog.ILogger log = Log.ForContext<Program>();
|
||||
// Add services to the container.
|
||||
_ = builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
_ = builder.Services.AddEndpointsApiExplorer();
|
||||
_ = builder.Services.AddSwaggerGen();
|
||||
_ = builder.Services.AddScoped<IScrapeDatabaseRepository, ScrapeDatabaseRepository>();
|
||||
|
||||
app.UseAuthorization();
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
app.MapControllers();
|
||||
_ = app.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
|
||||
log.Information("Starting Web APIs");
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
_ = app.UseSwagger();
|
||||
_ = app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
app.Run();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Fatal(ex, "Host terminated unexpectedly");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
_ = app.UseHttpsRedirection();
|
||||
|
||||
_ = app.UseAuthorization();
|
||||
|
||||
_ = app.MapControllers();
|
||||
_ = app.Lifetime.ApplicationStopped.Register(Log.CloseAndFlush);
|
||||
log.Information("Starting Web APIs");
|
||||
|
||||
try
|
||||
{
|
||||
app.Run();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.Fatal(ex, "Host terminated unexpectedly");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user