Merge branch 'develop' into work

# Conflicts:
#	BMA.EHR.Application/ApplicationServicesRegistration.cs
#	BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs
#	BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs
#	BMA.EHR.Solution.sln
This commit is contained in:
Kittapath 2023-07-13 09:57:58 +07:00
commit 8edfbc7466
70 changed files with 21946 additions and 157 deletions

View file

@ -13,12 +13,12 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.8">
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View file

@ -1,84 +0,0 @@
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Shared;
using System.Net;
namespace BMA.EHR.MetaData.Service
{
public class ErrorHandlerMiddleware
{
#region " Fields "
private readonly RequestDelegate _next;
#endregion
#region " Constructor and Destructor "
public ErrorHandlerMiddleware(RequestDelegate next)
{
_next = next;
}
#endregion
#region " Methods "
public async Task Invoke(HttpContext context)
{
try
{
await _next(context);
var response = context.Response;
response.ContentType = "application/json";
var responseModel = new ResponseObject();
responseModel.Status = response.StatusCode;
if (responseModel.Status == (int)HttpStatusCode.Unauthorized)
{
responseModel.Message = GlobalMessages.NotAuthorized;
await response.WriteAsJsonAsync(responseModel);
}
if (responseModel.Status == (int)HttpStatusCode.Forbidden)
{
responseModel.Message = GlobalMessages.ForbiddenAccess;
await response.WriteAsJsonAsync(responseModel);
}
}
catch (Exception error)
{
var response = context.Response;
response.ContentType = "application/json";
var responseModel = new ResponseObject();
responseModel.Status = response.StatusCode;
var msg = error.Message;
var inner = error.InnerException;
while (inner != null)
{
msg += $" {inner.Message}\r\n";
inner = inner.InnerException;
}
responseModel.Result = msg;
switch (response.StatusCode)
{
case (int)HttpStatusCode.Unauthorized:
responseModel.Message = GlobalMessages.NotAuthorized;
break;
case (int)HttpStatusCode.Forbidden:
responseModel.Message = GlobalMessages.ForbiddenAccess;
break;
default:
responseModel.Status = (int)HttpStatusCode.InternalServerError;
responseModel.Message = GlobalMessages.ExceptionOccured;
break;
}
await response.WriteAsJsonAsync(responseModel);
}
}
#endregion
}
}

View file

@ -1,5 +1,6 @@
using BMA.EHR.API.Command;
using BMA.EHR.Application;
using BMA.EHR.Domain.Middlewares;
using BMA.EHR.Infrastructure;
using BMA.EHR.Infrastructure.Persistence;
using BMA.EHR.MetaData.Service;
@ -111,7 +112,7 @@ var app = builder.Build();
app.MapHealthChecks("/health");
//app.UseMiddleware<ErrorHandlerMiddleware>();
app.UseMiddleware<ErrorHandlerMiddleware>();
app.UseHttpsRedirection();
app.UseCors();
app.UseAuthentication();

View file

@ -1,29 +1,36 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
}
}
}
},
"ElasticConfiguration": {
"Uri": "http://localhost:9200"
},
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
},
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial"
}
},
"Protocol": "HTTPS"
}
},
"ElasticConfiguration": {
"Uri": "http://localhost:9200"
},
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
},
"EPPlus": {
"ExcelPackage": {
"LicenseContext": "NonCommercial"
}
},
"MinIO": {
"Endpoint": "https://s3.frappet.com/",
"AccessKey": "frappet",
"SecretKey": "P@ssw0rd",
"BucketName": "bma-recruit"
},
"Protocol": "HTTPS"
}