diff --git a/Controllers/CandidateController.cs b/Controllers/CandidateController.cs
index f4187f4..b3fff43 100644
--- a/Controllers/CandidateController.cs
+++ b/Controllers/CandidateController.cs
@@ -752,11 +752,37 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
}
///
- /// อัปเอกสารหลักฐาน
+ /// list เอกสารหลักฐาน
///
/// รหัสรอบสมัคร
///
- /// เมื่ออัปเอกสารหลักฐานสำเร็จ
+ /// เมื่อ list เอกสารหลักฐานสำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpGet("upload/{examId:length(36)}")]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> GetFileCandidateService(string examId)
+ {
+ try
+ {
+ var doc = await _candidateService.GetsAsyncFileUpload(examId);
+
+ return Success(doc);
+ }
+ catch (Exception ex)
+ {
+ return Error(ex);
+ }
+ }
+
+ ///
+ /// อัปโหลดเอกสารหลักฐาน
+ ///
+ /// รหัสรอบสมัคร
+ ///
+ /// เมื่ออัปโหลดเอกสารหลักฐานสำเร็จ
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
[HttpPut("upload/{examId:length(36)}"), DisableRequestSizeLimit]
@@ -791,23 +817,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
/// เมื่อลบเอกสารหลักฐานสำเร็จ
/// ไม่ได้ Login เข้าระบบ
/// เมื่อเกิดข้อผิดพลาดในการทำงาน
- // [HttpDelete("upload/{examId:length(36)}"), DisableRequestSizeLimit]
- // [ProducesResponseType(StatusCodes.Status200OK)]
- // [ProducesResponseType(StatusCodes.Status401Unauthorized)]
- // [ProducesResponseType(StatusCodes.Status500InternalServerError)]
- // public async Task> DeleteFileCandidateService(string documentId)
- // {
- // try
- // {
- // await _candidateService.DeleteAsyncDocument(documentId);
-
- // return Success();
- // }
- // catch (Exception ex)
- // {
- // return Error(ex);
- // }
- // }
+ [HttpDelete("upload/{examId:length(36)}"), DisableRequestSizeLimit]
+ [ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status401Unauthorized)]
+ [ProducesResponseType(StatusCodes.Status500InternalServerError)]
+ public async Task> DeleteFileCandidateService(string documentId)
+ {
+ try
+ {
+ await _candidateService.DeleteAsyncDocument(documentId);
+ return Success();
+ }
+ catch (Exception ex)
+ {
+ return Error(ex);
+ }
+ }
///
/// โหลดไฟล์
diff --git a/Response/Document/FileListResponse.cs b/Response/Document/FileListResponse.cs
index 513df52..631d0fa 100644
--- a/Response/Document/FileListResponse.cs
+++ b/Response/Document/FileListResponse.cs
@@ -2,6 +2,8 @@
{
public class FileListResponse
{
+ public string? Id { get; set; }
+
public string FileName { get; set; } = string.Empty;
public string FileType { get; set; } = string.Empty;
diff --git a/Services/CandidateService.cs b/Services/CandidateService.cs
index 9ca3b48..670af61 100644
--- a/Services/CandidateService.cs
+++ b/Services/CandidateService.cs
@@ -241,6 +241,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
.Where(x => x.Candidate == candidate)
.Select(x => new FileListResponse
{
+ Id = x.Document == null ? "" : x.Document.Id.ToString(),
FileName = x.Document == null ? "" : x.Document.FileName,
FileType = x.Document == null ? "" : x.Document.FileType,
FileSize = x.Document == null ? 0 : x.Document.FileSize,
@@ -750,19 +751,10 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
await _context.SaveChangesAsync();
}
- // public async Task DeleteAsyncDocument(string documentId)
- // {
- // // var document = await _context.Documents.AsQueryable()
- // // .FirstOrDefaultAsync(x => x.Id == Guid.Parse(documentId));
-
- // // if (document == null)
- // // throw new Exception(GlobalMessages.FileNotFoundOnServer);
-
- // // _context.Documents.Remove(document);
- // var doc = await _minioService.DeleteFileAsync(documentId);
- // return "uy";
- // // await _context.SaveChangesAsync();
- // }
+ public async Task DeleteAsyncDocument(string documentId)
+ {
+ await _minioService.DeleteFileAsync(Guid.Parse(documentId));
+ }
public async Task CreateAsyncCareer(string examId, CandidateCareerResponseItem updated)
{