api บันทึก และ แสดง ข้อมูลผู้สมัคร
This commit is contained in:
parent
ffeab6a127
commit
a781c375d7
40 changed files with 10433 additions and 2 deletions
454
Controllers/CandidateController.cs
Normal file
454
Controllers/CandidateController.cs
Normal file
|
|
@ -0,0 +1,454 @@
|
|||
using BMA.EHR.Recurit.Exam.Service.Response;
|
||||
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]
|
||||
[SwaggerTag("จัดการข้อมูลศาสนา เพื่อนำไปใช้งานในระบบ")]
|
||||
public class CandidateController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly CandidateService _candidateService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public CandidateController(CandidateService candidateService)
|
||||
{
|
||||
_candidateService = candidateService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// ข้อมูล ข้อมูลส่วนตัว ผู้สมัคร
|
||||
/// </summary>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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>
|
||||
[HttpPut("career/{educationId:length(36)}")]
|
||||
[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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ผู้สมัครทำการสมัครสอบ
|
||||
/// </summary>
|
||||
/// <param name="examId">รหัสการสมัคร</param>
|
||||
/// <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
|
||||
{
|
||||
await _candidateService.RegisterCandidateService(examId);
|
||||
|
||||
return Success();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue