44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
using LCU.API.Internal.Operations.IncentiveApi.DataAccess;
|
|
using LCU.Library.Internal.Exceptions;
|
|
using LCU.Library.Internal.FileOperationsModels.Models;
|
|
|
|
namespace LCU.API.Internal.Operations.IncentiveApi.Services.MicroApiServices;
|
|
|
|
public class FileOperationsApiService : IFileOperationsApiService
|
|
{
|
|
private readonly IFileOperationsApiDao _fileOperationDao;
|
|
|
|
public FileOperationsApiService(IFileOperationsApiDao fileOperationDao)
|
|
{
|
|
_fileOperationDao = fileOperationDao;
|
|
}
|
|
|
|
public async Task<string[]> BuildDynamicFileList(DynamicFileListRequest dynamicFileRequest)
|
|
{
|
|
try
|
|
{
|
|
return await _fileOperationDao.BuildDynamicFileList(dynamicFileRequest);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
var message = $"Error to BuildDynamicFileList. FilePath: {dynamicFileRequest.Path}.";
|
|
Log.Error(exception, message);
|
|
throw new ServiceException($"{message} Exception Message:{exception.Message}");
|
|
}
|
|
}
|
|
|
|
public async Task<string> GetFileContent(string filePath)
|
|
{
|
|
try
|
|
{
|
|
return await _fileOperationDao.GetFileContent(filePath);
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
var message = $"Failure to GetFileContent. FilePath: {filePath}.";
|
|
Log.Error(exception, message);
|
|
throw new ServiceException($"{message} Exception Message: {exception.Message}");
|
|
}
|
|
}
|
|
}
|