Need to populate GetAwaitingDispositionApi.json
This commit is contained in:
1
Server/Data/Tests/GetAwaitingDispositionApi.json
Normal file
1
Server/Data/Tests/GetAwaitingDispositionApi.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
@ -67,7 +67,16 @@
|
||||
<None Include="Data\Tests\GetAllServiceShopOrdersApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetToolTypeMetadataApi.json">
|
||||
<None Include="Data\Tests\GetAppSettingsApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetAwaitingDispositionApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetBuildNumberAndGitCommitSevenApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetClientSettingsApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetDataApi.json">
|
||||
@ -82,20 +91,14 @@
|
||||
<None Include="Data\Tests\GetHeaderTitlesApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetAppSettingsApi.json">
|
||||
<None Include="Data\Tests\GetIpAddressApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetToolTypeMetadataApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\IndexApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetClientSettingsApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetBuildNumberAndGitCommitSevenApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Data\Tests\GetIpAddressApi.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -58,21 +58,19 @@ public class Program
|
||||
{
|
||||
_ = webApplicationBuilder.Services.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
|
||||
_ = webApplicationBuilder.Services.AddControllersWithViews();
|
||||
#pragma warning disable CS8600, CS8602, CS8603, CS8604, CS8625
|
||||
_ = new MetrologyRepository(new SQLDbConnectionFactory(appSettings), null);
|
||||
#pragma warning restore
|
||||
_ = webApplicationBuilder.Services.AddDistributedMemoryCache();
|
||||
_ = webApplicationBuilder.Services.AddMemoryCache();
|
||||
|
||||
AppSettingsRepository appSettingsRepository = new(appSettings);
|
||||
SQLDbConnectionFactory sqlDbConnectionFactory = new(appSettings);
|
||||
ClientSettingsRepository clientSettingsRepository = new(appSettings);
|
||||
|
||||
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IInboundRepository, InboundRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IAppSettingsRepository>(_ => appSettingsRepository);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IClientSettingsRepository>(_ => clientSettingsRepository);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IServiceShopOrderRepository, ServiceShopOrderRepository>();
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IDbConnectionFactory, SQLDbConnectionFactory>(_ => sqlDbConnectionFactory);
|
||||
_ = webApplicationBuilder.Services.AddSingleton<IToolTypesRepository, ToolTypesRepository>(_ => new(appSettings.MockRoot));
|
||||
|
||||
_ = webApplicationBuilder.Services.AddScoped<IAttachmentsService, AttachmentsService>();
|
||||
|
@ -1,6 +1,7 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OI.Metrology.Server.Models;
|
||||
using OI.Metrology.Shared.DataModels;
|
||||
using OI.Metrology.Shared.Models.Stateless;
|
||||
using OI.Metrology.Shared.Repositories;
|
||||
@ -14,12 +15,14 @@ namespace OI.Metrology.Server.Repositories;
|
||||
|
||||
public class MetrologyRepository : IMetrologyRepository
|
||||
{
|
||||
private readonly string _MockRoot;
|
||||
private readonly IMemoryCache _Cache;
|
||||
private readonly IDbConnectionFactory _DBConnectionFactory;
|
||||
|
||||
public MetrologyRepository(IDbConnectionFactory dbConnectionFactory, IMemoryCache memoryCache)
|
||||
public MetrologyRepository(AppSettings appSettings, IDbConnectionFactory dbConnectionFactory, IMemoryCache memoryCache)
|
||||
{
|
||||
_Cache = memoryCache;
|
||||
_MockRoot = appSettings.MockRoot;
|
||||
_DBConnectionFactory = dbConnectionFactory;
|
||||
}
|
||||
|
||||
@ -693,8 +696,20 @@ public class MetrologyRepository : IMetrologyRepository
|
||||
|
||||
public IEnumerable<AwaitingDisposition> GetAwaitingDisposition()
|
||||
{
|
||||
using DbConnection conn = GetDbConnection();
|
||||
return conn.Query<AwaitingDisposition>("GetAwaitingDispo", commandType: CommandType.StoredProcedure);
|
||||
IEnumerable<AwaitingDisposition>? r;
|
||||
if (!string.IsNullOrEmpty(_MockRoot))
|
||||
{
|
||||
string json = File.ReadAllText(Path.Combine(string.Concat(AppContext.BaseDirectory, _MockRoot), "GetAwaitingDispositionApi.json"));
|
||||
r = System.Text.Json.JsonSerializer.Deserialize<IEnumerable<AwaitingDisposition>>(json);
|
||||
if (r is null)
|
||||
throw new NullReferenceException(nameof(r));
|
||||
}
|
||||
else
|
||||
{
|
||||
using DbConnection conn = GetDbConnection();
|
||||
r = conn.Query<AwaitingDisposition>("GetAwaitingDispo", commandType: CommandType.StoredProcedure);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public int UpdateReviewDate(int toolTypeId, long headerId, bool clearDate)
|
||||
|
Reference in New Issue
Block a user