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