From fcdc4e0291120477a882fec38e49edfeb68f906d Mon Sep 17 00:00:00 2001 From: master <> Date: Fri, 10 Apr 2026 11:32:38 +0300 Subject: [PATCH] fix(scheduler): add [FromServices] to Doctor trend endpoint parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DoctorTrendEndpoints used IDoctorTrendRepository and TimeProvider as MapGet handler parameters without [FromServices], causing ASP.NET to infer them as body parameters — crashing the scheduler on startup with "Body was inferred but the method does not allow inferred body parameters." Co-Authored-By: Claude Opus 4.6 (1M context) --- .../DoctorJobPlugin.cs | 5 +++-- .../Endpoints/DoctorTrendEndpoints.cs | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/JobEngine/StellaOps.Scheduler.__Libraries/StellaOps.Scheduler.Plugin.Doctor/DoctorJobPlugin.cs b/src/JobEngine/StellaOps.Scheduler.__Libraries/StellaOps.Scheduler.Plugin.Doctor/DoctorJobPlugin.cs index 2d6839b5b..0feec2109 100644 --- a/src/JobEngine/StellaOps.Scheduler.__Libraries/StellaOps.Scheduler.Plugin.Doctor/DoctorJobPlugin.cs +++ b/src/JobEngine/StellaOps.Scheduler.__Libraries/StellaOps.Scheduler.Plugin.Doctor/DoctorJobPlugin.cs @@ -3,6 +3,7 @@ using System.Net.Http.Json; using System.Text.Json; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -219,8 +220,8 @@ public sealed class DoctorJobPlugin : ISchedulerJobPlugin DateTimeOffset? from, DateTimeOffset? to, HttpContext httpContext, - IDoctorTrendRepository? trendRepository, - TimeProvider timeProvider) => + [FromServices] IDoctorTrendRepository? trendRepository, + [FromServices] TimeProvider timeProvider) => { if (trendRepository is null) { diff --git a/src/JobEngine/StellaOps.Scheduler.plugins/StellaOps.Scheduler.Plugin.Doctor/Endpoints/DoctorTrendEndpoints.cs b/src/JobEngine/StellaOps.Scheduler.plugins/StellaOps.Scheduler.Plugin.Doctor/Endpoints/DoctorTrendEndpoints.cs index 7c05366db..52c47c092 100644 --- a/src/JobEngine/StellaOps.Scheduler.plugins/StellaOps.Scheduler.Plugin.Doctor/Endpoints/DoctorTrendEndpoints.cs +++ b/src/JobEngine/StellaOps.Scheduler.plugins/StellaOps.Scheduler.Plugin.Doctor/Endpoints/DoctorTrendEndpoints.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Routing; using StellaOps.Scheduler.Plugin.Doctor.Services; @@ -20,8 +21,8 @@ public static class DoctorTrendEndpoints group.MapGet("/", async ( DateTimeOffset? from, DateTimeOffset? to, - IDoctorTrendRepository repository, - TimeProvider timeProvider, + [FromServices] IDoctorTrendRepository repository, + [FromServices] TimeProvider timeProvider, HttpContext httpContext, CancellationToken ct) => { @@ -46,8 +47,8 @@ public static class DoctorTrendEndpoints string checkId, DateTimeOffset? from, DateTimeOffset? to, - IDoctorTrendRepository repository, - TimeProvider timeProvider, + [FromServices] IDoctorTrendRepository repository, + [FromServices] TimeProvider timeProvider, HttpContext httpContext, CancellationToken ct) => { @@ -79,8 +80,8 @@ public static class DoctorTrendEndpoints string category, DateTimeOffset? from, DateTimeOffset? to, - IDoctorTrendRepository repository, - TimeProvider timeProvider, + [FromServices] IDoctorTrendRepository repository, + [FromServices] TimeProvider timeProvider, HttpContext httpContext, CancellationToken ct) => { @@ -111,8 +112,8 @@ public static class DoctorTrendEndpoints DateTimeOffset? from, DateTimeOffset? to, double? threshold, - IDoctorTrendRepository repository, - TimeProvider timeProvider, + [FromServices] IDoctorTrendRepository repository, + [FromServices] TimeProvider timeProvider, HttpContext httpContext, CancellationToken ct) => {