Files
IM_NEW/FileService.Application/UploadFile/UploadFileService.cs
T
2026-05-09 17:06:30 +08:00

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));
}
}
}