123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using AipGateway.API.Application;
- using AipGateway.API.Application.Interfaces.Services;
- using AipGateway.API.Domain.Exceptions;
- using AipGateway.API.Domain.IRepositories.IGenericRepositories;
- using AipGateway.API.Domain.Models.Dto;
- using AipGateway.API.Domain.Models.Response;
- using AipGateway.API.Repositories;
- using AipGateway.API.Services.Interfaces;
- using AutoMapper;
- namespace AipGateway.API.Services
- {
- public class ApiDbService : BaseService, IApiDbService
- {
- private readonly ILogger<ApiDbService> _log;
- private readonly IApiAuthService _apiAuthService;
- private readonly IAipDbRepository _repo;
- public ApiDbService(ILogger<ApiDbService> log, IAipFileService aipFileService, IApiAuthService apiAuthService, IAipDbRepository repo)
- : base(aipFileService)
- {
- _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;
- }
- }
- }
- }
|