add api LV1_011 - รายละเอียดการลงเวลาปฎิบัติงานรายบุคคล
This commit is contained in:
parent
4d5170d9f6
commit
8d3c646151
2 changed files with 57 additions and 0 deletions
|
|
@ -102,6 +102,15 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserTimeStamp?> GetTimeStampById(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<UserTimeStamp>()
|
||||
.Where(u => u.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,10 @@ using BMA.EHR.Domain.Common;
|
|||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using iTextSharp.text;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Security.Claims;
|
||||
|
|
@ -519,6 +521,52 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LV1_011 - รายละเอียดการลงเวลาปฎิบัติงานรายบุคคล
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// </returns>
|
||||
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("time-record/{id:guid}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetTimeRecordAsync([Required] Guid id)
|
||||
{
|
||||
var imgUrl = $"{_configuration["MinIO:Endpoint"]}{_configuration["MinIO:BucketName"]}";
|
||||
var d = (await _userTimeStampRepository.GetTimeStampById(id));
|
||||
if(d == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = new CheckInHistoryForAdminDto
|
||||
{
|
||||
CheckInId = d.Id,
|
||||
FullName = _userProfileRepository.GetUserFullName(d.KeycloakUserId),
|
||||
|
||||
CheckInDate = d.CheckIn.Date,
|
||||
CheckInTime = d.CheckIn.ToString("HH:mm"),
|
||||
CheckInLocation = d.CheckInPOI,
|
||||
CheckInLat = d.CheckInLat,
|
||||
CheckInLon = d.CheckInLon,
|
||||
CheckInImageUrl = $"{imgUrl}/{d.CheckInImageUrl}",
|
||||
|
||||
CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date,
|
||||
CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm"),
|
||||
CheckOutLocation = d.CheckOut == null ? "" : d.CheckOutPOI,
|
||||
CheckOutLat = d.CheckOut == null ? null : d.CheckOutLat,
|
||||
CheckOutLon = d.CheckOut == null ? null : d.CheckOutLon,
|
||||
CheckOutImageUrl = d.CheckOut == null ? "" : $"{imgUrl}/{d.CheckOutImageUrl}",
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue