using FastEndpoints; using FrameworkBLL.DiagnosticsSession; using GB5Shared.DTO.Framework.Login; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.FastEndPoint; using static FrameworkDAL.Constant.Constant; namespace FrameworkSL.Endpoints.DiagnosticsSession; public class CloseSession : BaseEndpoint> { private readonly IDiagnosticsSessionBLL _bll; public CloseSession(IDiagnosticsSessionBLL bll) => _bll = bll; public override void Configure() { Delete("/DiagnosticsSession/CloseSession"); AllowAnonymous(); } protected override async Task> ExecuteAsync( Parameters req, LoginDTO login, CancellationToken ct) { var result = await _bll.CloseSessionAsync(req.DiagnosticSessionId, login, ct).ConfigureAwait(false); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( result, CacheKeyLevel.NotRequired, login); } public record Parameters( [property: FromHeader] string Login, [property: QueryParam] int DiagnosticSessionId); }