添加项目文件。
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user