From c01ed73e7e1939f05699c300924c3026878e8b0d Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Tue, 9 Jan 2024 14:48:07 +0700 Subject: [PATCH] =?UTF-8?q?LV1=5F025=20-=20=E0=B8=9A=E0=B8=B1=E0=B8=99?= =?UTF-8?q?=E0=B8=97=E0=B8=B6=E0=B8=81=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84?= =?UTF-8?q?=E0=B8=82=E0=B8=AA=E0=B8=96=E0=B8=B2=E0=B8=99=E0=B8=B0=E0=B8=81?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B9=80=E0=B8=82=E0=B9=89=E0=B8=B2-?= =?UTF-8?q?=E0=B8=AD=E0=B8=AD=E0=B8=81=E0=B8=87=E0=B8=B2=E0=B8=99=20(ADMIN?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/LeaveController.cs | 40 +++++++++++++++++-- .../DTOs/CheckIn/EditCheckInStatusDto.cs | 15 +++++++ 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 BMA.EHR.Leave.Service/DTOs/CheckIn/EditCheckInStatusDto.cs diff --git a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs index 03f9798a..a2492cd6 100644 --- a/BMA.EHR.Leave.Service/Controllers/LeaveController.cs +++ b/BMA.EHR.Leave.Service/Controllers/LeaveController.cs @@ -1551,10 +1551,42 @@ namespace BMA.EHR.Leave.Service.Controllers return Success(); } - - #endregion - - #endregion } + + #endregion + + #region " แก้ไขสถานะการลงเวลา " + + /// + /// LV1_025 - บันทึกแก้ไขสถานะการเข้า-ออกงาน (ADMIN) + /// + /// + /// + /// เมื่อทำรายการสำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("admin/edit/checkin/{id:guid}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> EditCheckInStatusAsync(Guid id, [FromQuery] EditCheckInStatusDto req) + { + var data = await _processUserTimeStampRepository.GetByIdAsync(id); + if (data == null) + return Error(GlobalMessages.DataNotFound); + + data.CheckInStatus = req.CheckInStatus; + data.CheckInStatus = req.CheckOutStatus; + data.EditReason = req.Reason; + + await _processUserTimeStampRepository.UpdateAsync(data); + + return Success(); + } + + #endregion + + #endregion + } } diff --git a/BMA.EHR.Leave.Service/DTOs/CheckIn/EditCheckInStatusDto.cs b/BMA.EHR.Leave.Service/DTOs/CheckIn/EditCheckInStatusDto.cs new file mode 100644 index 00000000..c431c3b7 --- /dev/null +++ b/BMA.EHR.Leave.Service/DTOs/CheckIn/EditCheckInStatusDto.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace BMA.EHR.Leave.Service.DTOs.CheckIn +{ + public class EditCheckInStatusDto + { + [Required] + public string CheckInStatus { get; set; } = string.Empty; + + [Required] + public string CheckOutStatus { get; set; } = string.Empty; + + public string? Reason { get; set; } = string.Empty; + } +} \ No newline at end of file