fix(scheduler): add [FromServices] to Doctor trend endpoint parameters
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) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Net.Http.Json;
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
@@ -219,8 +220,8 @@ public sealed class DoctorJobPlugin : ISchedulerJobPlugin
|
|||||||
DateTimeOffset? from,
|
DateTimeOffset? from,
|
||||||
DateTimeOffset? to,
|
DateTimeOffset? to,
|
||||||
HttpContext httpContext,
|
HttpContext httpContext,
|
||||||
IDoctorTrendRepository? trendRepository,
|
[FromServices] IDoctorTrendRepository? trendRepository,
|
||||||
TimeProvider timeProvider) =>
|
[FromServices] TimeProvider timeProvider) =>
|
||||||
{
|
{
|
||||||
if (trendRepository is null)
|
if (trendRepository is null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using StellaOps.Scheduler.Plugin.Doctor.Services;
|
using StellaOps.Scheduler.Plugin.Doctor.Services;
|
||||||
|
|
||||||
@@ -20,8 +21,8 @@ public static class DoctorTrendEndpoints
|
|||||||
group.MapGet("/", async (
|
group.MapGet("/", async (
|
||||||
DateTimeOffset? from,
|
DateTimeOffset? from,
|
||||||
DateTimeOffset? to,
|
DateTimeOffset? to,
|
||||||
IDoctorTrendRepository repository,
|
[FromServices] IDoctorTrendRepository repository,
|
||||||
TimeProvider timeProvider,
|
[FromServices] TimeProvider timeProvider,
|
||||||
HttpContext httpContext,
|
HttpContext httpContext,
|
||||||
CancellationToken ct) =>
|
CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
@@ -46,8 +47,8 @@ public static class DoctorTrendEndpoints
|
|||||||
string checkId,
|
string checkId,
|
||||||
DateTimeOffset? from,
|
DateTimeOffset? from,
|
||||||
DateTimeOffset? to,
|
DateTimeOffset? to,
|
||||||
IDoctorTrendRepository repository,
|
[FromServices] IDoctorTrendRepository repository,
|
||||||
TimeProvider timeProvider,
|
[FromServices] TimeProvider timeProvider,
|
||||||
HttpContext httpContext,
|
HttpContext httpContext,
|
||||||
CancellationToken ct) =>
|
CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
@@ -79,8 +80,8 @@ public static class DoctorTrendEndpoints
|
|||||||
string category,
|
string category,
|
||||||
DateTimeOffset? from,
|
DateTimeOffset? from,
|
||||||
DateTimeOffset? to,
|
DateTimeOffset? to,
|
||||||
IDoctorTrendRepository repository,
|
[FromServices] IDoctorTrendRepository repository,
|
||||||
TimeProvider timeProvider,
|
[FromServices] TimeProvider timeProvider,
|
||||||
HttpContext httpContext,
|
HttpContext httpContext,
|
||||||
CancellationToken ct) =>
|
CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
@@ -111,8 +112,8 @@ public static class DoctorTrendEndpoints
|
|||||||
DateTimeOffset? from,
|
DateTimeOffset? from,
|
||||||
DateTimeOffset? to,
|
DateTimeOffset? to,
|
||||||
double? threshold,
|
double? threshold,
|
||||||
IDoctorTrendRepository repository,
|
[FromServices] IDoctorTrendRepository repository,
|
||||||
TimeProvider timeProvider,
|
[FromServices] TimeProvider timeProvider,
|
||||||
HttpContext httpContext,
|
HttpContext httpContext,
|
||||||
CancellationToken ct) =>
|
CancellationToken ct) =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user