using FastEndpoints;using Kbx.Shared.Experiments;using Kbx.Shared.Runtime;
namespace Kbx.Modules.Common.Experiments.Rollout;
public sealed record Request(string ExperimentId,int RolloutPercent,string State,string Reason);
public sealed class Endpoint(KbxExperimentRuntimeStore store):Endpoint<Request>{public override void Configure(){Post("/api/kbx/experiments/{experimentId}/rollout");Permissions("common.experiment.manage");}public override async Task HandleAsync(Request req,CancellationToken ct){await store.UpdateRolloutAsync(RuntimeIdentity.TenantId(User),RuntimeIdentity.UserId(User),req.ExperimentId,req.RolloutPercent,req.State,req.Reason,HttpContext.TraceIdentifier,ct);await Send.OkAsync(ct);}}
