fix bug and add approver position
This commit is contained in:
parent
4215af4a0b
commit
cc902536d6
4 changed files with 37 additions and 10 deletions
|
|
@ -1220,7 +1220,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
if (data == null)
|
||||
throw new Exception(GlobalMessages.OrganizationNotFound);
|
||||
|
||||
return data.OrganizationAgencyId!.Value;
|
||||
return data.OrganizationAgencyId == null ? ocId : data.OrganizationAgencyId!.Value;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -1260,12 +1260,12 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<KeyValueItemResponse>> GetOrgApproverAsync(Guid ocId)
|
||||
public async Task<List<OrganizationApproverResponse>> GetOrgApproverAsync(Guid ocId)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ocId == Guid.Empty)
|
||||
return new List<KeyValueItemResponse>() { new KeyValueItemResponse { Id = Guid.Empty, Name = "ปลัดกรุงเทพมหานคร" } };
|
||||
return new List<OrganizationApproverResponse>() { new OrganizationApproverResponse { Id = Guid.Empty, Name = "", PositionName = "ปลัดกรุงเทพมหานคร" } };
|
||||
else
|
||||
{
|
||||
//var ret = new List<KeyValueItemResponse>();
|
||||
|
|
@ -1278,12 +1278,20 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
.ThenInclude(x => x!.Organization)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x!.PositionMaster)
|
||||
.ThenInclude(x => x!.PositionPath)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x!.PositionMaster)
|
||||
.ThenInclude(x => x!.PositionExecutive)
|
||||
.Where(x => x.OrganizationPosition!.Organization!.Id == ocId &&
|
||||
x.OrganizationPosition!.PositionMaster!.IsDirector == true)
|
||||
.Select(x => new KeyValueItemResponse
|
||||
.Select(x => new OrganizationApproverResponse
|
||||
{
|
||||
Id = x.Profile!.Id,
|
||||
Name = $"{x.Profile!.Prefix!.Name}{x.Profile!.FirstName} {x.Profile!.LastName}"
|
||||
Name = $"{x.Profile!.Prefix!.Name}{x.Profile!.FirstName} {x.Profile!.LastName}",
|
||||
PositionName = x.OrganizationPosition!.PositionMaster!.PositionExecutive != null ?
|
||||
x.OrganizationPosition!.PositionMaster!.PositionExecutive!.Name
|
||||
:
|
||||
x.OrganizationPosition!.PositionMaster!.PositionPath == null ? "" : x.OrganizationPosition!.PositionMaster!.PositionPath!.Name
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
|
|
@ -1302,19 +1310,27 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
.ThenInclude(x => x!.Organization)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x!.PositionMaster)
|
||||
.ThenInclude(x => x!.PositionPath)
|
||||
.Include(x => x.OrganizationPosition)
|
||||
.ThenInclude(x => x!.PositionMaster)
|
||||
.ThenInclude(x => x!.PositionExecutive)
|
||||
.Where(x => x.OrganizationPosition!.Organization!.Id == oc.Parent.Id &&
|
||||
x.OrganizationPosition!.PositionMaster!.IsDirector == true)
|
||||
.Select(x => new KeyValueItemResponse
|
||||
.Select(x => new OrganizationApproverResponse
|
||||
{
|
||||
Id = x.Profile!.Id,
|
||||
Name = $"{x.Profile!.Prefix!.Name}{x.Profile!.FirstName} {x.Profile!.LastName}"
|
||||
Name = $"{x.Profile!.Prefix!.Name}{x.Profile!.FirstName} {x.Profile!.LastName}",
|
||||
PositionName = x.OrganizationPosition!.PositionMaster!.PositionExecutive != null ?
|
||||
x.OrganizationPosition!.PositionMaster!.PositionExecutive!.Name
|
||||
:
|
||||
x.OrganizationPosition!.PositionMaster!.PositionPath == null ? "" : x.OrganizationPosition!.PositionMaster!.PositionPath!.Name
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return parentProfilePosition;
|
||||
}
|
||||
else
|
||||
return new List<KeyValueItemResponse>();
|
||||
return new List<OrganizationApproverResponse>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
namespace BMA.EHR.Application.Responses
|
||||
{
|
||||
public class OrganizationApproverResponse
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||
"Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
|
||||
},
|
||||
"EPPlus": {
|
||||
"ExcelPackage": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"realm": "bma-ehr",
|
||||
"auth-server-url": "https://identity.frappet.com",
|
||||
"auth-server-url": "https://id.frappet.synology.me",
|
||||
"ssl-required": "external",
|
||||
"resource": "bma-ehr",
|
||||
"public-client": true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue