แก้ api เพิ่มเติมการ upload image and document
This commit is contained in:
parent
86ec5de116
commit
6acd497afe
23 changed files with 4081 additions and 53 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -185,6 +186,33 @@ namespace BMA.EHR.Recruit.Service.Services
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<string> GetFilePath(Guid fileId)
|
||||
{
|
||||
|
||||
var doc = await _context.Documents.AsQueryable()
|
||||
.FirstOrDefaultAsync(x => x.Id == fileId);
|
||||
|
||||
if (doc == null)
|
||||
throw new Exception(GlobalMessages.FileNotFoundOnServer);
|
||||
|
||||
//var config = new AmazonS3Config
|
||||
//{
|
||||
// ServiceURL = Configuration.GetValue<string>("MinIO:Endpoint"),
|
||||
// ForcePathStyle = true
|
||||
//};
|
||||
|
||||
DateTime expires = DateTime.UtcNow.AddHours(6);
|
||||
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest
|
||||
{
|
||||
BucketName = _bucketName,
|
||||
Key = doc?.ObjectRefId.ToString("D"),
|
||||
Expires = expires,
|
||||
};
|
||||
string path = _s3Client.GetPreSignedURL(request);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue