Merge branch 'develop' into develop-tee
This commit is contained in:
commit
5393b8ca23
54 changed files with 28278 additions and 436 deletions
|
|
@ -1,25 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.S3" Version="3.7.107.5" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.API.Command
|
||||
{
|
||||
public static class CommandAPIRegistration
|
||||
{
|
||||
public static IMvcBuilder RegisterCommandControllers(this IMvcBuilder builder)
|
||||
{
|
||||
Assembly assembly = typeof(CommandAPIRegistration).Assembly;
|
||||
builder.AddApplicationPart(assembly);
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
namespace BMA.EHR.API.Command
|
||||
{
|
||||
public class FileDownloadResponse
|
||||
{
|
||||
public string FileName { get; set; } = string.Empty;
|
||||
|
||||
public string FileType { get; set; } = string.Empty;
|
||||
|
||||
public byte[] FileContent { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Partial.Test
|
||||
{
|
||||
public partial class PartialClass
|
||||
{
|
||||
public string GetString()
|
||||
{
|
||||
return "Return from class1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace BMA.EHR.API.Command
|
||||
{
|
||||
[Route("api/test")]
|
||||
[ApiController]
|
||||
public class TestController : BaseController
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult<ResponseObject> Get()
|
||||
{
|
||||
return Success("Test", new { data = "11111" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.Commands;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
|
|
@ -12,6 +13,7 @@ namespace BMA.EHR.Application
|
|||
services.AddTransient<PlacementRepository>();
|
||||
services.AddTransient<OrganizationEmployeeRepository>();
|
||||
services.AddTransient<MessageQueueRepository>();
|
||||
services.AddTransient<PlacementCommandRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Models.Commands;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Commands
|
||||
{
|
||||
public class PlacementCommandRepository : GenericRepository<Guid, PlacementCommand>
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destuctor "
|
||||
|
||||
public PlacementCommandRepository(IApplicationDBContext dbContext,
|
||||
IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
46
BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj
Normal file
46
BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>0d97b8e7-fe6d-44da-9b8f-1c24fae4e9e0</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
<RootNamespace>BMA.EHR.Command.Service</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.31.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="3.33.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
|
||||
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
84
BMA.EHR.Command.Service/ConfigureSwaggerOptions.cs
Normal file
84
BMA.EHR.Command.Service/ConfigureSwaggerOptions.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BMA.EHR.Command.Service
|
||||
{
|
||||
public class ConfigureSwaggerOptions : IConfigureNamedOptions<SwaggerGenOptions>
|
||||
{
|
||||
private readonly IApiVersionDescriptionProvider _provider;
|
||||
|
||||
public ConfigureSwaggerOptions(
|
||||
IApiVersionDescriptionProvider provider)
|
||||
{
|
||||
_provider = provider;
|
||||
}
|
||||
|
||||
public void Configure(SwaggerGenOptions options)
|
||||
{
|
||||
// add swagger document for every API version discovered
|
||||
foreach (var description in _provider.ApiVersionDescriptions)
|
||||
{
|
||||
options.EnableAnnotations();
|
||||
|
||||
options.SwaggerDoc(
|
||||
description.GroupName,
|
||||
CreateVersionInfo(description));
|
||||
}
|
||||
|
||||
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
|
||||
{
|
||||
In = ParameterLocation.Header,
|
||||
Description = "Please enter a valid token",
|
||||
Name = "Authorization",
|
||||
Type = SecuritySchemeType.Http,
|
||||
BearerFormat = "JWT",
|
||||
Scheme = "Bearer"
|
||||
});
|
||||
|
||||
options.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||
{
|
||||
{
|
||||
new OpenApiSecurityScheme
|
||||
{
|
||||
Reference = new OpenApiReference
|
||||
{
|
||||
Type = ReferenceType.SecurityScheme,
|
||||
Id = "Bearer"
|
||||
}
|
||||
},
|
||||
new string[]{}
|
||||
}
|
||||
});
|
||||
|
||||
// generate the XML docs that'll drive the swagger docs
|
||||
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||
options.IncludeXmlComments(xmlPath);
|
||||
}
|
||||
|
||||
public void Configure(string name, SwaggerGenOptions options)
|
||||
{
|
||||
Configure(options);
|
||||
}
|
||||
|
||||
private OpenApiInfo CreateVersionInfo(
|
||||
ApiVersionDescription desc)
|
||||
{
|
||||
var info = new OpenApiInfo()
|
||||
{
|
||||
Title = "BMA EHR Command Service Document",
|
||||
Version = desc.ApiVersion.ToString()
|
||||
};
|
||||
|
||||
if (desc.IsDeprecated)
|
||||
{
|
||||
info.Description += " This API version has been deprecated. Please use one of the new APIs available from the explorer.";
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
BMA.EHR.Command.Service/Dockerfile
Normal file
22
BMA.EHR.Command.Service/Dockerfile
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj", "BMA.EHR.Command.Service/"]
|
||||
RUN dotnet restore "BMA.EHR.Command.Service/BMA.EHR.Command.Service.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/BMA.EHR.Command.Service"
|
||||
RUN dotnet build "BMA.EHR.Command.Service.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "BMA.EHR.Command.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "BMA.EHR.Command.Service.dll"]
|
||||
161
BMA.EHR.Command.Service/Program.cs
Normal file
161
BMA.EHR.Command.Service/Program.cs
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
using BMA.EHR.Application;
|
||||
using BMA.EHR.Command.Service;
|
||||
using BMA.EHR.Domain.Middlewares;
|
||||
using BMA.EHR.Infrastructure;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using Microsoft.AspNetCore.Mvc.Versioning;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using Serilog;
|
||||
using Serilog.Exceptions;
|
||||
using Serilog.Sinks.Elasticsearch;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
{
|
||||
var issuer = builder.Configuration["Jwt:Issuer"];
|
||||
var key = builder.Configuration["Jwt:Key"];
|
||||
|
||||
|
||||
IdentityModelEventSource.ShowPII = true;
|
||||
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
builder.Services.AddApiVersioning(opt =>
|
||||
{
|
||||
opt.DefaultApiVersion = new ApiVersion(1, 0);
|
||||
opt.AssumeDefaultVersionWhenUnspecified = true;
|
||||
opt.ReportApiVersions = true;
|
||||
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(),
|
||||
new HeaderApiVersionReader("x-api-version"),
|
||||
new MediaTypeApiVersionReader("x-api-version"));
|
||||
});
|
||||
|
||||
builder.Services.AddVersionedApiExplorer(setup =>
|
||||
{
|
||||
setup.GroupNameFormat = "'v'VVV";
|
||||
setup.SubstituteApiVersionInUrl = true;
|
||||
});
|
||||
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
|
||||
// Authorization
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt =>
|
||||
{
|
||||
opt.RequireHttpsMetadata = false; //false for dev
|
||||
opt.Authority = issuer;
|
||||
opt.TokenValidationParameters = new()
|
||||
{
|
||||
ValidateIssuer = true,
|
||||
ValidateAudience = false,
|
||||
ValidateLifetime = true,
|
||||
ValidateIssuerSigningKey = true,
|
||||
ValidIssuer = issuer,
|
||||
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key))
|
||||
};
|
||||
});
|
||||
builder.Services.AddAuthorization();
|
||||
|
||||
// use serilog
|
||||
ConfigureLogs();
|
||||
builder.Host.UseSerilog();
|
||||
|
||||
// Add config CORS
|
||||
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||
{
|
||||
builder
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains();
|
||||
}));
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddApplication();
|
||||
builder.Services.AddPersistence(builder.Configuration);
|
||||
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
options.SuppressAsyncSuffixInActionNames = false;
|
||||
})
|
||||
.AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
||||
|
||||
builder.Services.AddSwaggerGen();
|
||||
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
|
||||
|
||||
builder.Services.AddHealthChecks();
|
||||
}
|
||||
|
||||
var app = builder.Build();
|
||||
{
|
||||
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI(options =>
|
||||
{
|
||||
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
|
||||
{
|
||||
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
|
||||
description.GroupName.ToUpperInvariant());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
await using var db = scope.ServiceProvider.GetRequiredService<ApplicationDBContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
|
||||
app.Run();
|
||||
}
|
||||
|
||||
void ConfigureLogs()
|
||||
{
|
||||
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile(
|
||||
$"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json",
|
||||
optional: true)
|
||||
.Build();
|
||||
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.Enrich.FromLogContext()
|
||||
.MinimumLevel.Error()
|
||||
.WriteTo.Console()
|
||||
.Enrich.WithExceptionDetails()
|
||||
.WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? ""))
|
||||
.Enrich.WithProperty("Environment", environment)
|
||||
.ReadFrom.Configuration(configuration)
|
||||
.CreateLogger();
|
||||
}
|
||||
|
||||
ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration, string environment)
|
||||
{
|
||||
return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? ""))
|
||||
{
|
||||
AutoRegisterTemplate = true,
|
||||
IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||
};
|
||||
}
|
||||
|
||||
48
BMA.EHR.Command.Service/Properties/launchSettings.json
Normal file
48
BMA.EHR.Command.Service/Properties/launchSettings.json
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5240"
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://localhost:7003;http://localhost:5240"
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Docker": {
|
||||
"commandName": "Docker",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
|
||||
"publishAllPorts": true,
|
||||
"useSSL": true
|
||||
}
|
||||
},
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:51682",
|
||||
"sslPort": 44303
|
||||
}
|
||||
}
|
||||
}
|
||||
8
BMA.EHR.Command.Service/appsettings.Development.json
Normal file
8
BMA.EHR.Command.Service/appsettings.Development.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
35
BMA.EHR.Command.Service/appsettings.json
Normal file
35
BMA.EHR.Command.Service/appsettings.json
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"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=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"
|
||||
}
|
||||
184
BMA.EHR.Command.Service/wwwroot/index.html
Normal file
184
BMA.EHR.Command.Service/wwwroot/index.html
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
<!--
|
||||
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
~ and other contributors as indicated by the @author tags.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<script src="./keycloak.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<button onclick="keycloak.login()">Login</button>
|
||||
<button onclick="keycloak.login({ action: 'UPDATE_PASSWORD' })">Update Password</button>
|
||||
<button onclick="keycloak.logout()">Logout</button>
|
||||
<button onclick="keycloak.register()">Register</button>
|
||||
<button onclick="keycloak.accountManagement()">Account</button>
|
||||
<button onclick="refreshToken(9999)">Refresh Token</button>
|
||||
<button onclick="refreshToken(30)">Refresh Token (if <30s validity)</button>
|
||||
<button onclick="loadProfile()">Get Profile</button>
|
||||
<button onclick="updateProfile()">Update profile</button>
|
||||
<button onclick="loadUserInfo()">Get User Info</button>
|
||||
<button onclick="output(keycloak.tokenParsed)">Show Token</button>
|
||||
<button onclick="output(keycloak.refreshTokenParsed)">Show Refresh Token</button>
|
||||
<button onclick="output(keycloak.idTokenParsed)">Show ID Token</button>
|
||||
<button onclick="showExpires()">Show Expires</button>
|
||||
<button onclick="output(keycloak)">Show Details</button>
|
||||
<button onclick="output(keycloak.createLoginUrl())">Show Login URL</button>
|
||||
<button onclick="output(keycloak.createLogoutUrl())">Show Logout URL</button>
|
||||
<button onclick="output(keycloak.createRegisterUrl())">Show Register URL</button>
|
||||
<button onclick="output(keycloak.createAccountUrl())">Show Account URL</button>
|
||||
|
||||
</div>
|
||||
|
||||
<h2>Result</h2>
|
||||
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="output"></pre>
|
||||
|
||||
<h2>Events</h2>
|
||||
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="events"></pre>
|
||||
|
||||
|
||||
<script>
|
||||
function loadProfile() {
|
||||
keycloak.loadUserProfile().success(function(profile) {
|
||||
output(profile);
|
||||
}).error(function() {
|
||||
output('Failed to load profile');
|
||||
});
|
||||
}
|
||||
|
||||
function updateProfile() {
|
||||
var url = keycloak.createAccountUrl().split('?')[0];
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('POST', url, true);
|
||||
req.setRequestHeader('Accept', 'application/json');
|
||||
req.setRequestHeader('Content-Type', 'application/json');
|
||||
req.setRequestHeader('Authorization', 'bearer ' + keycloak.token);
|
||||
|
||||
req.onreadystatechange = function () {
|
||||
if (req.readyState == 4) {
|
||||
if (req.status == 200) {
|
||||
output('Success');
|
||||
} else {
|
||||
output('Failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
req.send('{"email":"myemail@foo.bar","firstName":"test","lastName":"bar"}');
|
||||
}
|
||||
|
||||
function loadUserInfo() {
|
||||
keycloak.loadUserInfo().success(function(userInfo) {
|
||||
output(userInfo);
|
||||
}).error(function() {
|
||||
output('Failed to load user info');
|
||||
});
|
||||
}
|
||||
|
||||
function refreshToken(minValidity) {
|
||||
keycloak.updateToken(minValidity).then(function(refreshed) {
|
||||
if (refreshed) {
|
||||
output(keycloak.tokenParsed);
|
||||
} else {
|
||||
output('Token not refreshed, valid for ' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');
|
||||
}
|
||||
}).catch(function() {
|
||||
output('Failed to refresh token');
|
||||
});
|
||||
}
|
||||
|
||||
function showExpires() {
|
||||
if (!keycloak.tokenParsed) {
|
||||
output("Not authenticated");
|
||||
return;
|
||||
}
|
||||
|
||||
var o = 'Token Expires:\t\t' + new Date((keycloak.tokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||
o += 'Token Expires in:\t' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds\n';
|
||||
|
||||
if (keycloak.refreshTokenParsed) {
|
||||
o += 'Refresh Token Expires:\t' + new Date((keycloak.refreshTokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||
o += 'Refresh Expires in:\t' + Math.round(keycloak.refreshTokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds';
|
||||
}
|
||||
|
||||
output(o);
|
||||
}
|
||||
|
||||
function output(data) {
|
||||
if (typeof data === 'object') {
|
||||
data = JSON.stringify(data, null, ' ');
|
||||
}
|
||||
document.getElementById('output').innerHTML = data;
|
||||
}
|
||||
|
||||
function event(event) {
|
||||
var e = document.getElementById('events').innerHTML;
|
||||
document.getElementById('events').innerHTML = new Date().toLocaleString() + "\t" + event + "\n" + e;
|
||||
}
|
||||
|
||||
var keycloak = Keycloak();
|
||||
|
||||
keycloak.onAuthSuccess = function () {
|
||||
event('Auth Success');
|
||||
};
|
||||
|
||||
keycloak.onAuthError = function (errorData) {
|
||||
event("Auth Error: " + JSON.stringify(errorData) );
|
||||
};
|
||||
|
||||
keycloak.onAuthRefreshSuccess = function () {
|
||||
event('Auth Refresh Success');
|
||||
};
|
||||
|
||||
keycloak.onAuthRefreshError = function () {
|
||||
event('Auth Refresh Error');
|
||||
};
|
||||
|
||||
keycloak.onAuthLogout = function () {
|
||||
event('Auth Logout');
|
||||
};
|
||||
|
||||
keycloak.onTokenExpired = function () {
|
||||
event('Access token expired.');
|
||||
};
|
||||
|
||||
keycloak.onActionUpdate = function (status) {
|
||||
switch (status) {
|
||||
case 'success':
|
||||
event('Action completed successfully'); break;
|
||||
case 'cancelled':
|
||||
event('Action cancelled by user'); break;
|
||||
case 'error':
|
||||
event('Action failed'); break;
|
||||
}
|
||||
};
|
||||
|
||||
// Flow can be changed to 'implicit' or 'hybrid', but then client must enable implicit flow in admin console too
|
||||
var initOptions = {
|
||||
responseMode: 'fragment',
|
||||
flow: 'standard'
|
||||
};
|
||||
|
||||
keycloak.init(initOptions).then(function(authenticated) {
|
||||
output('Init Success (' + (authenticated ? 'Authenticated' : 'Not Authenticated') + ')');
|
||||
}).catch(function() {
|
||||
output('Init Error');
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
1766
BMA.EHR.Command.Service/wwwroot/keycloak.js
Normal file
1766
BMA.EHR.Command.Service/wwwroot/keycloak.js
Normal file
File diff suppressed because one or more lines are too long
7
BMA.EHR.Command.Service/wwwroot/keycloak.json
Normal file
7
BMA.EHR.Command.Service/wwwroot/keycloak.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"realm": "bma-ehr",
|
||||
"auth-server-url": "https://identity.frappet.com",
|
||||
"ssl-required": "external",
|
||||
"resource": "bma-ehr",
|
||||
"public-client": true
|
||||
}
|
||||
|
|
@ -31,18 +31,20 @@ namespace BMA.EHR.Domain.Middlewares
|
|||
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)
|
||||
{
|
||||
response.ContentType = "application/json";
|
||||
responseModel.Message = GlobalMessages.NotAuthorized;
|
||||
await response.WriteAsJsonAsync(responseModel);
|
||||
}
|
||||
if (responseModel.Status == (int)HttpStatusCode.Forbidden)
|
||||
{
|
||||
response.ContentType = "application/json";
|
||||
responseModel.Message = GlobalMessages.ForbiddenAccess;
|
||||
await response.WriteAsJsonAsync(responseModel);
|
||||
}
|
||||
|
|
|
|||
44
BMA.EHR.Domain/Models/Commands/Core/Command.cs
Normal file
44
BMA.EHR.Domain/Models/Commands/Core/Command.cs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
public abstract class Command : EntityBase
|
||||
{
|
||||
[MaxLength(10), Comment("เลขที่คำสั่ง")]
|
||||
public string CommandNo { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(4), Comment("ปีที่ออกคำสั่ง")]
|
||||
public string CommandYear { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("รหัสอ้างอิงประเภทคำสั่ง")]
|
||||
public Guid CommandTypeId { get; set; } = Guid.Empty;
|
||||
|
||||
public CommandType CommandType { get; set; }
|
||||
|
||||
[Required, Comment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง")]
|
||||
public Guid IssuerOrganizationId { get; set; } = Guid.Empty;
|
||||
|
||||
[Required, Comment("หน่วยงานที่ออกคำสั่ง")]
|
||||
public string IssuerOrganizationName { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("รหัสอ้างอิงสถานะคำสั่ง")]
|
||||
public Guid CommandStatusId { get; set; } = Guid.Empty;
|
||||
|
||||
public CommandStatus CommandStatus { get; set; }
|
||||
|
||||
[Required, Comment("รหัสอ้างอิงผู้มีอำนาจลงนาม")]
|
||||
public Guid AuthorizedUserId { get; set; } = Guid.Empty;
|
||||
|
||||
[Required, Comment("ชื่อผู้มีอำนาจลงนาม")]
|
||||
public string AuthorizedUserFullName { get; set; } = string.Empty;
|
||||
|
||||
public virtual List<CommandDocument> Documents { get; set; } = new();
|
||||
}
|
||||
}
|
||||
19
BMA.EHR.Domain/Models/Commands/Core/CommandDocument.cs
Normal file
19
BMA.EHR.Domain/Models/Commands/Core/CommandDocument.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
public class CommandDocument : EntityBase
|
||||
{
|
||||
[Required, Comment("ประเภทเอกสาร")]
|
||||
public string Category { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("อ้างอิงรหัสเอกสาร")]
|
||||
public Document Document { get; set; }
|
||||
|
||||
[Required, Comment("อ้างอิงคำสั่ง")]
|
||||
public virtual Command Command { get; set; }
|
||||
}
|
||||
}
|
||||
12
BMA.EHR.Domain/Models/Commands/Core/CommandStatus.cs
Normal file
12
BMA.EHR.Domain/Models/Commands/Core/CommandStatus.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
public class CommandStatus : EntityBase
|
||||
{
|
||||
[Required, MaxLength(100), Comment("สถานะของคำสั่ง")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
15
BMA.EHR.Domain/Models/Commands/Core/CommandType.cs
Normal file
15
BMA.EHR.Domain/Models/Commands/Core/CommandType.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
public class CommandType : EntityBase
|
||||
{
|
||||
[Required, MaxLength(200), Comment("ชื่อคำสั่ง")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[Required, MaxLength(100), Comment("ประเภทคำสั่ง")]
|
||||
public string Category { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
public class DeploymentChannel : EntityBase
|
||||
{
|
||||
32
BMA.EHR.Domain/Models/Commands/PlacementCommand.cs
Normal file
32
BMA.EHR.Domain/Models/Commands/PlacementCommand.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands
|
||||
{
|
||||
public class PlacementCommand : Command
|
||||
{
|
||||
[Required, Comment("อ้างอิงรอบการสอบ")]
|
||||
public Guid ExamRoundId { get; set; }
|
||||
|
||||
[Required, Comment("ตำแหน่งที่บรรจุ")]
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)")]
|
||||
public string ConclusionRegisterNo { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)")]
|
||||
public DateTime ConclusionRegisterDate { get; set; } = DateTime.Now;
|
||||
|
||||
[Required, Comment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)")]
|
||||
public string ConclusionResultNo { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)")]
|
||||
public DateTime ConclusionResultDate { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
11258
BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.Designer.cs
generated
Normal file
11258
BMA.EHR.Infrastructure/Migrations/20230713075242_Add Placement Command Table and Command Core Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,198 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPlacementCommandTableandCommandCoreTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CommandStatuses",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "สถานะของคำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CommandStatuses", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CommandTypes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Name = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อคำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Category = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ประเภทคำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CommandTypes", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BaseCommand",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CommandNo = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: false, comment: "เลขที่คำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CommandYear = table.Column<string>(type: "varchar(4)", maxLength: 4, nullable: false, comment: "ปีที่ออกคำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CommandTypeId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงประเภทคำสั่ง", collation: "ascii_general_ci"),
|
||||
IssuerOrganizationId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง", collation: "ascii_general_ci"),
|
||||
IssuerOrganizationName = table.Column<string>(type: "longtext", nullable: false, comment: "หน่วยงานที่ออกคำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CommandStatusId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงสถานะคำสั่ง", collation: "ascii_general_ci"),
|
||||
AuthorizedUserId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงผู้มีอำนาจลงนาม", collation: "ascii_general_ci"),
|
||||
AuthorizedUserFullName = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อผู้มีอำนาจลงนาม")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Discriminator = table.Column<string>(type: "longtext", nullable: false)
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ExamRoundId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "อ้างอิงรอบการสอบ", collation: "ascii_general_ci"),
|
||||
PositionName = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่งที่บรรจุ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ConclusionRegisterNo = table.Column<string>(type: "longtext", nullable: true, comment: "มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ConclusionRegisterDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ลงวันที่ (เรื่อง รับสมัครสอบฯ)"),
|
||||
ConclusionResultNo = table.Column<string>(type: "longtext", nullable: true, comment: "มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
ConclusionResultDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BaseCommand", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BaseCommand_CommandStatuses_CommandStatusId",
|
||||
column: x => x.CommandStatusId,
|
||||
principalTable: "CommandStatuses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_BaseCommand_CommandTypes_CommandTypeId",
|
||||
column: x => x.CommandTypeId,
|
||||
principalTable: "CommandTypes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CommandDocuments",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Category = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภทเอกสาร")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||
CommandId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CommandDocuments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CommandDocuments_BaseCommand_CommandId",
|
||||
column: x => x.CommandId,
|
||||
principalTable: "BaseCommand",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CommandDocuments_Documents_DocumentId",
|
||||
column: x => x.DocumentId,
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BaseCommand_CommandStatusId",
|
||||
table: "BaseCommand",
|
||||
column: "CommandStatusId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BaseCommand_CommandTypeId",
|
||||
table: "BaseCommand",
|
||||
column: "CommandTypeId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CommandDocuments_CommandId",
|
||||
table: "CommandDocuments",
|
||||
column: "CommandId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CommandDocuments_DocumentId",
|
||||
table: "CommandDocuments",
|
||||
column: "DocumentId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CommandDocuments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BaseCommand");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CommandStatuses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CommandTypes");
|
||||
}
|
||||
}
|
||||
}
|
||||
11258
BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.Designer.cs
generated
Normal file
11258
BMA.EHR.Infrastructure/Migrations/20230713075919_Change Base Command Table Name.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,136 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ChangeBaseCommandTableName : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_BaseCommand_CommandStatuses_CommandStatusId",
|
||||
table: "BaseCommand");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_BaseCommand_CommandTypes_CommandTypeId",
|
||||
table: "BaseCommand");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CommandDocuments_BaseCommand_CommandId",
|
||||
table: "CommandDocuments");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_BaseCommand",
|
||||
table: "BaseCommand");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "BaseCommand",
|
||||
newName: "Command");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_BaseCommand_CommandTypeId",
|
||||
table: "Command",
|
||||
newName: "IX_Command_CommandTypeId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_BaseCommand_CommandStatusId",
|
||||
table: "Command",
|
||||
newName: "IX_Command_CommandStatusId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_Command",
|
||||
table: "Command",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Command_CommandStatuses_CommandStatusId",
|
||||
table: "Command",
|
||||
column: "CommandStatusId",
|
||||
principalTable: "CommandStatuses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Command_CommandTypes_CommandTypeId",
|
||||
table: "Command",
|
||||
column: "CommandTypeId",
|
||||
principalTable: "CommandTypes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CommandDocuments_Command_CommandId",
|
||||
table: "CommandDocuments",
|
||||
column: "CommandId",
|
||||
principalTable: "Command",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Command_CommandStatuses_CommandStatusId",
|
||||
table: "Command");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Command_CommandTypes_CommandTypeId",
|
||||
table: "Command");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CommandDocuments_Command_CommandId",
|
||||
table: "CommandDocuments");
|
||||
|
||||
migrationBuilder.DropPrimaryKey(
|
||||
name: "PK_Command",
|
||||
table: "Command");
|
||||
|
||||
migrationBuilder.RenameTable(
|
||||
name: "Command",
|
||||
newName: "BaseCommand");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Command_CommandTypeId",
|
||||
table: "BaseCommand",
|
||||
newName: "IX_BaseCommand_CommandTypeId");
|
||||
|
||||
migrationBuilder.RenameIndex(
|
||||
name: "IX_Command_CommandStatusId",
|
||||
table: "BaseCommand",
|
||||
newName: "IX_BaseCommand_CommandStatusId");
|
||||
|
||||
migrationBuilder.AddPrimaryKey(
|
||||
name: "PK_BaseCommand",
|
||||
table: "BaseCommand",
|
||||
column: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_BaseCommand_CommandStatuses_CommandStatusId",
|
||||
table: "BaseCommand",
|
||||
column: "CommandStatusId",
|
||||
principalTable: "CommandStatuses",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_BaseCommand_CommandTypes_CommandTypeId",
|
||||
table: "BaseCommand",
|
||||
column: "CommandTypeId",
|
||||
principalTable: "CommandTypes",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CommandDocuments_BaseCommand_CommandId",
|
||||
table: "CommandDocuments",
|
||||
column: "CommandId",
|
||||
principalTable: "BaseCommand",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -16,10 +16,301 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.8")
|
||||
.HasAnnotation("ProductVersion", "7.0.9")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.DeploymentChannel", b =>
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("AuthorizedUserFullName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ชื่อผู้มีอำนาจลงนาม");
|
||||
|
||||
b.Property<Guid>("AuthorizedUserId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม");
|
||||
|
||||
b.Property<string>("CommandNo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("varchar(10)")
|
||||
.HasComment("เลขที่คำสั่ง");
|
||||
|
||||
b.Property<Guid>("CommandStatusId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสอ้างอิงสถานะคำสั่ง");
|
||||
|
||||
b.Property<Guid>("CommandTypeId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสอ้างอิงประเภทคำสั่ง");
|
||||
|
||||
b.Property<string>("CommandYear")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4)
|
||||
.HasColumnType("varchar(4)")
|
||||
.HasComment("ปีที่ออกคำสั่ง");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid>("IssuerOrganizationId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสอ้างอิงหน่วยงานที่ออกคำสั่ง");
|
||||
|
||||
b.Property<string>("IssuerOrganizationName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("หน่วยงานที่ออกคำสั่ง");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CommandStatusId");
|
||||
|
||||
b.HasIndex("CommandTypeId");
|
||||
|
||||
b.ToTable("Command");
|
||||
|
||||
b.HasDiscriminator<string>("Discriminator").HasValue("Command");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ประเภทเอกสาร");
|
||||
|
||||
b.Property<Guid>("CommandId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<Guid>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CommandId");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.ToTable("CommandDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasComment("สถานะของคำสั่ง");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("CommandStatuses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandType", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasComment("ประเภทคำสั่ง");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasComment("ชื่อคำสั่ง");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("CommandTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.DeploymentChannel", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
|
@ -7326,6 +7617,106 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("SubDistricts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<bool>("IsSend")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ทำการส่งข้อความแล้วหรือยัง?");
|
||||
|
||||
b.Property<bool>("IsSendEmail")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งอีเมลล์หรือไม่?");
|
||||
|
||||
b.Property<bool>("IsSendInbox")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งไปที่กล่องข้อความหรือไม่?");
|
||||
|
||||
b.Property<bool>("IsSendNotification")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งการแจ้งเตือนหรือไม่?");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("MessageContent")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("รายละเอียดข้อความ");
|
||||
|
||||
b.Property<string>("MessagePayLoad")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สิ่งที่แนบมาด้วย");
|
||||
|
||||
b.Property<string>("ReceiverEmailAddress")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)")
|
||||
.HasComment("อีเมล์ของผู้รับ");
|
||||
|
||||
b.Property<Guid>("ReceiverUserId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสของผู้รับข้อความ");
|
||||
|
||||
b.Property<string>("SenderSystem")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasComment("ส่งจากระบบงาน");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasComment("หัวเรื่อง");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("MessageQueues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -7485,7 +7876,7 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("OrganizationEmployees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
|
|
@ -7532,85 +7923,21 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<bool>("IsSend")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ทำการส่งข้อความแล้วหรือยัง?");
|
||||
b.Property<Guid?>("OrganizationEmployeeId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsSendEmail")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งอีเมลล์หรือไม่?");
|
||||
b.Property<Guid?>("PositionEmployeeLevelId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<bool>("IsSendInbox")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งไปที่กล่องข้อความหรือไม่?");
|
||||
b.HasKey("Id");
|
||||
|
||||
b.Property<bool>("IsSendNotification")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งการแจ้งเตือนหรือไม่?");
|
||||
b.HasIndex("OrganizationEmployeeId");
|
||||
|
||||
b.HasIndex("PositionEmployeeLevelId");
|
||||
|
||||
b.ToTable("OrganizationPositionEmployeeLevels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<Guid?>("OrganizationEmployeeId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("PositionEmployeeLevelId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OrganizationEmployeeId");
|
||||
|
||||
b.HasIndex("PositionEmployeeLevelId");
|
||||
|
||||
b.ToTable("OrganizationPositionEmployeeLevels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -7671,41 +7998,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.HasIndex("PositionEmployeePositionSideId");
|
||||
|
||||
b.ToTable("OrganizationPositionEmployeePositionSides");
|
||||
b.Property<string>("MessageContent")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("รายละเอียดข้อความ");
|
||||
|
||||
b.Property<string>("MessagePayLoad")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("สิ่งที่แนบมาด้วย");
|
||||
|
||||
b.Property<string>("ReceiverEmailAddress")
|
||||
.IsRequired()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("varchar(500)")
|
||||
.HasComment("อีเมล์ของผู้รับ");
|
||||
|
||||
b.Property<Guid>("ReceiverUserId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสของผู้รับข้อความ");
|
||||
|
||||
b.Property<string>("SenderSystem")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasComment("ส่งจากระบบงาน");
|
||||
|
||||
b.Property<string>("Subject")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasComment("หัวเรื่อง");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("MessageQueues");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
|
||||
|
|
@ -9680,6 +9972,78 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("PlacementTypes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.PlacementCommand", b =>
|
||||
{
|
||||
b.HasBaseType("BMA.EHR.Domain.Models.Commands.Core.Command");
|
||||
|
||||
b.Property<DateTime>("ConclusionRegisterDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
|
||||
|
||||
b.Property<string>("ConclusionRegisterNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)");
|
||||
|
||||
b.Property<DateTime>("ConclusionResultDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
|
||||
|
||||
b.Property<string>("ConclusionResultNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)");
|
||||
|
||||
b.Property<Guid>("ExamRoundId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("อ้างอิงรอบการสอบ");
|
||||
|
||||
b.Property<string>("PositionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("ตำแหน่งที่บรรจุ");
|
||||
|
||||
b.HasDiscriminator().HasValue("PlacementCommand");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus")
|
||||
.WithMany()
|
||||
.HasForeignKey("CommandStatusId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandType", "CommandType")
|
||||
.WithMany()
|
||||
.HasForeignKey("CommandTypeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CommandStatus");
|
||||
|
||||
b.Navigation("CommandType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command")
|
||||
.WithMany("Documents")
|
||||
.HasForeignKey("CommandId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Command");
|
||||
|
||||
b.Navigation("Document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
|
||||
|
|
@ -10695,6 +11059,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("Religion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
|
||||
{
|
||||
b.Navigation("Documents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
|
||||
{
|
||||
b.Navigation("LimitTypeLeaves");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Models.Commands;
|
||||
using BMA.EHR.Domain.Models.Documents;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.MetaData;
|
||||
|
|
@ -9,6 +8,8 @@ using BMA.EHR.Domain.Models.Organizations;
|
|||
using BMA.EHR.Domain.Models.Organizations.Report2;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using BMA.EHR.Domain.Models.Commands;
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Persistence
|
||||
{
|
||||
|
|
@ -261,8 +262,17 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
|
||||
#region " Command "
|
||||
|
||||
public DbSet<CommandStatus> CommandStatuses { get; set; }
|
||||
|
||||
public DbSet<CommandType> CommandTypes { get; set; }
|
||||
|
||||
public DbSet<CommandDocument> CommandDocuments { get; set; }
|
||||
|
||||
public DbSet<DeploymentChannel> DeploymentChannels { get; set; }
|
||||
|
||||
|
||||
public DbSet<PlacementCommand> PlacementCommands { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Message Queue "
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aba35659-832c-421f-a7c1-80acb6ab6f0c</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
<RootNamespace>BMA.EHR.MetaData.Service</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
<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.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.31.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="3.33.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
|
||||
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -37,7 +37,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.API.Command\BMA.EHR.API.Command.csproj" />
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using BMA.EHR.API.Command;
|
||||
using BMA.EHR.Application;
|
||||
using BMA.EHR.Domain.Middlewares;
|
||||
using BMA.EHR.Infrastructure;
|
||||
|
|
@ -112,7 +111,7 @@ var app = builder.Build();
|
|||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
|
@ -120,9 +119,10 @@ var app = builder.Build();
|
|||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
await using var db = scope.ServiceProvider.GetRequiredService<ApplicationDBContext>();
|
||||
await db.Database.MigrateAsync();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +1,35 @@
|
|||
{
|
||||
"Serilog": {
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Information",
|
||||
"System": "Warning"
|
||||
"MinimumLevel": {
|
||||
"Default": "Information",
|
||||
"Override": {
|
||||
"Microsoft": "Information",
|
||||
"System": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ElasticConfiguration": {
|
||||
"Uri": "http://localhost:9200"
|
||||
"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;"
|
||||
//"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"
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||
},
|
||||
"EPPlus": {
|
||||
"ExcelPackage": {
|
||||
"LicenseContext": "NonCommercial"
|
||||
}
|
||||
"ExcelPackage": {
|
||||
"LicenseContext": "NonCommercial"
|
||||
}
|
||||
},
|
||||
"MinIO": {
|
||||
"Endpoint": "https://s3.frappet.com/",
|
||||
"AccessKey": "frappet",
|
||||
"SecretKey": "P@ssw0rd",
|
||||
"BucketName": "bma-recruit"
|
||||
"Endpoint": "https://s3.frappet.com/",
|
||||
"AccessKey": "frappet",
|
||||
"SecretKey": "P@ssw0rd",
|
||||
"BucketName": "bma-recruit"
|
||||
},
|
||||
"Protocol": "HTTPS"
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>3d68209a-41b1-4d00-914e-b895d74467c0</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
<RootNamespace>BMA.EHR.OrganizationEmployee.Service</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.32.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="3.33.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
|
||||
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.API.Command\BMA.EHR.API.Command.csproj" />
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,12 @@ EXPOSE 443
|
|||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
COPY ["BMA.EHR.Domain/BMA.EHR.Domain.csproj", "BMA.EHR.Domain/"]
|
||||
COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
|
||||
COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
|
||||
COPY ["BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj", "BMA.EHR.OrganizationEmployee.Service/"]
|
||||
|
||||
RUN dotnet restore "BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/BMA.EHR.OrganizationEmployee.Service"
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using System.Net;
|
||||
|
||||
namespace BMA.EHR.OrganizationEmployee.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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Application;
|
||||
using BMA.EHR.Domain.Middlewares;
|
||||
using BMA.EHR.Infrastructure;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.OrganizationEmployee.Service;
|
||||
|
|
@ -110,14 +111,16 @@ var app = builder.Build();
|
|||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
//app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
"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;"
|
||||
"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",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>9d934a68-d1dd-449d-bde0-3078a774ad0f</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
<RootNamespace>BMA.EHR.Placement.Service</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.31.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="3.33.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
|
||||
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.API.Command\BMA.EHR.API.Command.csproj" />
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ using System.Security.Cryptography;
|
|||
namespace BMA.EHR.Placement.Service.Controllers
|
||||
{
|
||||
[Route("api/v{version:apiVersion}/placement")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
[Produces("application/json")]
|
||||
[Authorize]
|
||||
[SwaggerTag("ระบบบรรจุ")]
|
||||
public class PlacementController : BaseController
|
||||
{
|
||||
|
|
@ -316,9 +316,82 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
ExamRound = x.ExamRound,
|
||||
Pass = x.Pass,
|
||||
IsProperty = x.IsProperty == null ? null : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PersonPropertyRequest>>(x.IsProperty),
|
||||
BmaOfficer = "",
|
||||
}).FirstOrDefaultAsync(x => x.PersonalId == personalId);
|
||||
|
||||
return Success(data);
|
||||
var _data = new
|
||||
{
|
||||
data.PersonalId,
|
||||
data.IdCard,
|
||||
data.Prefix,
|
||||
data.PrefixId,
|
||||
data.FullName,
|
||||
data.Firstname,
|
||||
data.Lastname,
|
||||
data.Nationality,
|
||||
data.Race,
|
||||
data.DateOfBirth,
|
||||
data.Age,
|
||||
data.Telephone,
|
||||
data.Gender,
|
||||
data.GenderId,
|
||||
data.Relationship,
|
||||
data.RelationshipId,
|
||||
data.BloodGroup,
|
||||
data.BloodGroupId,
|
||||
data.Religion,
|
||||
data.ReligionId,
|
||||
data.Address,
|
||||
data.Education,
|
||||
data.RegistAddress,
|
||||
data.RegistSubDistrict,
|
||||
data.RegistSubDistrictId,
|
||||
data.RegistZipCode,
|
||||
data.RegistDistrict,
|
||||
data.RegistDistrictId,
|
||||
data.RegistProvince,
|
||||
data.RegistProvinceId,
|
||||
data.CurrentAddress,
|
||||
data.CurrentSubDistrict,
|
||||
data.CurrentSubDistrictId,
|
||||
data.CurrentZipCode,
|
||||
data.CurrentDistrict,
|
||||
data.CurrentDistrictId,
|
||||
data.CurrentProvince,
|
||||
data.CurrentProvinceId,
|
||||
data.RegistSame,
|
||||
data.MarryPrefix,
|
||||
data.MarryPrefixId,
|
||||
data.Couple,
|
||||
data.MarryFirstName,
|
||||
data.MarryLastName,
|
||||
data.MarryOccupation,
|
||||
data.FatherPrefix,
|
||||
data.FatherPrefixId,
|
||||
data.FatherFirstName,
|
||||
data.FatherLastName,
|
||||
data.FatherOccupation,
|
||||
data.MotherPrefix,
|
||||
data.MotherPrefixId,
|
||||
data.MotherFirstName,
|
||||
data.MotherLastName,
|
||||
data.MotherOccupation,
|
||||
data.Certificates,
|
||||
data.PointA,
|
||||
data.PointB,
|
||||
data.PointC,
|
||||
data.PointTotalA,
|
||||
data.PointTotalB,
|
||||
data.PointTotalC,
|
||||
data.Point,
|
||||
data.PointTotal,
|
||||
data.ExamNumber,
|
||||
data.ExamRound,
|
||||
data.Pass,
|
||||
data.IsProperty,
|
||||
BmaOfficer = await _documentService.CheckBmaOfficer(data.IdCard),
|
||||
};
|
||||
return Success(_data);
|
||||
}
|
||||
|
||||
[HttpPut("property/{personalId:length(36)}")]
|
||||
|
|
@ -647,7 +720,8 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Error(GlobalMessages.ProvinceNotFound, 404);
|
||||
person.CurrentProvince = save;
|
||||
}
|
||||
|
||||
person.CurrentAddress = req.CurrentAddress;
|
||||
person.RegistAddress = req.RegistrationAddress;
|
||||
person.RegistSame = req.RegistrationSame;
|
||||
person.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
person.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -719,6 +793,36 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
[HttpPost("certificate/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> CreateCertificate([FromBody] PersonCertificateRequest req, Guid personalId)
|
||||
{
|
||||
var person = await _context.PlacementProfiles
|
||||
.Include(x => x.PlacementCertificates)
|
||||
.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var data = new PlacementCertificate
|
||||
{
|
||||
PlacementProfile = person,
|
||||
CertificateNo = req.CertificateNo,
|
||||
Issuer = req.Issuer,
|
||||
IssueDate = req.IssueDate,
|
||||
ExpireDate = req.ExpireDate,
|
||||
CertificateType = req.CertificateType,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.PlacementCertificates.AddAsync(data);
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpPut("certificate/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateCertificate([FromBody] PersonCertificateRequest req, Guid personalId)
|
||||
{
|
||||
|
|
@ -728,39 +832,17 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
if (person == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
if (req.Id == null)
|
||||
{
|
||||
var data = new PlacementCertificate
|
||||
{
|
||||
PlacementProfile = person,
|
||||
CertificateNo = req.CertificateNo,
|
||||
Issuer = req.Issuer,
|
||||
IssueDate = req.IssueDate,
|
||||
ExpireDate = req.ExpireDate,
|
||||
CertificateType = req.CertificateType,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.PlacementCertificates.AddAsync(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
var certificate = person.PlacementCertificates.FirstOrDefault(x => x.Id == req.Id);
|
||||
if (certificate == null)
|
||||
return Error(GlobalMessages.CertificateNotFound, 404);
|
||||
certificate.CertificateNo = req.CertificateNo;
|
||||
certificate.Issuer = req.Issuer;
|
||||
certificate.IssueDate = req.IssueDate;
|
||||
certificate.ExpireDate = req.ExpireDate;
|
||||
certificate.CertificateType = req.CertificateType;
|
||||
certificate.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
certificate.LastUpdateUserId = UserId ?? "";
|
||||
certificate.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
var certificate = person.PlacementCertificates.FirstOrDefault(x => x.Id == req.Id);
|
||||
if (certificate == null)
|
||||
return Error(GlobalMessages.CertificateNotFound, 404);
|
||||
certificate.CertificateNo = req.CertificateNo;
|
||||
certificate.Issuer = req.Issuer;
|
||||
certificate.IssueDate = req.IssueDate;
|
||||
certificate.ExpireDate = req.ExpireDate;
|
||||
certificate.CertificateType = req.CertificateType;
|
||||
certificate.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
certificate.LastUpdateUserId = UserId ?? "";
|
||||
certificate.LastUpdatedAt = DateTime.Now;
|
||||
_context.SaveChanges();
|
||||
|
||||
return Success();
|
||||
|
|
@ -783,12 +865,9 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
[HttpPut("education/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
|
||||
[HttpPost("education/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> CreateEducation([FromBody] PersonEducationRequest req, Guid personalId)
|
||||
{
|
||||
// var education = await _context.PlacementEducations
|
||||
// .Include(x => x.PlacementProfile)
|
||||
// .FirstOrDefaultAsync(x => x.Id == personalId);
|
||||
var profile = await _context.PlacementProfiles.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
|
@ -801,58 +880,71 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
if (positionPath == null && req.PositionPathId != null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
if (req.Id == null)
|
||||
var data = new PlacementEducation
|
||||
{
|
||||
var data = new PlacementEducation
|
||||
{
|
||||
PlacementProfile = profile,
|
||||
EducationLevel = educationLevel,
|
||||
PositionPath = positionPath,
|
||||
Institute = req.Institute,
|
||||
Degree = req.Degree,
|
||||
Field = req.Field,
|
||||
Gpa = req.Gpa,
|
||||
Country = req.Country,
|
||||
Duration = req.Duration,
|
||||
DurationYear = req.DurationYear,
|
||||
Other = req.Other,
|
||||
FundName = req.FundName,
|
||||
FinishDate = req.FinishDate,
|
||||
StartDate = req.StartDate,
|
||||
EndDate = req.EndDate,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.PlacementEducations.AddAsync(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
var education = await _context.PlacementEducations.FirstOrDefaultAsync(x => x.Id == req.Id);
|
||||
if (education == null)
|
||||
return Error(GlobalMessages.EducationNotFound, 404);
|
||||
PlacementProfile = profile,
|
||||
EducationLevel = educationLevel,
|
||||
PositionPath = positionPath,
|
||||
Institute = req.Institute,
|
||||
Degree = req.Degree,
|
||||
Field = req.Field,
|
||||
Gpa = req.Gpa,
|
||||
Country = req.Country,
|
||||
Duration = req.Duration,
|
||||
DurationYear = req.DurationYear,
|
||||
Other = req.Other,
|
||||
FundName = req.FundName,
|
||||
FinishDate = req.FinishDate,
|
||||
StartDate = req.StartDate,
|
||||
EndDate = req.EndDate,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
};
|
||||
await _context.PlacementEducations.AddAsync(data);
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
||||
education.EducationLevel = educationLevel;
|
||||
education.PositionPath = positionPath;
|
||||
education.Institute = req.Institute;
|
||||
education.Degree = req.Degree;
|
||||
education.Field = req.Field;
|
||||
education.Gpa = req.Gpa;
|
||||
education.Country = req.Country;
|
||||
education.Duration = req.Duration;
|
||||
education.DurationYear = req.DurationYear;
|
||||
education.Other = req.Other;
|
||||
education.FundName = req.FundName;
|
||||
education.FinishDate = req.FinishDate;
|
||||
education.StartDate = req.StartDate;
|
||||
education.EndDate = req.EndDate;
|
||||
education.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
education.LastUpdateUserId = UserId ?? "";
|
||||
education.LastUpdatedAt = DateTime.Now;
|
||||
}
|
||||
[HttpPut("education/{personalId:length(36)}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateEducation([FromBody] PersonEducationRequest req, Guid personalId)
|
||||
{
|
||||
var profile = await _context.PlacementProfiles.FirstOrDefaultAsync(x => x.Id == personalId);
|
||||
if (profile == null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
|
||||
if (educationLevel == null && req.EducationLevelId != null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
|
||||
if (positionPath == null && req.PositionPathId != null)
|
||||
return Error(GlobalMessages.DataNotFound, 404);
|
||||
|
||||
var education = await _context.PlacementEducations.FirstOrDefaultAsync(x => x.Id == req.Id);
|
||||
if (education == null)
|
||||
return Error(GlobalMessages.EducationNotFound, 404);
|
||||
|
||||
education.EducationLevel = educationLevel;
|
||||
education.PositionPath = positionPath;
|
||||
education.Institute = req.Institute;
|
||||
education.Degree = req.Degree;
|
||||
education.Field = req.Field;
|
||||
education.Gpa = req.Gpa;
|
||||
education.Country = req.Country;
|
||||
education.Duration = req.Duration;
|
||||
education.DurationYear = req.DurationYear;
|
||||
education.Other = req.Other;
|
||||
education.FundName = req.FundName;
|
||||
education.FinishDate = req.FinishDate;
|
||||
education.StartDate = req.StartDate;
|
||||
education.EndDate = req.EndDate;
|
||||
education.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
education.LastUpdateUserId = UserId ?? "";
|
||||
education.LastUpdatedAt = DateTime.Now;
|
||||
await _context.SaveChangesAsync();
|
||||
return Success();
|
||||
}
|
||||
|
|
@ -869,5 +961,16 @@ namespace BMA.EHR.Placement.Service.Controllers
|
|||
return Success();
|
||||
}
|
||||
|
||||
[HttpGet("position/use")]
|
||||
public async Task<ActionResult<ResponseObject>> GetPositionUse()
|
||||
{
|
||||
var position = await _context.PlacementProfiles
|
||||
.Where(x => x.PositionNumber != null)
|
||||
.Select(x => x.PositionNumber.Id)
|
||||
.ToListAsync();
|
||||
|
||||
return Success(position);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,12 @@ EXPOSE 443
|
|||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
COPY ["BMA.EHR.Application.csproj", "./BMA.EHR.Application"]
|
||||
COPY ["BMA.EHR.Domain.csproj", "./BMA.EHR.Domain"]
|
||||
COPY ["BMA.EHR.Infrastructure.csproj", "./BMA.EHR.Infrastructure"]
|
||||
COPY ["BMA.EHR.Domain/BMA.EHR.Domain.csproj", "BMA.EHR.Domain/"]
|
||||
COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
|
||||
COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
|
||||
COPY ["BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj", "BMA.EHR.Placement.Service/"]
|
||||
|
||||
COPY ["BMA.EHR.Placement.Service.csproj", "./BMA.EHR.Placement.Service"]
|
||||
RUN dotnet restore "./BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj"
|
||||
RUN dotnet restore "BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/BMA.EHR.Placement.Service"
|
||||
RUN dotnet build "BMA.EHR.Placement.Service.csproj" -c Release -o /app/build
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ var app = builder.Build();
|
|||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
|
@ -119,6 +119,7 @@ var app = builder.Build();
|
|||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>1fb39f37-45f3-4d47-9c86-c0458563770e</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
<RootNamespace>BMA.EHR.Report.Service</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<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.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.31.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||
<PackageReference Include="Sentry.AspNetCore" Version="3.33.1" />
|
||||
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
|
||||
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
<PackageReference Include="Telerik.Reporting" Version="17.0.23.315" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include=".github\workflows\build-local.yaml" />
|
||||
<None Include=".github\workflows\release.yaml" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -37,7 +37,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BMA.EHR.API.Command\BMA.EHR.API.Command.csproj" />
|
||||
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace BMA.EHR.Report.Service
|
|||
{
|
||||
var info = new OpenApiInfo()
|
||||
{
|
||||
Title = "BMA EHR Placement Service Document",
|
||||
Title = "BMA EHR Report Service Document",
|
||||
Version = desc.ApiVersion.ToString()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ var app = builder.Build();
|
|||
|
||||
app.MapHealthChecks("/health");
|
||||
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
|
|
@ -119,6 +119,7 @@ var app = builder.Build();
|
|||
app.UseDefaultFiles();
|
||||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,35 @@
|
|||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
"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=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"
|
||||
}
|
||||
184
BMA.EHR.Report.Service/wwwroot/index.html
Normal file
184
BMA.EHR.Report.Service/wwwroot/index.html
Normal file
|
|
@ -0,0 +1,184 @@
|
|||
<!--
|
||||
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||
~ and other contributors as indicated by the @author tags.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<script src="./keycloak.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<button onclick="keycloak.login()">Login</button>
|
||||
<button onclick="keycloak.login({ action: 'UPDATE_PASSWORD' })">Update Password</button>
|
||||
<button onclick="keycloak.logout()">Logout</button>
|
||||
<button onclick="keycloak.register()">Register</button>
|
||||
<button onclick="keycloak.accountManagement()">Account</button>
|
||||
<button onclick="refreshToken(9999)">Refresh Token</button>
|
||||
<button onclick="refreshToken(30)">Refresh Token (if <30s validity)</button>
|
||||
<button onclick="loadProfile()">Get Profile</button>
|
||||
<button onclick="updateProfile()">Update profile</button>
|
||||
<button onclick="loadUserInfo()">Get User Info</button>
|
||||
<button onclick="output(keycloak.tokenParsed)">Show Token</button>
|
||||
<button onclick="output(keycloak.refreshTokenParsed)">Show Refresh Token</button>
|
||||
<button onclick="output(keycloak.idTokenParsed)">Show ID Token</button>
|
||||
<button onclick="showExpires()">Show Expires</button>
|
||||
<button onclick="output(keycloak)">Show Details</button>
|
||||
<button onclick="output(keycloak.createLoginUrl())">Show Login URL</button>
|
||||
<button onclick="output(keycloak.createLogoutUrl())">Show Logout URL</button>
|
||||
<button onclick="output(keycloak.createRegisterUrl())">Show Register URL</button>
|
||||
<button onclick="output(keycloak.createAccountUrl())">Show Account URL</button>
|
||||
|
||||
</div>
|
||||
|
||||
<h2>Result</h2>
|
||||
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="output"></pre>
|
||||
|
||||
<h2>Events</h2>
|
||||
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="events"></pre>
|
||||
|
||||
|
||||
<script>
|
||||
function loadProfile() {
|
||||
keycloak.loadUserProfile().success(function(profile) {
|
||||
output(profile);
|
||||
}).error(function() {
|
||||
output('Failed to load profile');
|
||||
});
|
||||
}
|
||||
|
||||
function updateProfile() {
|
||||
var url = keycloak.createAccountUrl().split('?')[0];
|
||||
var req = new XMLHttpRequest();
|
||||
req.open('POST', url, true);
|
||||
req.setRequestHeader('Accept', 'application/json');
|
||||
req.setRequestHeader('Content-Type', 'application/json');
|
||||
req.setRequestHeader('Authorization', 'bearer ' + keycloak.token);
|
||||
|
||||
req.onreadystatechange = function () {
|
||||
if (req.readyState == 4) {
|
||||
if (req.status == 200) {
|
||||
output('Success');
|
||||
} else {
|
||||
output('Failed');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
req.send('{"email":"myemail@foo.bar","firstName":"test","lastName":"bar"}');
|
||||
}
|
||||
|
||||
function loadUserInfo() {
|
||||
keycloak.loadUserInfo().success(function(userInfo) {
|
||||
output(userInfo);
|
||||
}).error(function() {
|
||||
output('Failed to load user info');
|
||||
});
|
||||
}
|
||||
|
||||
function refreshToken(minValidity) {
|
||||
keycloak.updateToken(minValidity).then(function(refreshed) {
|
||||
if (refreshed) {
|
||||
output(keycloak.tokenParsed);
|
||||
} else {
|
||||
output('Token not refreshed, valid for ' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');
|
||||
}
|
||||
}).catch(function() {
|
||||
output('Failed to refresh token');
|
||||
});
|
||||
}
|
||||
|
||||
function showExpires() {
|
||||
if (!keycloak.tokenParsed) {
|
||||
output("Not authenticated");
|
||||
return;
|
||||
}
|
||||
|
||||
var o = 'Token Expires:\t\t' + new Date((keycloak.tokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||
o += 'Token Expires in:\t' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds\n';
|
||||
|
||||
if (keycloak.refreshTokenParsed) {
|
||||
o += 'Refresh Token Expires:\t' + new Date((keycloak.refreshTokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||
o += 'Refresh Expires in:\t' + Math.round(keycloak.refreshTokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds';
|
||||
}
|
||||
|
||||
output(o);
|
||||
}
|
||||
|
||||
function output(data) {
|
||||
if (typeof data === 'object') {
|
||||
data = JSON.stringify(data, null, ' ');
|
||||
}
|
||||
document.getElementById('output').innerHTML = data;
|
||||
}
|
||||
|
||||
function event(event) {
|
||||
var e = document.getElementById('events').innerHTML;
|
||||
document.getElementById('events').innerHTML = new Date().toLocaleString() + "\t" + event + "\n" + e;
|
||||
}
|
||||
|
||||
var keycloak = Keycloak();
|
||||
|
||||
keycloak.onAuthSuccess = function () {
|
||||
event('Auth Success');
|
||||
};
|
||||
|
||||
keycloak.onAuthError = function (errorData) {
|
||||
event("Auth Error: " + JSON.stringify(errorData) );
|
||||
};
|
||||
|
||||
keycloak.onAuthRefreshSuccess = function () {
|
||||
event('Auth Refresh Success');
|
||||
};
|
||||
|
||||
keycloak.onAuthRefreshError = function () {
|
||||
event('Auth Refresh Error');
|
||||
};
|
||||
|
||||
keycloak.onAuthLogout = function () {
|
||||
event('Auth Logout');
|
||||
};
|
||||
|
||||
keycloak.onTokenExpired = function () {
|
||||
event('Access token expired.');
|
||||
};
|
||||
|
||||
keycloak.onActionUpdate = function (status) {
|
||||
switch (status) {
|
||||
case 'success':
|
||||
event('Action completed successfully'); break;
|
||||
case 'cancelled':
|
||||
event('Action cancelled by user'); break;
|
||||
case 'error':
|
||||
event('Action failed'); break;
|
||||
}
|
||||
};
|
||||
|
||||
// Flow can be changed to 'implicit' or 'hybrid', but then client must enable implicit flow in admin console too
|
||||
var initOptions = {
|
||||
responseMode: 'fragment',
|
||||
flow: 'standard'
|
||||
};
|
||||
|
||||
keycloak.init(initOptions).then(function(authenticated) {
|
||||
output('Init Success (' + (authenticated ? 'Authenticated' : 'Not Authenticated') + ')');
|
||||
}).catch(function() {
|
||||
output('Init Error');
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
1766
BMA.EHR.Report.Service/wwwroot/keycloak.js
Normal file
1766
BMA.EHR.Report.Service/wwwroot/keycloak.js
Normal file
File diff suppressed because one or more lines are too long
7
BMA.EHR.Report.Service/wwwroot/keycloak.json
Normal file
7
BMA.EHR.Report.Service/wwwroot/keycloak.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"realm": "bma-ehr",
|
||||
"auth-server-url": "https://identity.frappet.com",
|
||||
"ssl-required": "external",
|
||||
"resource": "bma-ehr",
|
||||
"public-client": true
|
||||
}
|
||||
|
|
@ -15,12 +15,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F3C2F68F-8DC
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Service", "Service", "{FA618F0C-1AF5-49AB-AE13-C020B403B64F}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.API.Command", "BMA.EHR.API.Command\BMA.EHR.API.Command.csproj", "{FC7215BD-5651-4226-9210-8894E8FA8767}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Placement.Service", "BMA.EHR.Placement.Service\BMA.EHR.Placement.Service.csproj", "{81610EF7-AF80-44D8-9263-925C821CF45F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.OrganizationEmployee.Service", "BMA.EHR.OrganizationEmployee.Service\BMA.EHR.OrganizationEmployee.Service.csproj", "{A54AA069-8B0E-4784-953B-5DA9F9C8285E}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.OrganizationEmployee.Service", "BMA.EHR.OrganizationEmployee.Service\BMA.EHR.OrganizationEmployee.Service.csproj", "{A54AA069-8B0E-4784-953B-5DA9F9C8285E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Command.Service", "BMA.EHR.Command.Service\BMA.EHR.Command.Service.csproj", "{E4E905EE-61DF-4451-B063-5C86BC7574CE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
@ -44,10 +45,6 @@ Global
|
|||
{939DD34A-C7AE-406E-B557-33F69AC64127}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{939DD34A-C7AE-406E-B557-33F69AC64127}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{939DD34A-C7AE-406E-B557-33F69AC64127}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FC7215BD-5651-4226-9210-8894E8FA8767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FC7215BD-5651-4226-9210-8894E8FA8767}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FC7215BD-5651-4226-9210-8894E8FA8767}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FC7215BD-5651-4226-9210-8894E8FA8767}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{81610EF7-AF80-44D8-9263-925C821CF45F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{81610EF7-AF80-44D8-9263-925C821CF45F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{81610EF7-AF80-44D8-9263-925C821CF45F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
@ -60,6 +57,10 @@ Global
|
|||
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E4E905EE-61DF-4451-B063-5C86BC7574CE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
@ -70,10 +71,10 @@ Global
|
|||
{F83D3633-4A7A-432A-9E47-29378F4D175F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
|
||||
{939DD34A-C7AE-406E-B557-33F69AC64127} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||
{FA618F0C-1AF5-49AB-AE13-C020B403B64F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
|
||||
{FC7215BD-5651-4226-9210-8894E8FA8767} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
|
||||
{81610EF7-AF80-44D8-9263-925C821CF45F} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||
{A54AA069-8B0E-4784-953B-5DA9F9C8285E} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||
{AC4B2602-C543-4165-85D7-F6F92F553D80} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||
{E4E905EE-61DF-4451-B063-5C86BC7574CE} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue