30 lines
797 B
C#
30 lines
797 B
C#
using AutoMapper;
|
|
using FileService.Domain.IReposities;
|
|
using IM.Commons;
|
|
|
|
namespace FileService.Application.UploadFile
|
|
{
|
|
public class UploadFileService
|
|
{
|
|
private readonly IUploadFileReposity reposity;
|
|
private readonly IMapper mapper;
|
|
|
|
public UploadFileService(IUploadFileReposity reposity, IMapper mapper)
|
|
{
|
|
this.reposity = reposity;
|
|
this.mapper = mapper;
|
|
}
|
|
|
|
public async Task<Result<FileResponse>> GetFileInfoAsync(Guid id)
|
|
{
|
|
var file = await reposity.FindByIdAsync(id);
|
|
if (file == null)
|
|
{
|
|
return Result.Fail<FileResponse>(ResultCode.FILE_NOT_FOUND);
|
|
}
|
|
|
|
return Result.Success(mapper.Map<FileResponse>(file));
|
|
}
|
|
}
|
|
}
|