add
LV2_006 - รายละเอียดการยกเลิกการลา (USER/ADMIN)
This commit is contained in:
parent
0c2814e53b
commit
c1acdec520
2 changed files with 84 additions and 0 deletions
|
|
@ -668,6 +668,59 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Success(new { data = pageResult, total = result.Count });
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// LV2_006 - รายละเอียดการยกเลิกการลา (USER/ADMIN)
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// </returns>
|
||||
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("user/delete/{id:guid}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCancelLeaveRequestByIdAsync(Guid id)
|
||||
{
|
||||
var rawData = await _leaveRequestRepository.GetByIdAsync(id);
|
||||
|
||||
var thisYear = DateTime.Now.Year;
|
||||
|
||||
if (rawData == null)
|
||||
{
|
||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(rawData.KeycloakUserId);
|
||||
|
||||
if (profile == null)
|
||||
{
|
||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var result = new GetCancelLeaveRequestByIdDto
|
||||
{
|
||||
Id = rawData.Id,
|
||||
LeaveTypeName = rawData.Type.Name,
|
||||
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
|
||||
Status = rawData.LeaveCancelStatus,
|
||||
LeaveStartDate = rawData.LeaveStartDate,
|
||||
LeaveEndDate = rawData.LeaveEndDate,
|
||||
LeaveWrote = rawData.LeaveWrote,
|
||||
LeaveAddress = rawData.LeaveAddress,
|
||||
LeaveNumber = rawData.LeaveNumber,
|
||||
LeaveDetail = rawData.LeaveDetail,
|
||||
LeaveDocDelete = await _minIOService.ImagesPath(rawData.LeaveCancelDocument.Id),
|
||||
LeaveReasonDelete = rawData.LeaveCancelComment ?? "",
|
||||
LeaveTotal = rawData.LeaveTotal,
|
||||
};
|
||||
|
||||
return Success(result);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
|
||||
{
|
||||
public class GetCancelLeaveRequestByIdDto
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
|
||||
public string LeaveTypeName { get; set; } = string.Empty;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
public string Status { get; set; } = string.Empty;
|
||||
|
||||
public string LeaveDocDelete { get; set; } = string.Empty;
|
||||
|
||||
public string LeaveReasonDelete { get; set; } = string.Empty;
|
||||
|
||||
public string LeaveWrote { get; set; } = string.Empty;
|
||||
|
||||
public string LeaveAddress { get; set; } = string.Empty;
|
||||
|
||||
public string LeaveNumber { get; set; } = string.Empty;
|
||||
|
||||
public string LeaveDetail { get; set; } = string.Empty;
|
||||
|
||||
public double LeaveTotal { get; set; } = 0;
|
||||
|
||||
public DateTime LeaveStartDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
public DateTime LeaveEndDate { get; set;} = DateTime.MinValue;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue