ลบไฟล์หลักฐาน
This commit is contained in:
parent
9cf8135301
commit
5b1f9cc72b
3 changed files with 51 additions and 32 deletions
|
|
@ -752,11 +752,37 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปเอกสารหลักฐาน
|
||||
/// list เอกสารหลักฐาน
|
||||
/// </summary>
|
||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่ออัปเอกสารหลักฐานสำเร็จ</response>
|
||||
/// <response code="200">เมื่อ list เอกสารหลักฐานสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("upload/{examId:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetFileCandidateService(string examId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var doc = await _candidateService.GetsAsyncFileUpload(examId);
|
||||
|
||||
return Success(doc);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปโหลดเอกสารหลักฐาน
|
||||
/// </summary>
|
||||
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่ออัปโหลดเอกสารหลักฐานสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("upload/{examId:length(36)}"), DisableRequestSizeLimit]
|
||||
|
|
@ -791,23 +817,22 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|||
/// <response code="200">เมื่อลบเอกสารหลักฐานสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpDelete("upload/{examId:length(36)}"), DisableRequestSizeLimit]
|
||||
// [ProducesResponseType(StatusCodes.Status200OK)]
|
||||
// [ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
// [ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
// public async Task<ActionResult<ResponseObject>> 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<ActionResult<ResponseObject>> DeleteFileCandidateService(string documentId)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _candidateService.DeleteAsyncDocument(documentId);
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// โหลดไฟล์
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue