add field และ เพิ่ม call ProfileLeave API

This commit is contained in:
Suphonchai Phoonsawat 2025-05-02 20:19:01 +07:00
parent 4382e779d7
commit 5ba93feb52
8 changed files with 1695 additions and 0 deletions

View file

@ -1,5 +1,6 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses.Insignias;
using BMA.EHR.Application.Responses.Leaves;
using BMA.EHR.Application.Responses.Organizations;
using BMA.EHR.Application.Responses.Profiles;
using BMA.EHR.Domain.Models.HR;
@ -182,6 +183,29 @@ namespace BMA.EHR.Application.Repositories
}
}
public async Task<GetProfileLeaveByKeycloakDto?> GetProfileLeaveByKeycloakIdAsync(Guid keycloakId, string? accessToken)
{
try
{
var apiPath = $"{_configuration["API"]}/org/dotnet/profile-leave/keycloak/{keycloakId}";
var apiKey = _configuration["API_KEY"];
var apiResult = await GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
if (apiResult != null)
{
var raw = JsonConvert.DeserializeObject<GetProfileLeaveByKeycloakResultDto>(apiResult);
if (raw != null)
return raw.Result;
}
return null;
}
catch
{
throw;
}
}
public async Task<GetProfileByKeycloakIdDto?> GetProfileByProfileIdAsync(Guid profileId, string? accessToken)
{
try

View file

@ -0,0 +1,46 @@
namespace BMA.EHR.Application.Responses.Leaves
{
public class GetProfileLeaveByKeycloakDto
{
public DateTime BirthDate { get; set; }
public DateTime RetireDate { get; set; }
public string GovAge { get; set; }
public string Age { get; set; }
public DateTime DateAppoint { get; set; }
public int Amount { get; set; }
public string? TelephoneNumber { get; set; }
public string PositionName { get; set; }
public string PosLevel { get; set; }
public string PosType { get; set; }
public string CurrentAddress { get; set; }
public string Oc { get; set; }
public string Root { get; set; }
public string Child1 { get; set; }
public string? Child2 { get; set; }
public string? Child3 { get; set; }
public string? Child4 { get; set; }
public List<ProfileLeavePosition> Positions { get; set; }
public List<ProfileLeaveEducation> Educations { get; set; }
}
public class ProfileLeavePosition
{
public string? PositionName { get; set; }
public DateTime Date { get; set; }
public string? PositionType { get; set; }
public string? PositionLevel { get; set; }
public string? OrgRoot { get; set; }
public string? OrgChild1 { get; set; }
public string? OrgChild2 { get; set; }
public string? OrgChild3 { get; set; }
public string? OrgChild4 { get; set; }
}
public class ProfileLeaveEducation
{
public string EducationLevel { get; set; }
public string Institute { get; set; }
public string? Country { get; set; }
public DateTime? FinishDate { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace BMA.EHR.Application.Responses.Leaves
{
public class GetProfileLeaveByKeycloakResultDto
{
public string Message { get; set; } = string.Empty;
public int Status { get; set; } = -1;
public GetProfileLeaveByKeycloakDto? Result { get; set; }
}
}