fix upload attatchment
This commit is contained in:
parent
aff4dcd38d
commit
68c9ed1ad9
3 changed files with 68 additions and 18 deletions
|
|
@ -601,7 +601,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> SaveCommandSelectReceiverAsync(Guid orderId,[FromBody] List<Guid> selected)
|
||||
public async Task<ActionResult<ResponseObject>> SaveCommandSelectReceiverAsync(Guid orderId, [FromBody] List<Guid> selected)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -853,8 +853,8 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
orderNo = command.CommandNo,
|
||||
orderYear = command.CommandYear,
|
||||
signDate = command.CommandExcecuteDate,
|
||||
orderFileUrl = cover == null ? null : _documentService.ImagesPath(cover.Document.ObjectRefId),
|
||||
attachmentFileUrl = attach == null ? null : _documentService.ImagesPath(attach.Document.ObjectRefId),
|
||||
orderFileUrl = cover == null ? null : await _documentService.ImagesPath(cover.Document.Id),
|
||||
attachmentFileUrl = attach == null ? null : await _documentService.ImagesPath(attach.Document.Id),
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
|
|
@ -875,6 +875,16 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("attachment/order-file/{orderId}"), DisableRequestSizeLimit]
|
||||
[Consumes("multipart/form-data")]
|
||||
[SwaggerOperation(
|
||||
Summary = "Upload a file",
|
||||
Description = "Upload a file using multipart/form-data",
|
||||
OperationId = "UploadCommandCoverAsync"
|
||||
//Tags = new[] { "File" }
|
||||
)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UploadCommandCoverAsync(Guid orderId)
|
||||
{
|
||||
try
|
||||
|
|
@ -893,7 +903,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
// delete exist document from s3
|
||||
foreach (var doc in docs)
|
||||
{
|
||||
await _documentService.DeleteFileAsync(doc.Document.ObjectRefId);
|
||||
await _documentService.DeleteFileAsync(doc.Document.Id);
|
||||
}
|
||||
|
||||
// upload new document to s3
|
||||
|
|
@ -926,6 +936,16 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("attachment/file/{orderId}"), DisableRequestSizeLimit]
|
||||
[Consumes("multipart/form-data")]
|
||||
[SwaggerOperation(
|
||||
Summary = "Upload a file",
|
||||
Description = "Upload a file using multipart/form-data",
|
||||
OperationId = "UploadCommandAttachmentAsync"
|
||||
//Tags = new[] { "File" }
|
||||
)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> UploadCommandAttachmentAsync(Guid orderId)
|
||||
{
|
||||
try
|
||||
|
|
@ -942,9 +962,10 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
var docs = await _repository.GetExistDocument(orderId, GlobalConstants.TYPE_ATTACHMENT);
|
||||
|
||||
// delete exist document from s3
|
||||
|
||||
foreach (var doc in docs)
|
||||
{
|
||||
await _documentService.DeleteFileAsync(doc.Document.ObjectRefId);
|
||||
await _documentService.DeleteFileAsync(doc.Document.Id);
|
||||
}
|
||||
|
||||
// upload new document to s3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue