Add new API

Update Salary
Swap Sequence
This commit is contained in:
Suphonchai Phoonsawat 2023-08-04 14:30:10 +07:00
parent 680bfba81e
commit a4e8b50d45
3 changed files with 196 additions and 0 deletions

View file

@ -1,6 +1,7 @@
using Amazon.S3.Model.Internal.MarshallTransformations;
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.Commands;
using BMA.EHR.Application.Requests.Commands;
using BMA.EHR.Command.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
@ -889,6 +890,81 @@ namespace BMA.EHR.Command.Service.Controllers
}
}
/// <summary>
/// บันทึกข้อมูลเงินเดือนสำหรับผู้บรรจุ
/// </summary>
/// <param name="personalId">Record Id ของผู้รับคำสั่งในบัญชีแนบท้าย</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("salary/{id}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> UpdatePlacementSalaryAsync(Guid personalId, [FromBody] UpdatePlacementSalaryRequest req)
{
try
{
var receiver = await _repository.GetCommandReceiverAsync(personalId);
if (receiver == null)
throw new Exception(GlobalMessages.DataNotFound);
await _repository.UpdatePlacementSalaryAsync(personalId, req);
return Success();
}
catch
{
throw;
}
}
/// <summary>
/// สลับลำดับข้อมูลในบัญชีแนบท้ายขึ้น
/// </summary>
/// <param name="personalId">Record Id ของผู้รับคำสั่งในบัญชีแนบท้าย</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("swap/up/{personalId}")]
public async Task<ActionResult<ResponseObject>> SwapUpReceiverOrderAsync(Guid personalId)
{
try
{
await _repository.SwapReceiverOrderAsync(personalId, "up");
return Success();
}
catch
{
throw;
}
}
/// <summary>
/// สลับลำดับข้อมูลในบัญชีแนบท้ายลง
/// </summary>
/// <param name="personalId">Record Id ของผู้รับคำสั่งในบัญชีแนบท้าย</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("swap/down/{personalId}")]
public async Task<ActionResult<ResponseObject>> SwapDownReceiverOrderAsync(Guid personalId)
{
try
{
await _repository.SwapReceiverOrderAsync(personalId, "down");
return Success();
}
catch
{
throw;
}
}
#endregion
}
}