From 717b0f0a8e5db34db0980b925ac3c80540dd1b70 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Mon, 5 Jun 2023 20:22:51 +0700 Subject: [PATCH] Add project files. --- .dockerignore | 25 +++ .../ApplicationServicesRegistration.cs | 16 ++ .../BMA.EHR.Application.csproj | 19 +++ .../Interfaces/IApplicationDBContext.cs | 14 ++ .../Common/Interfaces/IGenericRepository.cs | 9 + .../Repositories/BloodGroupRepository.cs | 26 +++ .../Repositories/PrefixRepository.cs | 26 +++ BMA.EHR.Domain/BMA.EHR.Domain.csproj | 13 ++ BMA.EHR.Domain/Common/BaseEntity.cs | 34 ++++ .../Common/Interfaces/IActivableEntity.cs | 7 + .../Common/Interfaces/IAuditableEntity.cs | 17 ++ .../Entities/MetaData/BloodGroupEntity.cs | 13 ++ .../Entities/MetaData/PrefixEntity.cs | 13 ++ .../BMA.EHR.Infrastructure.csproj | 26 +++ .../InfrastructureServiceRegistration.cs | 23 +++ ...0230605123842_Initial Database.Designer.cs | 142 ++++++++++++++++ .../20230605123842_Initial Database.cs | 63 +++++++ ...230605131808_Change Field Name.Designer.cs | 142 ++++++++++++++++ .../20230605131808_Change Field Name.cs | 38 +++++ .../ApplicationDBContextModelSnapshot.cs | 139 +++++++++++++++ .../Persistence/ApplicationDBContext.cs | 22 +++ .../BMA.EHR.MetaData.Service.csproj | 44 +++++ .../ConfigureSwaggerOptions.cs | 84 ++++++++++ .../Controllers/PrefixController.cs | 26 +++ BMA.EHR.MetaData.Service/Dockerfile | 22 +++ BMA.EHR.MetaData.Service/Program.cs | 158 ++++++++++++++++++ .../Properties/launchSettings.json | 48 ++++++ .../appsettings.Development.json | 8 + BMA.EHR.MetaData.Service/appsettings.json | 27 +++ BMA.EHR.MetaData.Service/nuget.config | 9 + BMA.EHR.Solution.sln | 43 +++++ 31 files changed, 1296 insertions(+) create mode 100644 .dockerignore create mode 100644 BMA.EHR.Application/ApplicationServicesRegistration.cs create mode 100644 BMA.EHR.Application/BMA.EHR.Application.csproj create mode 100644 BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs create mode 100644 BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs create mode 100644 BMA.EHR.Application/Repositories/BloodGroupRepository.cs create mode 100644 BMA.EHR.Application/Repositories/PrefixRepository.cs create mode 100644 BMA.EHR.Domain/BMA.EHR.Domain.csproj create mode 100644 BMA.EHR.Domain/Common/BaseEntity.cs create mode 100644 BMA.EHR.Domain/Common/Interfaces/IActivableEntity.cs create mode 100644 BMA.EHR.Domain/Common/Interfaces/IAuditableEntity.cs create mode 100644 BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs create mode 100644 BMA.EHR.Domain/Entities/MetaData/PrefixEntity.cs create mode 100644 BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj create mode 100644 BMA.EHR.Infrastructure/InfrastructureServiceRegistration.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.Designer.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs create mode 100644 BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs create mode 100644 BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj create mode 100644 BMA.EHR.MetaData.Service/ConfigureSwaggerOptions.cs create mode 100644 BMA.EHR.MetaData.Service/Controllers/PrefixController.cs create mode 100644 BMA.EHR.MetaData.Service/Dockerfile create mode 100644 BMA.EHR.MetaData.Service/Program.cs create mode 100644 BMA.EHR.MetaData.Service/Properties/launchSettings.json create mode 100644 BMA.EHR.MetaData.Service/appsettings.Development.json create mode 100644 BMA.EHR.MetaData.Service/appsettings.json create mode 100644 BMA.EHR.MetaData.Service/nuget.config create mode 100644 BMA.EHR.Solution.sln diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..3729ff0c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/BMA.EHR.Application/ApplicationServicesRegistration.cs b/BMA.EHR.Application/ApplicationServicesRegistration.cs new file mode 100644 index 00000000..3ff1899a --- /dev/null +++ b/BMA.EHR.Application/ApplicationServicesRegistration.cs @@ -0,0 +1,16 @@ +using BMA.EHR.Application.Repositories; +using Microsoft.Extensions.DependencyInjection; + +namespace BMA.EHR.Application +{ + public static class ApplicationServicesRegistration + { + public static IServiceCollection AddApplication(this IServiceCollection services) + { + services.AddTransient(); + services.AddTransient(); + + return services; + } + } +} diff --git a/BMA.EHR.Application/BMA.EHR.Application.csproj b/BMA.EHR.Application/BMA.EHR.Application.csproj new file mode 100644 index 00000000..70cdb550 --- /dev/null +++ b/BMA.EHR.Application/BMA.EHR.Application.csproj @@ -0,0 +1,19 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + + + diff --git a/BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs b/BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs new file mode 100644 index 00000000..eae94f98 --- /dev/null +++ b/BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs @@ -0,0 +1,14 @@ +using BMA.EHR.Domain.Entities.MetaData; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Application.Common.Interfaces +{ + public interface IApplicationDBContext + { + DbSet Prefixes { get; set; } + + DbSet BloodGroups { get; set; } + + Task SaveChangesAsync(); + } +} diff --git a/BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs b/BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs new file mode 100644 index 00000000..017bac1e --- /dev/null +++ b/BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs @@ -0,0 +1,9 @@ +namespace BMA.EHR.Application.Common.Interfaces +{ + public interface IGenericRepository where T : class + { + Task GetByIdAsync(S id); + + Task> GetAllAsync(); + } +} diff --git a/BMA.EHR.Application/Repositories/BloodGroupRepository.cs b/BMA.EHR.Application/Repositories/BloodGroupRepository.cs new file mode 100644 index 00000000..f340e177 --- /dev/null +++ b/BMA.EHR.Application/Repositories/BloodGroupRepository.cs @@ -0,0 +1,26 @@ +using BMA.EHR.Application.Common.Interfaces; +using BMA.EHR.Domain.Entities.MetaData; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Application.Repositories +{ + public class BloodGroupRepository : IGenericRepository + { + private readonly IApplicationDBContext _dbContext; + + public BloodGroupRepository(IApplicationDBContext dbContext) + { + _dbContext = dbContext; + } + + public async Task> GetAllAsync() + { + return await _dbContext.BloodGroups.ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _dbContext.BloodGroups.FirstOrDefaultAsync(x => x.Id == id); + } + } +} diff --git a/BMA.EHR.Application/Repositories/PrefixRepository.cs b/BMA.EHR.Application/Repositories/PrefixRepository.cs new file mode 100644 index 00000000..d3125486 --- /dev/null +++ b/BMA.EHR.Application/Repositories/PrefixRepository.cs @@ -0,0 +1,26 @@ +using BMA.EHR.Application.Common.Interfaces; +using BMA.EHR.Domain.Entities.MetaData; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Application.Repositories +{ + public class PrefixRepository : IGenericRepository + { + private readonly IApplicationDBContext _dbContext; + + public PrefixRepository(IApplicationDBContext dbContext) + { + _dbContext = dbContext; + } + + public async Task> GetAllAsync() + { + return await _dbContext.Prefixes.ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _dbContext.Prefixes.FirstOrDefaultAsync(x => x.Id == id); + } + } +} diff --git a/BMA.EHR.Domain/BMA.EHR.Domain.csproj b/BMA.EHR.Domain/BMA.EHR.Domain.csproj new file mode 100644 index 00000000..98cc454f --- /dev/null +++ b/BMA.EHR.Domain/BMA.EHR.Domain.csproj @@ -0,0 +1,13 @@ + + + + net7.0 + enable + enable + + + + + + + diff --git a/BMA.EHR.Domain/Common/BaseEntity.cs b/BMA.EHR.Domain/Common/BaseEntity.cs new file mode 100644 index 00000000..87bab41e --- /dev/null +++ b/BMA.EHR.Domain/Common/BaseEntity.cs @@ -0,0 +1,34 @@ +using BMA.EHR.Domain.Common.Interfaces; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Domain.Common +{ + public abstract class BaseEntity : IActivableEntity, IAuditableEntity + { + [Key, Column(Order = 0), Comment("คีย์หลัก")] + public virtual T Id { get; set; } + + [Required, Column(Order = 990), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + + [Required, Column(Order = 991), Comment("User Id ที่สร้างข้อมูล")] + public Guid CreatedUserId { get; set; } = Guid.Empty; + + [Required, Column(Order = 992), Comment("ชื่อ User ที่สร้างข้อมูล")] + public string CreatedUserFullName { get; set; } = string.Empty; + + [Required, Column(Order = 993), Comment("สร้างข้อมูลเมื่อ")] + public DateTime CreatedDate { get; set; } = DateTime.Now; + + [Column(Order = 994), Comment("User Id ที่แก้ไขข้อมูล")] + public Guid? ModifiedUserId { get; set; } + + [Column(Order = 995), Comment("ชื่อ User ที่แก้ไจข้อมูล")] + public string? ModifiedUserFullName { get; set; } + + [Column(Order = 996), Comment("แก้ไขข้อมูลเมื่อ")] + public DateTime? ModifiedDate { get; set; } + } +} diff --git a/BMA.EHR.Domain/Common/Interfaces/IActivableEntity.cs b/BMA.EHR.Domain/Common/Interfaces/IActivableEntity.cs new file mode 100644 index 00000000..cf767610 --- /dev/null +++ b/BMA.EHR.Domain/Common/Interfaces/IActivableEntity.cs @@ -0,0 +1,7 @@ +namespace BMA.EHR.Domain.Common.Interfaces +{ + public interface IActivableEntity + { + bool IsActive { get; set; } + } +} diff --git a/BMA.EHR.Domain/Common/Interfaces/IAuditableEntity.cs b/BMA.EHR.Domain/Common/Interfaces/IAuditableEntity.cs new file mode 100644 index 00000000..3633e37f --- /dev/null +++ b/BMA.EHR.Domain/Common/Interfaces/IAuditableEntity.cs @@ -0,0 +1,17 @@ +namespace BMA.EHR.Domain.Common.Interfaces +{ + public interface IAuditableEntity + { + Guid CreatedUserId { get; set; } + + string CreatedUserFullName { get; set; } + + DateTime CreatedDate { get; set; } + + Guid? ModifiedUserId { get; set; } + + string? ModifiedUserFullName { get; set; } + + DateTime? ModifiedDate { get; set; } + } +} diff --git a/BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs b/BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs new file mode 100644 index 00000000..94ae10df --- /dev/null +++ b/BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs @@ -0,0 +1,13 @@ +using BMA.EHR.Domain.Common; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Domain.Entities.MetaData +{ + public class BloodGroupEntity : BaseEntity + { + [Required, MaxLength(2), Column(Order = 1), Comment("ชื่อหมู่โลหิต")] + public string Name { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.Domain/Entities/MetaData/PrefixEntity.cs b/BMA.EHR.Domain/Entities/MetaData/PrefixEntity.cs new file mode 100644 index 00000000..565f6424 --- /dev/null +++ b/BMA.EHR.Domain/Entities/MetaData/PrefixEntity.cs @@ -0,0 +1,13 @@ +using BMA.EHR.Domain.Common; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Domain.Entities.MetaData +{ + public class PrefixEntity : BaseEntity + { + [Required, MaxLength(100), Column(Order = 1), Comment("รายละเอียดคำนำหน้า")] + public string Name { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj b/BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj new file mode 100644 index 00000000..a74f6ddb --- /dev/null +++ b/BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj @@ -0,0 +1,26 @@ + + + + net7.0 + enable + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + diff --git a/BMA.EHR.Infrastructure/InfrastructureServiceRegistration.cs b/BMA.EHR.Infrastructure/InfrastructureServiceRegistration.cs new file mode 100644 index 00000000..f1436dc8 --- /dev/null +++ b/BMA.EHR.Infrastructure/InfrastructureServiceRegistration.cs @@ -0,0 +1,23 @@ +using BMA.EHR.Application.Common.Interfaces; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace BMA.EHR.Infrastructure +{ + public static class InfrastructureServiceRegistration + { + public static IServiceCollection AddPersistence(this IServiceCollection services, + IConfiguration configuration) + { + services.AddDbContext(options => + options.UseOracle(configuration.GetConnectionString("DefaultConnection"), + b => b.MigrationsAssembly(typeof(ApplicationDBContext).Assembly.FullName)), ServiceLifetime.Transient); + + services.AddScoped(provider => provider.GetService()); + + return services; + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs new file mode 100644 index 00000000..f2087990 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs @@ -0,0 +1,142 @@ +// +using System; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Oracle.EntityFrameworkCore.Metadata; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + [DbContext(typeof(ApplicationDBContext))] + [Migration("20230605123842_Initial Database")] + partial class InitialDatabase + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)") + .HasColumnOrder(0) + .HasComment("คีย์หลัก"); + + b.Property("CreatedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(993) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedUserFullName") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(992) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(991) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActivable") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(990) + .HasComment("สถานะการใช้งาน"); + + b.Property("ModifiedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(996) + .HasComment("แก้ไขข้อมูลเมื่อ"); + + b.Property("ModifiedUserFullName") + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(995) + .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + + b.Property("ModifiedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(994) + .HasComment("User Id ที่แก้ไขข้อมูล"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("NVARCHAR2(2)") + .HasColumnOrder(1) + .HasComment("ชื่อหมู่โลหิต"); + + b.HasKey("Id"); + + b.ToTable("BloodGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.PrefixEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)") + .HasColumnOrder(0) + .HasComment("คีย์หลัก"); + + b.Property("CreatedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(993) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedUserFullName") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(992) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(991) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActivable") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(990) + .HasComment("สถานะการใช้งาน"); + + b.Property("ModifiedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(996) + .HasComment("แก้ไขข้อมูลเมื่อ"); + + b.Property("ModifiedUserFullName") + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(995) + .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + + b.Property("ModifiedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(994) + .HasComment("User Id ที่แก้ไขข้อมูล"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("NVARCHAR2(100)") + .HasColumnOrder(1) + .HasComment("รายละเอียดคำนำหน้า"); + + b.HasKey("Id"); + + b.ToTable("Prefixes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.cs b/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.cs new file mode 100644 index 00000000..c326a132 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.cs @@ -0,0 +1,63 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + /// + public partial class InitialDatabase : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "BloodGroups", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Name = table.Column(type: "NVARCHAR2(2)", maxLength: 2, nullable: false, comment: "ชื่อหมู่โลหิต"), + IsActivable = table.Column(type: "NUMBER(1)", nullable: false, comment: "สถานะการใช้งาน"), + CreatedUserId = table.Column(type: "RAW(16)", nullable: false, comment: "User Id ที่สร้างข้อมูล"), + CreatedUserFullName = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"), + CreatedDate = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), + ModifiedUserId = table.Column(type: "RAW(16)", nullable: true, comment: "User Id ที่แก้ไขข้อมูล"), + ModifiedUserFullName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ชื่อ User ที่แก้ไจข้อมูล"), + ModifiedDate = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลเมื่อ") + }, + constraints: table => + { + table.PrimaryKey("PK_BloodGroups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Prefixes", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Name = table.Column(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "รายละเอียดคำนำหน้า"), + IsActivable = table.Column(type: "NUMBER(1)", nullable: false, comment: "สถานะการใช้งาน"), + CreatedUserId = table.Column(type: "RAW(16)", nullable: false, comment: "User Id ที่สร้างข้อมูล"), + CreatedUserFullName = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"), + CreatedDate = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), + ModifiedUserId = table.Column(type: "RAW(16)", nullable: true, comment: "User Id ที่แก้ไขข้อมูล"), + ModifiedUserFullName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ชื่อ User ที่แก้ไจข้อมูล"), + ModifiedDate = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลเมื่อ") + }, + constraints: table => + { + table.PrimaryKey("PK_Prefixes", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BloodGroups"); + + migrationBuilder.DropTable( + name: "Prefixes"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.Designer.cs new file mode 100644 index 00000000..cd874b28 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.Designer.cs @@ -0,0 +1,142 @@ +// +using System; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Oracle.EntityFrameworkCore.Metadata; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + [DbContext(typeof(ApplicationDBContext))] + [Migration("20230605131808_Change Field Name")] + partial class ChangeFieldName + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)") + .HasColumnOrder(0) + .HasComment("คีย์หลัก"); + + b.Property("CreatedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(993) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedUserFullName") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(992) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(991) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(990) + .HasComment("สถานะการใช้งาน"); + + b.Property("ModifiedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(996) + .HasComment("แก้ไขข้อมูลเมื่อ"); + + b.Property("ModifiedUserFullName") + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(995) + .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + + b.Property("ModifiedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(994) + .HasComment("User Id ที่แก้ไขข้อมูล"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("NVARCHAR2(2)") + .HasColumnOrder(1) + .HasComment("ชื่อหมู่โลหิต"); + + b.HasKey("Id"); + + b.ToTable("BloodGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.PrefixEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)") + .HasColumnOrder(0) + .HasComment("คีย์หลัก"); + + b.Property("CreatedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(993) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedUserFullName") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(992) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(991) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(990) + .HasComment("สถานะการใช้งาน"); + + b.Property("ModifiedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(996) + .HasComment("แก้ไขข้อมูลเมื่อ"); + + b.Property("ModifiedUserFullName") + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(995) + .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + + b.Property("ModifiedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(994) + .HasComment("User Id ที่แก้ไขข้อมูล"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("NVARCHAR2(100)") + .HasColumnOrder(1) + .HasComment("รายละเอียดคำนำหน้า"); + + b.HasKey("Id"); + + b.ToTable("Prefixes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.cs b/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.cs new file mode 100644 index 00000000..fa096266 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.cs @@ -0,0 +1,38 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + /// + public partial class ChangeFieldName : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "IsActivable", + table: "Prefixes", + newName: "IsActive"); + + migrationBuilder.RenameColumn( + name: "IsActivable", + table: "BloodGroups", + newName: "IsActive"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "IsActive", + table: "Prefixes", + newName: "IsActivable"); + + migrationBuilder.RenameColumn( + name: "IsActive", + table: "BloodGroups", + newName: "IsActivable"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs new file mode 100644 index 00000000..bb9acade --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs @@ -0,0 +1,139 @@ +// +using System; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Oracle.EntityFrameworkCore.Metadata; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + [DbContext(typeof(ApplicationDBContext))] + partial class ApplicationDBContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroupEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)") + .HasColumnOrder(0) + .HasComment("คีย์หลัก"); + + b.Property("CreatedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(993) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedUserFullName") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(992) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(991) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(990) + .HasComment("สถานะการใช้งาน"); + + b.Property("ModifiedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(996) + .HasComment("แก้ไขข้อมูลเมื่อ"); + + b.Property("ModifiedUserFullName") + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(995) + .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + + b.Property("ModifiedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(994) + .HasComment("User Id ที่แก้ไขข้อมูล"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(2) + .HasColumnType("NVARCHAR2(2)") + .HasColumnOrder(1) + .HasComment("ชื่อหมู่โลหิต"); + + b.HasKey("Id"); + + b.ToTable("BloodGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.PrefixEntity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("RAW(16)") + .HasColumnOrder(0) + .HasComment("คีย์หลัก"); + + b.Property("CreatedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(993) + .HasComment("สร้างข้อมูลเมื่อ"); + + b.Property("CreatedUserFullName") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(992) + .HasComment("ชื่อ User ที่สร้างข้อมูล"); + + b.Property("CreatedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(991) + .HasComment("User Id ที่สร้างข้อมูล"); + + b.Property("IsActive") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(990) + .HasComment("สถานะการใช้งาน"); + + b.Property("ModifiedDate") + .HasColumnType("TIMESTAMP(7)") + .HasColumnOrder(996) + .HasComment("แก้ไขข้อมูลเมื่อ"); + + b.Property("ModifiedUserFullName") + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(995) + .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + + b.Property("ModifiedUserId") + .HasColumnType("RAW(16)") + .HasColumnOrder(994) + .HasComment("User Id ที่แก้ไขข้อมูล"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("NVARCHAR2(100)") + .HasColumnOrder(1) + .HasComment("รายละเอียดคำนำหน้า"); + + b.HasKey("Id"); + + b.ToTable("Prefixes"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs new file mode 100644 index 00000000..85bbc6ff --- /dev/null +++ b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs @@ -0,0 +1,22 @@ +using BMA.EHR.Application.Common.Interfaces; +using BMA.EHR.Domain.Entities.MetaData; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Infrastructure.Persistence +{ + public class ApplicationDBContext : DbContext, IApplicationDBContext + { + public ApplicationDBContext(DbContextOptions options) + : base(options) + { + } + + public DbSet Prefixes { get; set; } + public DbSet BloodGroups { get; set; } + + public Task SaveChangesAsync() + { + return base.SaveChangesAsync(); + } + } +} diff --git a/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj b/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj new file mode 100644 index 00000000..2c55693c --- /dev/null +++ b/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj @@ -0,0 +1,44 @@ + + + + net7.0 + enable + enable + aba35659-832c-421f-a7c1-80acb6ab6f0c + Linux + True + . + BMA.EHR.MetaData.Service + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + diff --git a/BMA.EHR.MetaData.Service/ConfigureSwaggerOptions.cs b/BMA.EHR.MetaData.Service/ConfigureSwaggerOptions.cs new file mode 100644 index 00000000..3d4d1b11 --- /dev/null +++ b/BMA.EHR.MetaData.Service/ConfigureSwaggerOptions.cs @@ -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.MetaData.Service +{ + public class ConfigureSwaggerOptions : IConfigureNamedOptions + { + 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 Metadata 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; + } + } +} diff --git a/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs b/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs new file mode 100644 index 00000000..ae4f8566 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs @@ -0,0 +1,26 @@ +using BMA.EHR.Application.Repositories; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; + +namespace BMA.EHR.MetaData.Service.Controllers +{ + [Route("api/prefix")] + [ApiController] + public class PrefixController : ControllerBase + { + private readonly PrefixRepository _prefixRepository; + + public PrefixController(PrefixRepository prefixRepository) + { + _prefixRepository = prefixRepository; + } + + [HttpGet] + public async Task GetAllAsync() + { + var data = await _prefixRepository.GetAllAsync(); + + return Ok(data); + } + } +} diff --git a/BMA.EHR.MetaData.Service/Dockerfile b/BMA.EHR.MetaData.Service/Dockerfile new file mode 100644 index 00000000..bf302223 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Dockerfile @@ -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.MetaData.Service/BMA.EHR.MetaData.Service.csproj", "BMA.EHR.MetaData.Service/"] +RUN dotnet restore "BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj" +COPY . . +WORKDIR "/src/BMA.EHR.MetaData.Service" +RUN dotnet build "BMA.EHR.MetaData.Service.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "BMA.EHR.MetaData.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.MetaData.Service.dll"] \ No newline at end of file diff --git a/BMA.EHR.MetaData.Service/Program.cs b/BMA.EHR.MetaData.Service/Program.cs new file mode 100644 index 00000000..53d5c94f --- /dev/null +++ b/BMA.EHR.MetaData.Service/Program.cs @@ -0,0 +1,158 @@ +using BMA.EHR.Application; +using BMA.EHR.Infrastructure; +using Microsoft.AspNetCore.Mvc.Versioning; +using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Logging; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.IdentityModel.Tokens; +using System.Text; +using Serilog.Sinks.Elasticsearch; +using Serilog; +using System.Reflection; +using Serilog.Exceptions; +using BMA.EHR.MetaData.Service; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using BMA.EHR.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; + +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 = false, //false for dev + ValidateAudience = false, //false for dev + ValidateLifetime = false, //false for dev + 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(); + + builder.Services.AddHealthChecks(); +} + +var app = builder.Build(); +{ + var apiVersionDescriptionProvider = app.Services.GetRequiredService(); + + 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(); + + // apply migrations + await using var scope = app.Services.CreateAsyncScope(); + await using var db = scope.ServiceProvider.GetRequiredService(); + 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(".", "-")}" + }; +} + diff --git a/BMA.EHR.MetaData.Service/Properties/launchSettings.json b/BMA.EHR.MetaData.Service/Properties/launchSettings.json new file mode 100644 index 00000000..7598f97a --- /dev/null +++ b/BMA.EHR.MetaData.Service/Properties/launchSettings.json @@ -0,0 +1,48 @@ +{ + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5243" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7168;http://localhost:5243" + }, + "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:6604", + "sslPort": 44319 + } + } +} \ No newline at end of file diff --git a/BMA.EHR.MetaData.Service/appsettings.Development.json b/BMA.EHR.MetaData.Service/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/BMA.EHR.MetaData.Service/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/BMA.EHR.MetaData.Service/appsettings.json b/BMA.EHR.MetaData.Service/appsettings.json new file mode 100644 index 00000000..dd694ac4 --- /dev/null +++ b/BMA.EHR.MetaData.Service/appsettings.json @@ -0,0 +1,27 @@ +{ + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Information", + "System": "Warning" + } + } + }, + "ElasticConfiguration": { + "Uri": "http://localhost:9200" + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "DefaultConnection": "User Id=system;Password=P@ssw0rd;Data Source=localhost:1521/ORCLCDB" + }, + "Jwt": { + "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", + "Issuer": "https://identity.frappet.com/realms/bma-ehr" + }, + "EPPlus": { + "ExcelPackage": { + "LicenseContext": "NonCommercial" + } + } +} diff --git a/BMA.EHR.MetaData.Service/nuget.config b/BMA.EHR.MetaData.Service/nuget.config new file mode 100644 index 00000000..33b28ffd --- /dev/null +++ b/BMA.EHR.MetaData.Service/nuget.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/BMA.EHR.Solution.sln b/BMA.EHR.Solution.sln new file mode 100644 index 00000000..ba13b20e --- /dev/null +++ b/BMA.EHR.Solution.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Domain", "BMA.EHR.Domain\BMA.EHR.Domain.csproj", "{9CA80F00-2D6E-4A0B-9C4B-80CE3EDFAB96}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Application", "BMA.EHR.Application\BMA.EHR.Application.csproj", "{C9656B6D-D24B-40AD-929E-CDED3FE53DCE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Infrastructure", "BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj", "{F83D3633-4A7A-432A-9E47-29378F4D175F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.MetaData.Service", "BMA.EHR.MetaData.Service\BMA.EHR.MetaData.Service.csproj", "{939DD34A-C7AE-406E-B557-33F69AC64127}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9CA80F00-2D6E-4A0B-9C4B-80CE3EDFAB96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9CA80F00-2D6E-4A0B-9C4B-80CE3EDFAB96}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9CA80F00-2D6E-4A0B-9C4B-80CE3EDFAB96}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9CA80F00-2D6E-4A0B-9C4B-80CE3EDFAB96}.Release|Any CPU.Build.0 = Release|Any CPU + {C9656B6D-D24B-40AD-929E-CDED3FE53DCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C9656B6D-D24B-40AD-929E-CDED3FE53DCE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C9656B6D-D24B-40AD-929E-CDED3FE53DCE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C9656B6D-D24B-40AD-929E-CDED3FE53DCE}.Release|Any CPU.Build.0 = Release|Any CPU + {F83D3633-4A7A-432A-9E47-29378F4D175F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F83D3633-4A7A-432A-9E47-29378F4D175F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F83D3633-4A7A-432A-9E47-29378F4D175F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F83D3633-4A7A-432A-9E47-29378F4D175F}.Release|Any CPU.Build.0 = Release|Any CPU + {939DD34A-C7AE-406E-B557-33F69AC64127}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A} + EndGlobalSection +EndGlobal