LV1_025 - บันทึกแก้ไขสถานะการเข้า-ออกงาน (ADMIN)

This commit is contained in:
Suphonchai Phoonsawat 2024-01-09 14:48:07 +07:00
parent 3d1dfa9997
commit c01ed73e7e
2 changed files with 51 additions and 4 deletions

View file

@ -1551,10 +1551,42 @@ namespace BMA.EHR.Leave.Service.Controllers
return Success();
}
#endregion
#endregion
}
#endregion
#region " แก้ไขสถานะการลงเวลา "
/// <summary>
/// LV1_025 - บันทึกแก้ไขสถานะการเข้า-ออกงาน (ADMIN)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("admin/edit/checkin/{id:guid}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> 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
}
}

View file

@ -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;
}
}