From 1ba2f2eec11f0266cb4e135094ecfdf9ae2b9cb4 Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Sun, 25 Jun 2023 18:36:02 +0700 Subject: [PATCH] Restructure TAble --- .../ApplicationServicesRegistration.cs | 5 +- .../BMA.EHR.Application.csproj | 4 +- .../Interfaces/IApplicationDBContext.cs | 21 +- .../Common/Interfaces/IGenericRepository.cs | 4 +- .../BloodGroup/BloodGroupRepository.cs | 26 ++ .../Repositories/BloodGroupRepository.cs | 26 -- .../Repositories/Prefix/PrefixRepository.cs | 26 ++ .../Repositories/PrefixRepository.cs | 26 -- BMA.EHR.Domain/BMA.EHR.Domain.csproj | 4 +- BMA.EHR.Domain/Common/BaseDataEntity.cs | 13 + BMA.EHR.Domain/Common/BaseDraftEntity.cs | 13 + BMA.EHR.Domain/Common/BaseEntity.cs | 44 +- .../Common/Interfaces/IPublishableEntity.cs | 13 + BMA.EHR.Domain/Common/ResponseObject.cs | 11 + .../BloodGroup/BloodGroupDraftEntity.cs | 13 + .../MetaData/BloodGroup/BloodGroupEntity.cs | 13 + .../BloodGroupPublishHistoryEntity.cs | 15 + .../Entities/MetaData/BloodGroupEntity.cs | 13 - .../MetaData/Prefix/PrefixDraftEntity.cs | 13 + .../MetaData/{ => Prefix}/PrefixEntity.cs | 4 +- .../Prefix/PrefixPublishHistoryEntity.cs | 15 + BMA.EHR.Domain/Shared/GlobalMessages.cs | 27 ++ .../BMA.EHR.Infrastructure.csproj | 4 +- .../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 -- .../20230625113156_Init Project.Designer.cs | 376 ++++++++++++++++++ .../Migrations/20230625113156_Init Project.cs | 153 +++++++ .../ApplicationDBContextModelSnapshot.cs | 248 +++++++++++- .../Persistence/ApplicationDBContext.cs | 28 +- .../BMA.EHR.MetaData.Service.csproj | 20 +- .../Controllers/PrefixController.cs | 5 +- BMA.EHR.MetaData.Service/Program.cs | 26 +- BMA.EHR.MetaData.Service/appsettings.json | 2 +- BMA.EHR.Solution.sln | 15 +- 37 files changed, 1107 insertions(+), 527 deletions(-) create mode 100644 BMA.EHR.Application/Repositories/BloodGroup/BloodGroupRepository.cs delete mode 100644 BMA.EHR.Application/Repositories/BloodGroupRepository.cs create mode 100644 BMA.EHR.Application/Repositories/Prefix/PrefixRepository.cs delete mode 100644 BMA.EHR.Application/Repositories/PrefixRepository.cs create mode 100644 BMA.EHR.Domain/Common/BaseDataEntity.cs create mode 100644 BMA.EHR.Domain/Common/BaseDraftEntity.cs create mode 100644 BMA.EHR.Domain/Common/Interfaces/IPublishableEntity.cs create mode 100644 BMA.EHR.Domain/Common/ResponseObject.cs create mode 100644 BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupDraftEntity.cs create mode 100644 BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupEntity.cs create mode 100644 BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupPublishHistoryEntity.cs delete mode 100644 BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs create mode 100644 BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixDraftEntity.cs rename BMA.EHR.Domain/Entities/MetaData/{ => Prefix}/PrefixEntity.cs (77%) create mode 100644 BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixPublishHistoryEntity.cs create mode 100644 BMA.EHR.Domain/Shared/GlobalMessages.cs delete mode 100644 BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs delete mode 100644 BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.cs delete mode 100644 BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.Designer.cs delete mode 100644 BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230625113156_Init Project.Designer.cs create mode 100644 BMA.EHR.Infrastructure/Migrations/20230625113156_Init Project.cs diff --git a/BMA.EHR.Application/ApplicationServicesRegistration.cs b/BMA.EHR.Application/ApplicationServicesRegistration.cs index 3ff1899a..c6c52809 100644 --- a/BMA.EHR.Application/ApplicationServicesRegistration.cs +++ b/BMA.EHR.Application/ApplicationServicesRegistration.cs @@ -1,9 +1,10 @@ -using BMA.EHR.Application.Repositories; +using BMA.EHR.Application.Repositories.BloodGroup; +using BMA.EHR.Application.Repositories.Prefix; using Microsoft.Extensions.DependencyInjection; namespace BMA.EHR.Application { - public static class ApplicationServicesRegistration + public static class ApplicationServicesRegistration { public static IServiceCollection AddApplication(this IServiceCollection services) { diff --git a/BMA.EHR.Application/BMA.EHR.Application.csproj b/BMA.EHR.Application/BMA.EHR.Application.csproj index 70cdb550..b40d14e1 100644 --- a/BMA.EHR.Application/BMA.EHR.Application.csproj +++ b/BMA.EHR.Application/BMA.EHR.Application.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -7,7 +7,7 @@ - + diff --git a/BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs b/BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs index eae94f98..c2f3c033 100644 --- a/BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs +++ b/BMA.EHR.Application/Common/Interfaces/IApplicationDBContext.cs @@ -1,14 +1,23 @@ -using BMA.EHR.Domain.Entities.MetaData; +using BMA.EHR.Domain.Entities.MetaData.BloodGroup; +using BMA.EHR.Domain.Entities.MetaData.Prefix; using Microsoft.EntityFrameworkCore; namespace BMA.EHR.Application.Common.Interfaces { - public interface IApplicationDBContext - { - DbSet Prefixes { get; set; } + public interface IApplicationDBContext + { + DbSet MD_Prefixes { get; set; } - DbSet BloodGroups { get; set; } + DbSet MD_Prefix_Drafts { get; set; } - Task SaveChangesAsync(); + DbSet MD_Prefix_Histories { get; set; } + + DbSet MD_BloodGroups { get; set; } + + DbSet MD_BloodGroup_Drafts { get; set; } + + DbSet MD_BloodGroup_Histories { get; set; } + + Task SaveChangesAsync(); } } diff --git a/BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs b/BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs index 017bac1e..318635e0 100644 --- a/BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs +++ b/BMA.EHR.Application/Common/Interfaces/IGenericRepository.cs @@ -1,4 +1,6 @@ -namespace BMA.EHR.Application.Common.Interfaces +using BMA.EHR.Domain.Common; + +namespace BMA.EHR.Application.Common.Interfaces { public interface IGenericRepository where T : class { diff --git a/BMA.EHR.Application/Repositories/BloodGroup/BloodGroupRepository.cs b/BMA.EHR.Application/Repositories/BloodGroup/BloodGroupRepository.cs new file mode 100644 index 00000000..5fa77c61 --- /dev/null +++ b/BMA.EHR.Application/Repositories/BloodGroup/BloodGroupRepository.cs @@ -0,0 +1,26 @@ +using BMA.EHR.Application.Common.Interfaces; +using BMA.EHR.Domain.Entities.MetaData.BloodGroup; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Application.Repositories.BloodGroup +{ + public class BloodGroupRepository : IGenericRepository + { + private readonly IApplicationDBContext _dbContext; + + public BloodGroupRepository(IApplicationDBContext dbContext) + { + _dbContext = dbContext; + } + + public async Task> GetAllAsync() + { + return await _dbContext.MD_BloodGroups.ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _dbContext.MD_BloodGroups.FirstOrDefaultAsync(x => x.Id == id); + } + } +} diff --git a/BMA.EHR.Application/Repositories/BloodGroupRepository.cs b/BMA.EHR.Application/Repositories/BloodGroupRepository.cs deleted file mode 100644 index f340e177..00000000 --- a/BMA.EHR.Application/Repositories/BloodGroupRepository.cs +++ /dev/null @@ -1,26 +0,0 @@ -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/Prefix/PrefixRepository.cs b/BMA.EHR.Application/Repositories/Prefix/PrefixRepository.cs new file mode 100644 index 00000000..003d53c7 --- /dev/null +++ b/BMA.EHR.Application/Repositories/Prefix/PrefixRepository.cs @@ -0,0 +1,26 @@ +using BMA.EHR.Application.Common.Interfaces; +using BMA.EHR.Domain.Entities.MetaData.Prefix; +using Microsoft.EntityFrameworkCore; + +namespace BMA.EHR.Application.Repositories.Prefix +{ + public class PrefixRepository : IGenericRepository + { + private readonly IApplicationDBContext _dbContext; + + public PrefixRepository(IApplicationDBContext dbContext) + { + _dbContext = dbContext; + } + + public async Task> GetAllAsync() + { + return await _dbContext.MD_Prefixes.ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _dbContext.MD_Prefixes.FirstOrDefaultAsync(x => x.Id == id); + } + } +} diff --git a/BMA.EHR.Application/Repositories/PrefixRepository.cs b/BMA.EHR.Application/Repositories/PrefixRepository.cs deleted file mode 100644 index d3125486..00000000 --- a/BMA.EHR.Application/Repositories/PrefixRepository.cs +++ /dev/null @@ -1,26 +0,0 @@ -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 index 98cc454f..8a1aa4cc 100644 --- a/BMA.EHR.Domain/BMA.EHR.Domain.csproj +++ b/BMA.EHR.Domain/BMA.EHR.Domain.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -7,7 +7,7 @@ - + diff --git a/BMA.EHR.Domain/Common/BaseDataEntity.cs b/BMA.EHR.Domain/Common/BaseDataEntity.cs new file mode 100644 index 00000000..bf6bf413 --- /dev/null +++ b/BMA.EHR.Domain/Common/BaseDataEntity.cs @@ -0,0 +1,13 @@ +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 BaseDataEntity : BaseEntity, IActivableEntity + { + [Required, Column(Order = 990), Comment("สถานะการใช้งาน")] + public bool IsActive { get; set; } = true; + } +} diff --git a/BMA.EHR.Domain/Common/BaseDraftEntity.cs b/BMA.EHR.Domain/Common/BaseDraftEntity.cs new file mode 100644 index 00000000..c7589207 --- /dev/null +++ b/BMA.EHR.Domain/Common/BaseDraftEntity.cs @@ -0,0 +1,13 @@ +using BMA.EHR.Domain.Common.Interfaces; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Domain.Common +{ + public class BaseDraftEntity : BaseDataEntity, IPublishableEntity + { + [Required, Column(Order = 899), Comment("สถานะการเผยแพร่ข้อมูล")] + public bool IsPublished { get; set; } = false; + } +} diff --git a/BMA.EHR.Domain/Common/BaseEntity.cs b/BMA.EHR.Domain/Common/BaseEntity.cs index 87bab41e..f5c74f8e 100644 --- a/BMA.EHR.Domain/Common/BaseEntity.cs +++ b/BMA.EHR.Domain/Common/BaseEntity.cs @@ -1,34 +1,36 @@ using BMA.EHR.Domain.Common.Interfaces; using Microsoft.EntityFrameworkCore; -using System.ComponentModel.DataAnnotations; +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; namespace BMA.EHR.Domain.Common { - public abstract class BaseEntity : IActivableEntity, IAuditableEntity - { - [Key, Column(Order = 0), Comment("คีย์หลัก")] - public virtual T Id { get; set; } + public class BaseEntity : 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 = 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 = 992), Comment("ชื่อ User ที่สร้างข้อมูล")] - public string CreatedUserFullName { get; set; } = string.Empty; + [Required, Column(Order = 993), Comment("สร้างข้อมูลเมื่อ")] + public DateTime CreatedDate { get; set; } = DateTime.Now; - [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 = 994), Comment("User Id ที่แก้ไขข้อมูล")] - public Guid? ModifiedUserId { get; set; } + [Column(Order = 995), Comment("ชื่อ User ที่แก้ไขข้อมูล")] + public string? ModifiedUserFullName { get; set; } - [Column(Order = 995), Comment("ชื่อ User ที่แก้ไจข้อมูล")] - public string? ModifiedUserFullName { get; set; } - - [Column(Order = 996), Comment("แก้ไขข้อมูลเมื่อ")] - public DateTime? ModifiedDate { get; set; } - } + [Column(Order = 996), Comment("แก้ไขข้อมูลเมื่อ")] + public DateTime? ModifiedDate { get; set; } + } } diff --git a/BMA.EHR.Domain/Common/Interfaces/IPublishableEntity.cs b/BMA.EHR.Domain/Common/Interfaces/IPublishableEntity.cs new file mode 100644 index 00000000..75e47db5 --- /dev/null +++ b/BMA.EHR.Domain/Common/Interfaces/IPublishableEntity.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BMA.EHR.Domain.Common.Interfaces +{ + public interface IPublishableEntity + { + bool IsPublished { get; set; } + } +} diff --git a/BMA.EHR.Domain/Common/ResponseObject.cs b/BMA.EHR.Domain/Common/ResponseObject.cs new file mode 100644 index 00000000..5aa3ea25 --- /dev/null +++ b/BMA.EHR.Domain/Common/ResponseObject.cs @@ -0,0 +1,11 @@ +namespace BMA.EHR.Domain.Common +{ + public class ResponseObject + { + public int Status { get; set; } + + public string? Message { get; set; } + + public object? Result { get; set; } + } +} diff --git a/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupDraftEntity.cs b/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupDraftEntity.cs new file mode 100644 index 00000000..a7b6c564 --- /dev/null +++ b/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupDraftEntity.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.BloodGroup +{ + public class BloodGroupDraftEntity : BaseDraftEntity + { + [Required, MaxLength(2), Column(Order = 1), Comment("ชื่อหมู่โลหิต")] + public string Name { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupEntity.cs b/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupEntity.cs new file mode 100644 index 00000000..883823f7 --- /dev/null +++ b/BMA.EHR.Domain/Entities/MetaData/BloodGroup/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.BloodGroup +{ + public class BloodGroupEntity : BaseDataEntity + { + [Required, MaxLength(2), Column(Order = 1), Comment("ชื่อหมู่โลหิต")] + public string Name { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupPublishHistoryEntity.cs b/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupPublishHistoryEntity.cs new file mode 100644 index 00000000..619a15e6 --- /dev/null +++ b/BMA.EHR.Domain/Entities/MetaData/BloodGroup/BloodGroupPublishHistoryEntity.cs @@ -0,0 +1,15 @@ +using BMA.EHR.Domain.Common; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Domain.Entities.MetaData.BloodGroup +{ + public class BloodGroupPublishHistoryEntity : BaseEntity + { + [Column(Order = 1), Comment("รายละเอียดการแก้ไข")] + public string Detail { get; set; } = string.Empty; + + [Column(Order = 2), Comment("เก็บ Object ที่มีการอัพเดตในระบบ")] + public string ObjectValue { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs b/BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs deleted file mode 100644 index 94ae10df..00000000 --- a/BMA.EHR.Domain/Entities/MetaData/BloodGroupEntity.cs +++ /dev/null @@ -1,13 +0,0 @@ -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/Prefix/PrefixDraftEntity.cs b/BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixDraftEntity.cs new file mode 100644 index 00000000..7c59bbf4 --- /dev/null +++ b/BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixDraftEntity.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.Prefix +{ + public class PrefixDraftEntity : BaseDraftEntity + { + [Required, MaxLength(100), 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/Prefix/PrefixEntity.cs similarity index 77% rename from BMA.EHR.Domain/Entities/MetaData/PrefixEntity.cs rename to BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixEntity.cs index 565f6424..9ec66833 100644 --- a/BMA.EHR.Domain/Entities/MetaData/PrefixEntity.cs +++ b/BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixEntity.cs @@ -3,9 +3,9 @@ using Microsoft.EntityFrameworkCore; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace BMA.EHR.Domain.Entities.MetaData +namespace BMA.EHR.Domain.Entities.MetaData.Prefix { - public class PrefixEntity : BaseEntity + public class PrefixEntity : BaseDataEntity { [Required, MaxLength(100), Column(Order = 1), Comment("รายละเอียดคำนำหน้า")] public string Name { get; set; } = string.Empty; diff --git a/BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixPublishHistoryEntity.cs b/BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixPublishHistoryEntity.cs new file mode 100644 index 00000000..c4231eb1 --- /dev/null +++ b/BMA.EHR.Domain/Entities/MetaData/Prefix/PrefixPublishHistoryEntity.cs @@ -0,0 +1,15 @@ +using BMA.EHR.Domain.Common; +using Microsoft.EntityFrameworkCore; +using System.ComponentModel.DataAnnotations.Schema; + +namespace BMA.EHR.Domain.Entities.MetaData.Prefix +{ + public class PrefixPublishHistoryEntity : BaseEntity + { + [Column(Order = 1), Comment("รายละเอียดการแก้ไข")] + public string Detail { get; set; } = string.Empty; + + [Column(Order = 2), Comment("เก็บ Object ที่มีการอัพเดตในระบบ")] + public string ObjectValue { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.Domain/Shared/GlobalMessages.cs b/BMA.EHR.Domain/Shared/GlobalMessages.cs new file mode 100644 index 00000000..29055044 --- /dev/null +++ b/BMA.EHR.Domain/Shared/GlobalMessages.cs @@ -0,0 +1,27 @@ +namespace BMA.EHR.Domain.Shared +{ + public class GlobalMessages + { + public static readonly string Success = "สำเร็จ"; + + public static readonly string Error = "เกิดข้อผิดพลาด"; + + public static readonly string DataNotFound = "ไม่พบข้อมูลในระบบ"; + + #region " Meta Data " + + public static readonly string DataExist5 = "เนื่องจากมีการกำหนดวันหยุดในการทำงาน 5 วันอยู่"; + + public static readonly string DataExist6 = "เนื่องจากมีการกำหนดวันหยุดในการทำงาน 6 วันอยู่"; + + public static readonly string NameDupicate = "ชื่อวันหยุดนี้มีอยู่ในระบบอยู่แล้ว"; + + public static readonly string HolidayOfYearNotFound = "ไม่พบข้อมูลวันหยุดในปีที่คุณระบุ"; + + public static readonly string HolidayOfYearNotCopy = "ไม่สามารถคัดลอกวันหยุดย้อนหลังได้"; + + public static readonly string DestinationHolidayIsExist = "ข้อมูลวันหยุดในปีที่ระบุมีอยู่แล้ว"; + + #endregion + } +} diff --git a/BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj b/BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj index a74f6ddb..ff53cf3e 100644 --- a/BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj +++ b/BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj @@ -7,11 +7,11 @@ - + 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 index f1436dc8..a82ea5b3 100644 --- a/BMA.EHR.Infrastructure/InfrastructureServiceRegistration.cs +++ b/BMA.EHR.Infrastructure/InfrastructureServiceRegistration.cs @@ -19,5 +19,28 @@ namespace BMA.EHR.Infrastructure return services; } + + public static IServiceCollection AddEmailSender(this IServiceCollection services, + IConfiguration configuration) + { + + + + + + return services; + } + + public static IServiceCollection AddS3Storage(this IServiceCollection services, + IConfiguration configuration) + { + + + + + + return services; + } + } } diff --git a/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs deleted file mode 100644 index f2087990..00000000 --- a/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.Designer.cs +++ /dev/null @@ -1,142 +0,0 @@ -// -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 deleted file mode 100644 index c326a132..00000000 --- a/BMA.EHR.Infrastructure/Migrations/20230605123842_Initial Database.cs +++ /dev/null @@ -1,63 +0,0 @@ -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 deleted file mode 100644 index cd874b28..00000000 --- a/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.Designer.cs +++ /dev/null @@ -1,142 +0,0 @@ -// -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 deleted file mode 100644 index fa096266..00000000 --- a/BMA.EHR.Infrastructure/Migrations/20230605131808_Change Field Name.cs +++ /dev/null @@ -1,38 +0,0 @@ -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/20230625113156_Init Project.Designer.cs b/BMA.EHR.Infrastructure/Migrations/20230625113156_Init Project.Designer.cs new file mode 100644 index 00000000..1bebe353 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230625113156_Init Project.Designer.cs @@ -0,0 +1,376 @@ +// +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("20230625113156_Init Project")] + partial class InitProject + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroup.BloodGroupDraftEntity", 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("IsPublished") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(899) + .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("MD_BloodGroup_Drafts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroup.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("MD_BloodGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroup.BloodGroupPublishHistoryEntity", 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("Detail") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(1) + .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("ObjectValue") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(2) + .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ"); + + b.HasKey("Id"); + + b.ToTable("MD_BloodGroup_Histories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.Prefix.PrefixDraftEntity", 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("IsPublished") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(899) + .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("MD_Prefix_Drafts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.Prefix.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("MD_Prefixes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.Prefix.PrefixPublishHistoryEntity", 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("Detail") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(1) + .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("ObjectValue") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(2) + .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ"); + + b.HasKey("Id"); + + b.ToTable("MD_Prefix_Histories"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/20230625113156_Init Project.cs b/BMA.EHR.Infrastructure/Migrations/20230625113156_Init Project.cs new file mode 100644 index 00000000..d3ef1481 --- /dev/null +++ b/BMA.EHR.Infrastructure/Migrations/20230625113156_Init Project.cs @@ -0,0 +1,153 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BMA.EHR.Infrastructure.Migrations +{ + /// + public partial class InitProject : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "MD_BloodGroup_Drafts", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Name = table.Column(type: "NVARCHAR2(2)", maxLength: 2, nullable: false, comment: "ชื่อหมู่โลหิต"), + IsPublished = table.Column(type: "NUMBER(1)", nullable: false, comment: "สถานะการเผยแพร่ข้อมูล"), + IsActive = 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_MD_BloodGroup_Drafts", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "MD_BloodGroup_Histories", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Detail = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รายละเอียดการแก้ไข"), + ObjectValue = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "เก็บ Object ที่มีการอัพเดตในระบบ"), + 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_MD_BloodGroup_Histories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "MD_BloodGroups", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Name = table.Column(type: "NVARCHAR2(2)", maxLength: 2, nullable: false, comment: "ชื่อหมู่โลหิต"), + IsActive = 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_MD_BloodGroups", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "MD_Prefix_Drafts", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Name = table.Column(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "รายละเอียดคำนำหน้า"), + IsPublished = table.Column(type: "NUMBER(1)", nullable: false, comment: "สถานะการเผยแพร่ข้อมูล"), + IsActive = 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_MD_Prefix_Drafts", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "MD_Prefix_Histories", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Detail = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รายละเอียดการแก้ไข"), + ObjectValue = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "เก็บ Object ที่มีการอัพเดตในระบบ"), + 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_MD_Prefix_Histories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "MD_Prefixes", + columns: table => new + { + Id = table.Column(type: "RAW(16)", nullable: false, comment: "คีย์หลัก"), + Name = table.Column(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "รายละเอียดคำนำหน้า"), + IsActive = 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_MD_Prefixes", x => x.Id); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "MD_BloodGroup_Drafts"); + + migrationBuilder.DropTable( + name: "MD_BloodGroup_Histories"); + + migrationBuilder.DropTable( + name: "MD_BloodGroups"); + + migrationBuilder.DropTable( + name: "MD_Prefix_Drafts"); + + migrationBuilder.DropTable( + name: "MD_Prefix_Histories"); + + migrationBuilder.DropTable( + name: "MD_Prefixes"); + } + } +} diff --git a/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs index bb9acade..da25c63a 100644 --- a/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs +++ b/BMA.EHR.Infrastructure/Migrations/ApplicationDBContextModelSnapshot.cs @@ -17,12 +17,12 @@ namespace BMA.EHR.Infrastructure.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.5") + .HasAnnotation("ProductVersion", "7.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 128); OracleModelBuilderExtensions.UseIdentityColumns(modelBuilder); - modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroupEntity", b => + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroup.BloodGroupDraftEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -51,6 +51,11 @@ namespace BMA.EHR.Infrastructure.Migrations .HasColumnOrder(990) .HasComment("สถานะการใช้งาน"); + b.Property("IsPublished") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(899) + .HasComment("สถานะการเผยแพร่ข้อมูล"); + b.Property("ModifiedDate") .HasColumnType("TIMESTAMP(7)") .HasColumnOrder(996) @@ -59,7 +64,7 @@ namespace BMA.EHR.Infrastructure.Migrations b.Property("ModifiedUserFullName") .HasColumnType("NVARCHAR2(2000)") .HasColumnOrder(995) - .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + .HasComment("ชื่อ User ที่แก้ไขข้อมูล"); b.Property("ModifiedUserId") .HasColumnType("RAW(16)") @@ -75,10 +80,10 @@ namespace BMA.EHR.Infrastructure.Migrations b.HasKey("Id"); - b.ToTable("BloodGroups"); + b.ToTable("MD_BloodGroup_Drafts"); }); - modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.PrefixEntity", b => + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroup.BloodGroupEntity", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -115,7 +120,124 @@ namespace BMA.EHR.Infrastructure.Migrations b.Property("ModifiedUserFullName") .HasColumnType("NVARCHAR2(2000)") .HasColumnOrder(995) - .HasComment("ชื่อ User ที่แก้ไจข้อมูล"); + .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("MD_BloodGroups"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.BloodGroup.BloodGroupPublishHistoryEntity", 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("Detail") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(1) + .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("ObjectValue") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(2) + .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ"); + + b.HasKey("Id"); + + b.ToTable("MD_BloodGroup_Histories"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.Prefix.PrefixDraftEntity", 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("IsPublished") + .HasColumnType("NUMBER(1)") + .HasColumnOrder(899) + .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)") @@ -131,7 +253,119 @@ namespace BMA.EHR.Infrastructure.Migrations b.HasKey("Id"); - b.ToTable("Prefixes"); + b.ToTable("MD_Prefix_Drafts"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.Prefix.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("MD_Prefixes"); + }); + + modelBuilder.Entity("BMA.EHR.Domain.Entities.MetaData.Prefix.PrefixPublishHistoryEntity", 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("Detail") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(1) + .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("ObjectValue") + .IsRequired() + .HasColumnType("NVARCHAR2(2000)") + .HasColumnOrder(2) + .HasComment("เก็บ Object ที่มีการอัพเดตในระบบ"); + + b.HasKey("Id"); + + b.ToTable("MD_Prefix_Histories"); }); #pragma warning restore 612, 618 } diff --git a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs index 85bbc6ff..a701e6a4 100644 --- a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs +++ b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs @@ -1,20 +1,38 @@ using BMA.EHR.Application.Common.Interfaces; -using BMA.EHR.Domain.Entities.MetaData; +using BMA.EHR.Domain.Entities.MetaData.BloodGroup; +using BMA.EHR.Domain.Entities.MetaData.Prefix; using Microsoft.EntityFrameworkCore; namespace BMA.EHR.Infrastructure.Persistence { - public class ApplicationDBContext : DbContext, IApplicationDBContext + public class ApplicationDBContext : DbContext, IApplicationDBContext { public ApplicationDBContext(DbContextOptions options) : base(options) { } - public DbSet Prefixes { get; set; } - public DbSet BloodGroups { get; set; } + #region " Prefix " - public Task SaveChangesAsync() + public DbSet MD_Prefixes { get; set; } + + public DbSet MD_Prefix_Drafts { get; set; } + + public DbSet MD_Prefix_Histories { get; set; } + + #endregion + + #region " BloodGroups " + + public DbSet MD_BloodGroups { get; set; } + + public DbSet MD_BloodGroup_Drafts { get; set; } + + public DbSet MD_BloodGroup_Histories { get; set; } + + #endregion + + 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 index 2c55693c..ac7ffde6 100644 --- a/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj +++ b/BMA.EHR.MetaData.Service/BMA.EHR.MetaData.Service.csproj @@ -14,27 +14,27 @@ - - + + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + - + - - - + + + diff --git a/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs b/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs index ae4f8566..807029f0 100644 --- a/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs +++ b/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs @@ -1,10 +1,10 @@ -using BMA.EHR.Application.Repositories; +using BMA.EHR.Application.Repositories.Prefix; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace BMA.EHR.MetaData.Service.Controllers { - [Route("api/prefix")] + [Route("api/prefix")] [ApiController] public class PrefixController : ControllerBase { @@ -19,6 +19,7 @@ namespace BMA.EHR.MetaData.Service.Controllers public async Task GetAllAsync() { var data = await _prefixRepository.GetAllAsync(); + Console.WriteLine("Logic 1 Start"); return Ok(data); } diff --git a/BMA.EHR.MetaData.Service/Program.cs b/BMA.EHR.MetaData.Service/Program.cs index 53d5c94f..8d84352a 100644 --- a/BMA.EHR.MetaData.Service/Program.cs +++ b/BMA.EHR.MetaData.Service/Program.cs @@ -1,19 +1,19 @@ 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 BMA.EHR.MetaData.Service; +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); { @@ -79,6 +79,8 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddApplication(); builder.Services.AddPersistence(builder.Configuration); + builder.Services.AddEmailSender(builder.Configuration); + builder.Services.AddControllers(options => { options.SuppressAsyncSuffixInActionNames = false; diff --git a/BMA.EHR.MetaData.Service/appsettings.json b/BMA.EHR.MetaData.Service/appsettings.json index dd694ac4..960edc1d 100644 --- a/BMA.EHR.MetaData.Service/appsettings.json +++ b/BMA.EHR.MetaData.Service/appsettings.json @@ -13,7 +13,7 @@ }, "AllowedHosts": "*", "ConnectionStrings": { - "DefaultConnection": "User Id=system;Password=P@ssw0rd;Data Source=localhost:1521/ORCLCDB" + "DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB" }, "Jwt": { "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", diff --git a/BMA.EHR.Solution.sln b/BMA.EHR.Solution.sln index ba13b20e..1a2f8197 100644 --- a/BMA.EHR.Solution.sln +++ b/BMA.EHR.Solution.sln @@ -7,9 +7,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Domain", "BMA.EHR.D 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}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "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}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.MetaData.Service", "BMA.EHR.MetaData.Service\BMA.EHR.MetaData.Service.csproj", "{939DD34A-C7AE-406E-B557-33F69AC64127}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F3C2F68F-8DC8-45A3-825B-24F17867D380}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "API", "API", "{FA618F0C-1AF5-49AB-AE13-C020B403B64F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -37,6 +41,13 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {9CA80F00-2D6E-4A0B-9C4B-80CE3EDFAB96} = {F3C2F68F-8DC8-45A3-825B-24F17867D380} + {C9656B6D-D24B-40AD-929E-CDED3FE53DCE} = {F3C2F68F-8DC8-45A3-825B-24F17867D380} + {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} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3111A492-1818-4438-B718-75199D8E779A} EndGlobalSection