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:
37
ReportingServices.APIs/Controllers/FabTimeController.cs
Normal file
37
ReportingServices.APIs/Controllers/FabTimeController.cs
Normal file
@ -0,0 +1,37 @@
|
||||
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;
|
||||
|
||||
public FabTimeController(IFabTimeReportingRepository fabTimeReportingRepository)
|
||||
{
|
||||
_fabTimeReportingRepository = fabTimeReportingRepository;
|
||||
}
|
||||
|
||||
[HttpGet("ReactorOuts")]
|
||||
public async Task<List<ReactorOutsByRDS>> GetReactorOuts(string startDate, string endDate)
|
||||
{
|
||||
return await _fabTimeReportingRepository.GetMovesTrendData(startDate, endDate);
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
58
ReportingServices.APIs/Controllers/ScrapeDBController.cs
Normal file
58
ReportingServices.APIs/Controllers/ScrapeDBController.cs
Normal file
@ -0,0 +1,58 @@
|
||||
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("Scrap")]
|
||||
public List<ScrapByDay> GetScrapByDay(List<ReactorOutsByRDS> outs)
|
||||
{
|
||||
return _scrapeDBRepository.GetScrapByDay(outs);
|
||||
}
|
||||
|
||||
[HttpGet("PSNWO")]
|
||||
public List<ReactorPSNWORuns> GetReactorPSNWORuns(string startDate, string endDate)
|
||||
{
|
||||
var path = Environment.CurrentDirectory;
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
29
ReportingServices.APIs/Program.cs
Normal file
29
ReportingServices.APIs/Program.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using ReportingServices.Shared.Repositories;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// 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<IFabTimeReportingRepository, FabTimeReportingRepository>();
|
||||
builder.Services.AddScoped<IScrapeDatabaseRepository, ScrapeDatabaseRepository>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
31
ReportingServices.APIs/Properties/launchSettings.json
Normal file
31
ReportingServices.APIs/Properties/launchSettings.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:43372",
|
||||
"sslPort": 44364
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"ReportingServicesAPIs": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7196;http://localhost:5196",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
17
ReportingServices.APIs/ReportingServices.API.csproj
Normal file
17
ReportingServices.APIs/ReportingServices.API.csproj
Normal file
@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>disable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReportingServices.Shared\ReportingServices.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
8
ReportingServices.APIs/appsettings.Development.json
Normal file
8
ReportingServices.APIs/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
ReportingServices.APIs/appsettings.json
Normal file
9
ReportingServices.APIs/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Reference in New Issue
Block a user