1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
-
- 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<ApiDbService> _log;
- private readonly IApiAuthService _apiAuthService;
- private readonly IAipDbRepository _repo;
- public ApiDbService(ILogger<ApiDbService> log, IApiConfigService aipConfigService, IApiAuthService apiAuthService, IAipDbRepository repo)
- : base(aipConfigService)
- {
- _log = log;
- _apiAuthService = apiAuthService;
- _repo = repo;
- }
- public async Task<GeneralResponse> 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<List<LinkedSystemDto>> GetLinkedSystems()
- {
- try
- {
- var result = await _repo.GetLinkedSystems();
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<LinkedServerDto>> GetLinkedServers()
- {
- try
- {
- var result = await _repo.GetLinkedServers();
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<LinkedApiKeyDto>> GetLinkedApiKeys()
- {
- try
- {
- var result = await _repo.GetLinkedApiKeys();
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public async Task<List<LinkedDecryptKeyDto>> GetLinkedDecryptKeys()
- {
- try
- {
- var result = await _repo.GetLinkedDecryptKeys();
- return result;
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
|