diff --git a/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs b/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs
index 86462ea..36ede35 100644
--- a/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs
+++ b/DD.Persistence.Client/Clients/Interfaces/ISetpointClient.cs
@@ -24,12 +24,21 @@ public interface ISetpointClient : IDisposable
///
Task> GetCurrent(IEnumerable setpointKeys, CancellationToken token);
- ///
- /// Получить диапазон дат, для которых есть данные в репозитории
- ///
- ///
- ///
- Task GetDatesRangeAsync(CancellationToken token);
+ ///
+ /// Получить актуальные значения уставок
+ ///
+ ///
+ ///
+ ///
+ Task> GetCurrentDictionary(Dictionary setpointConfigs, CancellationToken token);
+
+
+ ///
+ /// Получить диапазон дат, для которых есть данные в репозитории
+ ///
+ ///
+ ///
+ Task GetDatesRangeAsync(CancellationToken token);
///
/// Получить значения уставок за определенный момент времени
diff --git a/DD.Persistence.Client/Clients/SetpointClient.cs b/DD.Persistence.Client/Clients/SetpointClient.cs
index 808f0b9..b9c472a 100644
--- a/DD.Persistence.Client/Clients/SetpointClient.cs
+++ b/DD.Persistence.Client/Clients/SetpointClient.cs
@@ -3,6 +3,7 @@ using DD.Persistence.Client.Clients.Base;
using DD.Persistence.Client.Clients.Interfaces;
using DD.Persistence.Client.Clients.Interfaces.Refit;
using DD.Persistence.Models;
+using System.Text.Json;
namespace DD.Persistence.Client.Clients;
@@ -23,7 +24,35 @@ public class SetpointClient : BaseClient, ISetpointClient
return result!;
}
- public async Task> GetHistory(IEnumerable setpointKeys, DateTimeOffset historyMoment, CancellationToken token)
+ public async Task> GetCurrentDictionary(Dictionary setpointConfigs, CancellationToken token)
+ {
+ var data = await GetCurrent(setpointConfigs.Keys, token);
+ var dict = DeserializeResultToDict(setpointConfigs, data);
+
+ return dict;
+ }
+
+ private static Dictionary DeserializeResultToDict(Dictionary setpointConfigs, IEnumerable data)
+ {
+ var dict = new Dictionary();
+
+ foreach (var valueDto in data)
+ {
+
+ if (valueDto.Value is not null &&
+ valueDto.Value is JsonElement element &&
+ setpointConfigs.TryGetValue(valueDto.Key, out var type) &&
+ type is not null)
+
+ dict[valueDto.Key] = element.Deserialize(type!) ?? valueDto.Value;
+ else
+ dict[valueDto.Key] = valueDto.Value;
+ }
+
+ return dict;
+ }
+
+ public async Task> GetHistory(IEnumerable setpointKeys, DateTimeOffset historyMoment, CancellationToken token)
{
var result = await ExecuteGetResponse(
async () => await refitSetpointClient.GetHistory(setpointKeys, historyMoment, token), token);
@@ -67,4 +96,6 @@ public class SetpointClient : BaseClient, ISetpointClient
GC.SuppressFinalize(this);
}
+
+
}