mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-07 16:19:07 +00:00
Merge remote-tracking branch 'origin/codex/backend-layering-refactor' into codex/backend-governance-quality-system
This commit is contained in:
commit
7d471c9895
3 changed files with 19 additions and 10 deletions
|
|
@ -13,6 +13,7 @@ using System.Text;
|
|||
using SeaHaven.DataServices.DependencyInjection;
|
||||
using SeaHaven.Services.DependencyInjection;
|
||||
using SeaHaven.Services.Implementation;
|
||||
using SeaHaven.Services.Interfaces;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
ConfigurationManager configuration = builder.Configuration;
|
||||
|
|
@ -83,6 +84,8 @@ builder.Services.Configure<SyncOptions>(
|
|||
builder.Services.Configure<LegacyEndpointOptions>(
|
||||
builder.Configuration.GetSection(LegacyEndpointOptions.SectionName));
|
||||
builder.Services.AddSingleton<WorkOrderJobRunStateAccessor>();
|
||||
builder.Services.AddSingleton<IWorkOrderJobRunStateAccessor>(
|
||||
sp => sp.GetRequiredService<WorkOrderJobRunStateAccessor>());
|
||||
builder.Services.AddSingleton(sp => sp.GetRequiredService<WorkOrderJobRunStateAccessor>().State);
|
||||
builder.Services.AddScoped<Api.SeaHavenIndustries.Filters.IngestApiKeyFilter>();
|
||||
builder.Services.AddHostedService<WorkOrderWeekRolledHostedService>();
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ namespace SeaHaven.Services.Implementation
|
|||
public class WorkOrderOpsHealthService : IWorkOrderOpsHealthService
|
||||
{
|
||||
private readonly IWorkOrderOpsHealthDataService _healthData;
|
||||
private readonly WorkOrderJobRunStateAccessor _runState;
|
||||
private readonly IWorkOrderJobRunStateAccessor _runState;
|
||||
private readonly WorkOrderOpsHealthOptions _options;
|
||||
|
||||
public WorkOrderOpsHealthService(
|
||||
IWorkOrderOpsHealthDataService healthData,
|
||||
WorkOrderJobRunStateAccessor runState,
|
||||
IWorkOrderJobRunStateAccessor runState,
|
||||
IOptions<WorkOrderOpsHealthOptions> options)
|
||||
{
|
||||
_healthData = healthData;
|
||||
|
|
@ -58,16 +58,9 @@ namespace SeaHaven.Services.Implementation
|
|||
}
|
||||
|
||||
/// <summary>Shared in-memory job run timestamps (API hosted services + ops health).</summary>
|
||||
public class WorkOrderJobRunStateAccessor
|
||||
public class WorkOrderJobRunStateAccessor : IWorkOrderJobRunStateAccessor
|
||||
{
|
||||
public WorkOrderJobRunState State { get; } = new();
|
||||
}
|
||||
|
||||
public class WorkOrderJobRunState
|
||||
{
|
||||
public DateTime? LastWeekRolledRunUtc { get; set; }
|
||||
public DateTime? LastPastDueCacheRunUtc { get; set; }
|
||||
public string? LastWeekRolledError { get; set; }
|
||||
public string? LastPastDueCacheError { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,19 @@ using Microsoft.AspNetCore.Http;
|
|||
|
||||
namespace SeaHaven.Services.Interfaces
|
||||
{
|
||||
public interface IWorkOrderJobRunStateAccessor
|
||||
{
|
||||
WorkOrderJobRunState State { get; }
|
||||
}
|
||||
|
||||
public sealed class WorkOrderJobRunState
|
||||
{
|
||||
public DateTime? LastWeekRolledRunUtc { get; set; }
|
||||
public DateTime? LastPastDueCacheRunUtc { get; set; }
|
||||
public string? LastWeekRolledError { get; set; }
|
||||
public string? LastPastDueCacheError { get; set; }
|
||||
}
|
||||
|
||||
public interface IFileStoragePort
|
||||
{
|
||||
Task<string> SaveFileAsync(IFormFile file);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue