เรียกรายชื่อจากระบบทดลองงาน
This commit is contained in:
parent
bb9a0bc73e
commit
3b24682301
5 changed files with 283 additions and 10 deletions
|
|
@ -12,8 +12,8 @@ using BMA.EHR.Infrastructure.Persistence;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace BMA.EHR.Command.Service.Controllers
|
||||
{
|
||||
|
|
@ -2485,10 +2485,23 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandReceiverAsync(Guid orderId)
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandReceiverAsync([FromHeader] string authorization, Guid orderId)
|
||||
{
|
||||
try
|
||||
{
|
||||
var token = string.Empty;
|
||||
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
|
||||
{
|
||||
// we have a valid AuthenticationHeaderValue that has the following details:
|
||||
|
||||
var scheme = headerValue.Scheme;
|
||||
token = headerValue.Parameter;
|
||||
|
||||
// scheme will be "Bearer"
|
||||
// parmameter will be the token itself.
|
||||
}
|
||||
|
||||
|
||||
var command = await _repository.GetByIdAsync(orderId);
|
||||
if (command == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
|
@ -2496,7 +2509,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
// TODO : หาค่า Education มาแสดง
|
||||
var existed = await _repository.GetReceiverByCommmandIdAsync(orderId);
|
||||
|
||||
var receivers = (await _repository.GetReceiverForCommandAsync(orderId))
|
||||
var receivers = (await _repository.GetReceiverForCommandAsync(orderId, token!))
|
||||
.OrderBy(x => x.Sequence)
|
||||
.Select(r => new CommandReceiverResponse
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue