Merge branch 'develop' into work

This commit is contained in:
Kittapath 2023-08-19 21:04:00 +07:00
commit 16e55269dc
7 changed files with 42 additions and 19 deletions

View file

@ -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>();
}
}
}

View file

@ -14,7 +14,6 @@ namespace BMA.EHR.Application.Repositories
private readonly DbSet<T> _dbSet;
private readonly IHttpContextAccessor _httpContextAccessor;
#endregion
#region " Constructor and Destructor "
@ -36,9 +35,7 @@ namespace BMA.EHR.Application.Repositories
protected string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
protected bool? IsPlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
protected bool? IsPlacementAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("placement1");
#endregion
@ -63,7 +60,6 @@ namespace BMA.EHR.Application.Repositories
(entity as EntityBase).CreatedAt = DateTime.Now;
}
await _dbSet.AddAsync(entity);
await _dbContext.SaveChangesAsync();

View file

@ -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;
}
}

View file

@ -381,7 +381,7 @@ namespace BMA.EHR.Command.Service.Controllers
{
var inserted = new Domain.Models.Commands.Core.Command
{
CommandNo = req.orderNo.ToString(),
CommandNo = req.orderNo,
CommandYear = req.orderYear.ToString(),
CommandSubject = req.orderTitle,
PositionName = req.registerPosition,
@ -433,7 +433,7 @@ namespace BMA.EHR.Command.Service.Controllers
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
order.CommandNo = req.orderNo.ToString();
order.CommandNo = req.orderNo;
order.CommandYear = req.orderYear.ToString();
order.CommandSubject = req.orderTitle;
order.PositionName = req.registerPosition;

View file

@ -4,9 +4,9 @@
{
public Guid orderTypeValue { get; set; }
public string orderTitle { get; set; }
public string orderTitle { get; set; } = string.Empty;
public int orderNo { get; set; }
public string orderNo { get; set; } = string.Empty;
public int orderYear { get; set; }

View file

@ -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": {

View file

@ -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