fix: เริ่มต่อ api โครงสร้างใหม่ ระบบลา

This commit is contained in:
Suphonchai Phoonsawat 2024-05-29 13:33:23 +07:00
parent b7f19d7077
commit 66d491a2af
5 changed files with 134 additions and 23 deletions

View file

@ -2,7 +2,6 @@
using BMA.EHR.Application.Repositories.Commands;
using BMA.EHR.Application.Repositories.Leaves.LeaveRequests;
using BMA.EHR.Application.Repositories.Leaves.TimeAttendants;
using BMA.EHR.Application.Responses;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
using BMA.EHR.Domain.Shared;
@ -15,7 +14,6 @@ using BMA.EHR.Leave.Service.DTOs.DutyTime;
using BMA.EHR.Leave.Service.DTOs.LeaveRequest;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Ocsp;
using Swashbuckle.AspNetCore.Annotations;
using System.ComponentModel.DataAnnotations;
using System.Security.Claims;
@ -97,6 +95,8 @@ namespace BMA.EHR.Leave.Service.Controllers
private bool? PlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
private Guid OcId
{
get
@ -951,11 +951,11 @@ namespace BMA.EHR.Leave.Service.Controllers
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> SearchProfileAsync([FromBody] SearchProfileDto req)
{
var profile = await _userProfileRepository.SearchProfile(req.CitizenId, req.FirstName, req.LastName);
var profile = await _userProfileRepository.SearchProfile(req.CitizenId, req.FirstName, req.LastName, AccessToken ?? "");
var pagedProfile = profile.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
var getDefaultRound = await _dutyTimeRepository.GetDefaultAsync();
var resultSet = new List<SearchProfileResultDto>();
@ -972,8 +972,8 @@ namespace BMA.EHR.Leave.Service.Controllers
var res = new SearchProfileResultDto
{
ProfileId = p.Id,
CitizenId = p.CitizenId,
FullName = $"{p.Prefix.Name}{p.FirstName} {p.LastName}",
CitizenId = p.CitizenId ?? "",
FullName = $"{p.Prefix ?? "" }{p.FirstName ?? ""} {p.LastName ?? ""}",
StartTimeMorning = duty.StartTimeMorning,
LeaveTimeAfterNoon = duty.EndTimeAfternoon,
EffectiveDate = effectiveDate == null ? null : effectiveDate.EffectiveDate.Value.Date