using Aip.Service.Models.Dto; using Aip.Service.Models.Response; using Aip.Service.Repositories; using Aip.Service.Services.Interfaces; namespace Aip.Service.Services; public class ApiDbService : BaseService, IApiDbService { private readonly ILogger _log; private readonly IApiAuthService _apiAuthService; private readonly IAipDbRepository _repo; public ApiDbService(ILogger log, IApiConfigService aipConfigService, IApiAuthService apiAuthService, IAipDbRepository repo) : base(aipConfigService) { _log = log; _apiAuthService = apiAuthService; _repo = repo; } public async Task ReloadDatabase() { try { var task = Task.Run(() => { int result = _apiAuthService.LoadAuthInformation(); return result; }); int result = await task; return new GeneralResponse { errorCode = 0, errorMessage = GlobalConstants.API_RESULT_SUCCESS, effectCount = result, }; } catch (Exception) { throw; } } public async Task> GetLinkedSystems() { try { var result = await _repo.GetLinkedSystems(); return result; } catch (Exception) { throw; } } public async Task> GetLinkedServers() { try { var result = await _repo.GetLinkedServers(); return result; } catch (Exception) { throw; } } public async Task> GetLinkedApiKeys() { try { var result = await _repo.GetLinkedApiKeys(); return result; } catch (Exception) { throw; } } public async Task> GetLinkedDecryptKeys() { try { var result = await _repo.GetLinkedDecryptKeys(); return result; } catch (Exception) { throw; } } }