using GB5Shared.DTO.Framework.Login; using GB5Shared.Telemetry; using Microsoft.Extensions.Logging; using OKRBLL.Interfaces; using OKRDAL.Interfaces; using System.Text.Json; namespace OKRBLL.Implementations; public class GoalTrackBLL : IGoalTrackBLL { private readonly IGoalTrackDAL _dal; private readonly ILogger _logger; public GoalTrackBLL(IGoalTrackDAL dal, ILogger logger) { _dal = dal; _logger = logger; } public async Task GetGoalTrackHistoryAsync(int goalId, LoginDTO login, CancellationToken ct) { try { GB5Trace.Step("get-goaltrack-history", new { goalId }); var history = await _dal.GetTrackHistoryAsync(goalId, login, ct).ConfigureAwait(false); return JsonSerializer.Serialize(history); } catch (Exception ex) { GB5Trace.MarkFailed("get-goaltrack-history-failed", ex); _logger.LogError(ex, "GetGoalTrackHistory failed for GoalId {GoalId}", goalId); throw; } } }