เรียกรายชื่อจากระบบทดลองงาน
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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.AspNetCore.Mvc.Versioning;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Serilog;
|
||||
|
|
@ -47,6 +48,7 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
// Authorization
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt =>
|
||||
{
|
||||
opt.SaveToken = true;
|
||||
opt.RequireHttpsMetadata = false; //false for dev
|
||||
opt.Authority = issuer;
|
||||
opt.TokenValidationParameters = new()
|
||||
|
|
|
|||
|
|
@ -31,5 +31,8 @@
|
|||
"SecretKey": "FPTadmin2357",
|
||||
"BucketName": "bma-ehr-fpt"
|
||||
},
|
||||
"Protocol": "HTTPS"
|
||||
"Protocol": "HTTPS",
|
||||
"Node": {
|
||||
"API": "https://bma-ehr.frappet.synology.me/api/v1/probation"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue