2023-03-31 15:01:40 +07:00
|
|
|
|
// using BMA.EHR.Core;
|
|
|
|
|
|
using BMA.EHR.Recurit.Exam.Service.Core;
|
2023-03-25 01:09:03 +07:00
|
|
|
|
using BMA.EHR.Recurit.Exam.Service.Request;
|
2023-03-24 11:50:46 +07:00
|
|
|
|
using BMA.EHR.Recurit.Exam.Service.Response;
|
2023-03-23 21:41:26 +07:00
|
|
|
|
using BMA.EHR.Recurit.Exam.Service.Services;
|
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using Swashbuckle.AspNetCore.Annotations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
[Route("api/v{version:apiVersion}/candidate")]
|
|
|
|
|
|
[ApiVersion("1.0")]
|
|
|
|
|
|
[ApiController]
|
|
|
|
|
|
[Produces("application/json")]
|
|
|
|
|
|
[Authorize]
|
2023-03-31 15:01:40 +07:00
|
|
|
|
[SwaggerTag("จัดการข้อมูลสมัครสอบ เพื่อนำไปใช้งานในระบบ")]
|
2023-03-23 21:41:26 +07:00
|
|
|
|
public class CandidateController : BaseController
|
|
|
|
|
|
{
|
|
|
|
|
|
#region " Fields "
|
|
|
|
|
|
|
|
|
|
|
|
private readonly CandidateService _candidateService;
|
2023-03-31 14:58:53 +07:00
|
|
|
|
private readonly MinIOService _minioService;
|
2023-03-23 21:41:26 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " Constructor and Destructor "
|
|
|
|
|
|
|
2023-03-31 15:01:40 +07:00
|
|
|
|
public CandidateController(CandidateService candidateService,
|
|
|
|
|
|
MinIOService minioService)
|
2023-03-23 21:41:26 +07:00
|
|
|
|
{
|
|
|
|
|
|
_candidateService = candidateService;
|
2023-03-31 15:01:40 +07:00
|
|
|
|
_minioService = minioService;
|
2023-03-23 21:41:26 +07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region " Methods "
|
|
|
|
|
|
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ข้อมูล สถานะ ผู้สมัครสอบ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการดึง ข้อมูล สถานะ ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("status/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetStatusCandidateService(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetStatusCandidateService(examId);
|
|
|
|
|
|
|
2023-03-25 01:09:03 +07:00
|
|
|
|
return Success(GlobalMessages.Success, items);
|
|
|
|
|
|
}
|
|
|
|
|
|
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>
|
|
|
|
|
|
[HttpGet("{candidateId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsync(string candidateId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsync(candidateId);
|
|
|
|
|
|
|
2023-03-24 11:50:46 +07:00
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("information/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsyncInformation(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsyncInformation(examId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ข้อมูล ข้อมูลที่อยู่ ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลที่อยู่ ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("address/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsyncAddress(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsyncAddress(examId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ข้อมูล ข้อมูลครอบครัว ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการดึง ข้อมูล ข้อมูลครอบครัว ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("family/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsyncFamily(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsyncFamily(examId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ข้อมูล อาชีพ ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการดึง ข้อมูล อาชีพ ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("occupation/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsyncOccupation(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsyncOccupation(examId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการดึง ข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("career/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsyncCareer(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsyncCareer(examId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ข้อมูล ประวัติการศีกษา ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการดึง ข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("education/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsyncEducation(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsyncEducation(examId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ตรวจสอบว่าผู้ใช้งานสมัครสอบหรือยัง
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการตรวจสอบว่าผู้ใช้งานสมัครสอบหรือยัง สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("check/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> GetsAsyncRegisterExam(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var items = await _candidateService.GetsAsyncRegisterExam(examId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success(items);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-30 13:42:54 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// อัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidateInformation">ข้อมูลส่วนตัว</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPost("{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsync(string examId, CandidateResponseItem candidateInformation)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UpdateAsync(examId, candidateInformation);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// อัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidateInformation">ข้อมูลส่วนตัว</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลส่วนตัว ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPost("information/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncInformation(string examId, CandidateInformationResponseItem candidateInformation)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UpdateAsyncInformation(examId, candidateInformation);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// อัพเดทข้อมูล ข้อมูลที่อยู่ ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidateAddress">ข้อมูลที่อยู่</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลที่อยู่ ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPost("address/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncAddress(string examId, CandidateAddressResponseItem candidateAddress)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UpdateAsyncAddress(examId, candidateAddress);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// อัพเดทข้อมูล ข้อมูลครอบครัว ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidateFamily">ข้อมูลครอบครัว</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ข้อมูลครอบครัว ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPost("family/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncFamily(string examId, CandidateFamilyResponseItem candidateFamily)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UpdateAsyncFamily(examId, candidateFamily);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// อัพเดทข้อมูล อาชีพ ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidateOccupation">อาชีพ</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอัพเดทข้อมูล อาชีพ ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPost("occupation/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncOccupation(string examId, CandidateOccupationResponseItem candidateOccupation)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UpdateAsyncOccupation(examId, candidateOccupation);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// สร้างข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidateCareer">ข้อมูลประวัติการทำงาน/ฝึกงาน</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการสร้างข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPost("career/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> CreateAsyncCareer(string examId, CandidateCareerResponseItem candidateCareer)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.CreateAsyncCareer(examId, candidateCareer);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// สร้างข้อมูล ประวัติการศีกษา ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการสร้างข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPost("education/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> CreateAsyncEducation(string examId, CandidateEducationResponseItem candidateEducation)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.CreateAsyncEducation(examId, candidateEducation);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// อัพเดทข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="careerId">รหัสประวัติการทำงาน/ฝึกงาน</param>
|
|
|
|
|
|
/// <param name="candidateCareer">ข้อมูลประวัติการทำงาน/ฝึกงาน</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPut("career/{careerId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncCareer(string careerId, CandidateCareerResponseItem candidateCareer)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UpdateAsyncCareer(careerId, candidateCareer);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-25 01:09:03 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ลบข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="careerId">รหัสประวัติการทำงาน/ฝึกงาน</param>
|
|
|
|
|
|
/// <param name="candidateCareer">ข้อมูลประวัติการทำงาน/ฝึกงาน</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการลบข้อมูล ประวัติการทำงาน/ฝึกงาน ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpDelete("career/{careerId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncCareer(string careerId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.DeleteAsyncCareer(careerId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// อัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="educationId">รหัสประวัติการศีกษา</param>
|
|
|
|
|
|
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอัพเดทข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
2023-03-25 01:09:03 +07:00
|
|
|
|
[HttpPut("education/{educationId:length(36)}")]
|
2023-03-23 21:41:26 +07:00
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> UpdateAsyncEducation(string educationId, CandidateEducationResponseItem candidateEducation)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UpdateAsyncEducation(educationId, candidateEducation);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-25 01:09:03 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ลบข้อมูล ประวัติการศีกษา ผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="educationId">รหัสประวัติการศีกษา</param>
|
|
|
|
|
|
/// <param name="candidateEducation">ข้อมูลประวัติการศีกษา</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการลบข้อมูล ประวัติการศีกษา ผู้สมัคร สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpDelete("education/{educationId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> DeleteAsyncEducation(string educationId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.DeleteAsyncEducation(educationId);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ผู้สมัครทำการสมัครสอบ
|
|
|
|
|
|
/// </summary>
|
2023-03-24 11:50:46 +07:00
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
2023-03-23 21:41:26 +07:00
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการผู้สมัครทำการสมัครสอบ สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("register/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> RegisterCandidateService(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-03-24 11:50:46 +07:00
|
|
|
|
await _candidateService.UserCheckCandidateService(examId, "checkRegister");
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เจ้าหน้าที่ตรวจคุณสมบัติผู้สมัคร
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidate">รหัสใบสมัคร</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครสำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPut("check-register/{candidate:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> CheckRegisterCandidateService(string candidate, RequestApprove item)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-03-25 01:09:03 +07:00
|
|
|
|
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "payment" : "rejectRegister", item);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครไม่ผ่านและให้สมัครใหม่
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidate">รหัสใบสมัคร</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจคุณสมบัติผู้สมัครไม่ผ่านและให้สมัครใหม่สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpPut("reject-register/{candidate:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> RejectRegisterCandidateService(string candidate, RequestApprove item)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.AdminCheckCandidateService(candidate, "rejectDelete", item);
|
2023-03-24 11:50:46 +07:00
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
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>
|
|
|
|
|
|
[HttpGet("payment/{examId:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> PaymentedCandidateService(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _candidateService.UserCheckCandidateService(examId, "checkPayment");
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เจ้าหน้าที่ตรวจการชำระเงิน
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidate">รหัสใบสมัคร</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อเจ้าหน้าที่ตรวจการชำระเงินสำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
2023-03-28 15:51:41 +07:00
|
|
|
|
[HttpPut("check-payment/{candidate:length(36)}")]
|
2023-03-24 11:50:46 +07:00
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> CheckPaymentCandidateService(string candidate, RequestApprove item)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-03-29 01:00:43 +07:00
|
|
|
|
await _candidateService.AdminCheckCandidateService(candidate, item.Status ? "done" : "rejectPayment", item);
|
2023-03-24 11:50:46 +07:00
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// เจ้าหน้าที่บันทึกสถานที่สอบ
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="candidate">รหัสใบสมัคร</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อเจ้าหน้าที่บันทึกสถานที่สอบสำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
2023-03-24 11:55:10 +07:00
|
|
|
|
[HttpGet("pass-done/{candidate:length(36)}")]
|
2023-03-24 11:50:46 +07:00
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> CheckDoneCandidateService(string candidate)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
2023-03-25 01:09:03 +07:00
|
|
|
|
await _candidateService.AdminPassCandidateService(candidate, "done");
|
2023-03-23 21:41:26 +07:00
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-03-31 14:58:53 +07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ตัวอย่างในการเขียน api เพื่อทำการ upload file
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
|
|
|
|
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพ ลาดในการทำงาน</response>
|
|
|
|
|
|
// [HttpPost("upload"), DisableRequestSizeLimit]
|
|
|
|
|
|
// [ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
// [ProducesResponseType(StatusCodes.Status400BadRequest)]
|
|
|
|
|
|
// [ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
// [ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
// [AllowAnonymous]
|
|
|
|
|
|
// public async Task<ActionResult<ResponseObject>> UploadFile()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// try
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return Error(GlobalMessages.NoFileToUpload);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// var file = Request.Form.Files[0];
|
|
|
|
|
|
// var doc = await _minioService.UploadFileAsync(file);
|
|
|
|
|
|
|
|
|
|
|
|
// return Success(doc);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// catch (Exception ex)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return Error(ex);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
[HttpGet("delete/{id:length(36)}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> DeleteFile(Guid id)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
await _minioService.DeleteFileAsync(id);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[HttpGet("download/{id:length(36)}")]
|
|
|
|
|
|
[AllowAnonymous]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> DownloadFile(Guid id)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var file_data = await _minioService.DownloadFileAsync(id);
|
|
|
|
|
|
|
|
|
|
|
|
Response.Headers["Content-Disposition"] = $"inline; filename={file_data.FileName}";
|
|
|
|
|
|
|
|
|
|
|
|
var ret = new FileContentResult(file_data.FileContent, file_data.FileType)
|
|
|
|
|
|
{
|
|
|
|
|
|
FileDownloadName = file_data.FileName
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-23 21:41:26 +07:00
|
|
|
|
|
2023-03-31 15:01:40 +07:00
|
|
|
|
/// <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]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> CreateFileCandidateService(string examId)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(GlobalMessages.NoFileToUpload);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var file = Request.Form.Files[0];
|
|
|
|
|
|
await _candidateService.UpdateAsyncDocument(examId, file);
|
|
|
|
|
|
|
|
|
|
|
|
return Success();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ลบเอกสารหลักฐาน
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="documentId">รหัสไฟล์เอกสาร</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <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);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// โหลดไฟล์
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
/// <response code="200">เมื่อโหลดไฟล์สำเร็จ</response>
|
|
|
|
|
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
|
|
|
|
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
|
|
|
|
|
[HttpGet("download/{id:length(36)}")]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
|
|
|
|
|
public async Task<ActionResult<ResponseObject>> DownloadFile(Guid id)
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var file_data = await _minioService.DownloadFileAsync(id);
|
|
|
|
|
|
Response.Headers["Content-Disposition"] = $"inline; filename={file_data.FileName}";
|
|
|
|
|
|
var ret = new FileContentResult(file_data.FileContent, file_data.FileType)
|
|
|
|
|
|
{
|
|
|
|
|
|
FileDownloadName = file_data.FileName
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Error(ex);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-03-23 21:41:26 +07:00
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|