no message
This commit is contained in:
commit
e50f3ccb35
35 changed files with 14834 additions and 52 deletions
|
|
@ -10,6 +10,7 @@ namespace BMA.EHR.Application
|
||||||
{
|
{
|
||||||
services.AddTransient<PrefixRepository>();
|
services.AddTransient<PrefixRepository>();
|
||||||
services.AddTransient<PlacementRepository>();
|
services.AddTransient<PlacementRepository>();
|
||||||
|
services.AddTransient<OrganizationEmployeeRepository>();
|
||||||
services.AddTransient<MessageQueueRepository>();
|
services.AddTransient<MessageQueueRepository>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
using BMA.EHR.Application.Common.Interfaces;
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using BMA.EHR.Domain.Models.OrganizationEmployee;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Application.Repositories
|
||||||
|
{
|
||||||
|
public class OrganizationEmployeeRepository : GenericRepository<Guid, OrgEmployee>
|
||||||
|
{
|
||||||
|
private readonly IApplicationDBContext _dbContext;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
public OrganizationEmployeeRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||||
|
{
|
||||||
|
_dbContext = dbContext;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<OrgEmployee>> FindByIdAsync(Guid id)
|
||||||
|
{
|
||||||
|
var data = await _dbContext.Set<OrgEmployee>().Where(x => x.Id == id).ToListAsync();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using BMA.EHR.Domain.Models.Organizations;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.OrganizationEmployee
|
||||||
|
{
|
||||||
|
public class OrgEmployee : EntityBase
|
||||||
|
{
|
||||||
|
public string? Agency { get; set; }
|
||||||
|
public string? ConditionNote { get; set; }
|
||||||
|
public string? Department { get; set; }
|
||||||
|
public string? Government { get; set; }
|
||||||
|
public bool? IsActive { get; set; }
|
||||||
|
public bool? IsCondition { get; set; }
|
||||||
|
public bool? IsDirector { get; set; }
|
||||||
|
public string? OrganizationUserNote { get; set; }
|
||||||
|
public string? Qualification { get; set; }
|
||||||
|
public string? Pile { get; set; }
|
||||||
|
public string? PosNo { get; set; }
|
||||||
|
public string? PositionCondition { get; set; }
|
||||||
|
public string? PositionMasterUserNote { get; set; }
|
||||||
|
public string? OrganizationOrder { get; set; }
|
||||||
|
|
||||||
|
public OrganizationFax? OrganizationFax { get; set; }
|
||||||
|
public OrganizationLevel? OrganizationLevel { get; set; }
|
||||||
|
public OrganizationOrganization? OrganizationOrganization { get; set; }
|
||||||
|
public OrganizationTelExternal? OrganizationTelExternal { get; set; }
|
||||||
|
public OrganizationTelInternal? OrganizationTelInternal { get; set; }
|
||||||
|
public OrganizationType? OrganizationType { get; set; }
|
||||||
|
|
||||||
|
public PositionEmployeeStatus? PositionEmployeeStatus { get; set; }
|
||||||
|
// public PositionEmployeeType? PositionEmployeeType { get; set; }
|
||||||
|
// public PositionEmployeeExecutive? PositionEmployeeExecutive { get; set; }
|
||||||
|
public PositionEmployeeLine? PositionEmployeeLine { get; set; }
|
||||||
|
public PositionEmployeePosition? PositionEmployeePosition { get; set; }
|
||||||
|
// public PositionEmployeeExecutiveSide? PositionEmployeeExecutiveSide { get; set; }
|
||||||
|
public OrganizationEntity? OrganizationAgency { get; set; }
|
||||||
|
public OrganizationEntity? OrganizationGovernmentAgency { get; set; }
|
||||||
|
public OrganizationShortName? OrganizationShortName { get; set; }
|
||||||
|
public virtual List<OrganizationPositionEmployeeLevel> OrganizationPositionEmployeeLevels { get; set; } = new List<OrganizationPositionEmployeeLevel>();
|
||||||
|
public virtual List<OrganizationPositionEmployeePositionSide> OrganizationPositionEmployeePositionSides { get; set; } = new List<OrganizationPositionEmployeePositionSide>();
|
||||||
|
public Profile? Profile { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.OrganizationEmployee
|
||||||
|
{
|
||||||
|
public class OrganizationPositionEmployeeLevel : EntityBase
|
||||||
|
{
|
||||||
|
public OrgEmployee? OrganizationEmployee { get; set; }
|
||||||
|
public PositionEmployeeLevel? PositionEmployeeLevel { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
using BMA.EHR.Domain.Models.Base;
|
||||||
|
using BMA.EHR.Domain.Models.HR;
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Domain.Models.OrganizationEmployee
|
||||||
|
{
|
||||||
|
public class OrganizationPositionEmployeePositionSide : EntityBase
|
||||||
|
{
|
||||||
|
public OrgEmployee? OrganizationEmployee { get; set; }
|
||||||
|
public PositionEmployeePositionSide? PositionEmployeePositionSide { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -59,5 +59,9 @@
|
||||||
public static readonly string CertificateNotFound = "ไม่พบข้อมูลใบประกอบอาชีพ";
|
public static readonly string CertificateNotFound = "ไม่พบข้อมูลใบประกอบอาชีพ";
|
||||||
public static readonly string EducationNotFound = "ไม่พบข้อมูลประวัติการศึกษา";
|
public static readonly string EducationNotFound = "ไม่พบข้อมูลประวัติการศึกษา";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " OrganizationEmployee "
|
||||||
|
public static readonly string OrganizationEmployeeNotFound = "ไม่พบข้อมูลโครงสร้างตำแหน่งลูกจ้าง";
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10790
BMA.EHR.Infrastructure/Migrations/20230712161241_Add table OrganizationEmployees.Designer.cs
generated
Normal file
10790
BMA.EHR.Infrastructure/Migrations/20230712161241_Add table OrganizationEmployees.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,306 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddtableOrganizationEmployees : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrganizationEmployees",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Agency = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
ConditionNote = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Department = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Government = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: true),
|
||||||
|
IsCondition = table.Column<bool>(type: "tinyint(1)", nullable: true),
|
||||||
|
IsDirector = table.Column<bool>(type: "tinyint(1)", nullable: true),
|
||||||
|
OrganizationUserNote = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Qualification = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
Pile = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
PosNo = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
PositionCondition = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
PositionMasterUserNote = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
OrganizationOrder = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
OrganizationFaxId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationOrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationTelExternalId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationTelInternalId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationTypeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
PositionEmployeeStatusId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
PositionEmployeeLineId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
PositionEmployeePositionId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationAgencyId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationGovernmentAgencyId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OrganizationShortNameId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
ProfileId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrganizationEmployees", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_OrganizationFaxs_OrganizationFaxId",
|
||||||
|
column: x => x.OrganizationFaxId,
|
||||||
|
principalTable: "OrganizationFaxs",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_OrganizationLevels_OrganizationLevelId",
|
||||||
|
column: x => x.OrganizationLevelId,
|
||||||
|
principalTable: "OrganizationLevels",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_OrganizationOrganizations_Organization~",
|
||||||
|
column: x => x.OrganizationOrganizationId,
|
||||||
|
principalTable: "OrganizationOrganizations",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_OrganizationShortNames_OrganizationSho~",
|
||||||
|
column: x => x.OrganizationShortNameId,
|
||||||
|
principalTable: "OrganizationShortNames",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_OrganizationTelExternals_OrganizationT~",
|
||||||
|
column: x => x.OrganizationTelExternalId,
|
||||||
|
principalTable: "OrganizationTelExternals",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_OrganizationTelInternals_OrganizationT~",
|
||||||
|
column: x => x.OrganizationTelInternalId,
|
||||||
|
principalTable: "OrganizationTelInternals",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_OrganizationTypes_OrganizationTypeId",
|
||||||
|
column: x => x.OrganizationTypeId,
|
||||||
|
principalTable: "OrganizationTypes",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_Organizations_OrganizationAgencyId",
|
||||||
|
column: x => x.OrganizationAgencyId,
|
||||||
|
principalTable: "Organizations",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_Organizations_OrganizationGovernmentAg~",
|
||||||
|
column: x => x.OrganizationGovernmentAgencyId,
|
||||||
|
principalTable: "Organizations",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_PositionEmployeeLines_PositionEmployee~",
|
||||||
|
column: x => x.PositionEmployeeLineId,
|
||||||
|
principalTable: "PositionEmployeeLines",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_PositionEmployeePositions_PositionEmpl~",
|
||||||
|
column: x => x.PositionEmployeePositionId,
|
||||||
|
principalTable: "PositionEmployeePositions",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_PositionEmployeeStatuses_PositionEmplo~",
|
||||||
|
column: x => x.PositionEmployeeStatusId,
|
||||||
|
principalTable: "PositionEmployeeStatuses",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationEmployees_Profiles_ProfileId",
|
||||||
|
column: x => x.ProfileId,
|
||||||
|
principalTable: "Profiles",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrganizationPositionEmployeeLevels",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
OrganizationEmployeeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
PositionEmployeeLevelId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrganizationPositionEmployeeLevels", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationPositionEmployeeLevels_OrganizationEmployees_Org~",
|
||||||
|
column: x => x.OrganizationEmployeeId,
|
||||||
|
principalTable: "OrganizationEmployees",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationPositionEmployeeLevels_PositionEmployeeLevels_Po~",
|
||||||
|
column: x => x.PositionEmployeeLevelId,
|
||||||
|
principalTable: "PositionEmployeeLevels",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrganizationPositionEmployeePositionSides",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||||
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||||
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
OrganizationEmployeeId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
PositionEmployeePositionSideId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrganizationPositionEmployeePositionSides", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationPositionEmployeePositionSides_OrganizationEmploy~",
|
||||||
|
column: x => x.OrganizationEmployeeId,
|
||||||
|
principalTable: "OrganizationEmployees",
|
||||||
|
principalColumn: "Id");
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrganizationPositionEmployeePositionSides_PositionEmployeePo~",
|
||||||
|
column: x => x.PositionEmployeePositionSideId,
|
||||||
|
principalTable: "PositionEmployeePositionSides",
|
||||||
|
principalColumn: "Id");
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationAgencyId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationAgencyId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationFaxId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationFaxId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationGovernmentAgencyId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationGovernmentAgencyId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationLevelId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationLevelId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationOrganizationId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationOrganizationId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationShortNameId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationShortNameId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationTelExternalId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationTelExternalId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationTelInternalId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationTelInternalId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_OrganizationTypeId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "OrganizationTypeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_PositionEmployeeLineId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "PositionEmployeeLineId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_PositionEmployeePositionId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "PositionEmployeePositionId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_PositionEmployeeStatusId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "PositionEmployeeStatusId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationEmployees_ProfileId",
|
||||||
|
table: "OrganizationEmployees",
|
||||||
|
column: "ProfileId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationPositionEmployeeLevels_OrganizationEmployeeId",
|
||||||
|
table: "OrganizationPositionEmployeeLevels",
|
||||||
|
column: "OrganizationEmployeeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationPositionEmployeeLevels_PositionEmployeeLevelId",
|
||||||
|
table: "OrganizationPositionEmployeeLevels",
|
||||||
|
column: "PositionEmployeeLevelId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationPositionEmployeePositionSides_OrganizationEmploy~",
|
||||||
|
table: "OrganizationPositionEmployeePositionSides",
|
||||||
|
column: "OrganizationEmployeeId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_OrganizationPositionEmployeePositionSides_PositionEmployeePo~",
|
||||||
|
table: "OrganizationPositionEmployeePositionSides",
|
||||||
|
column: "PositionEmployeePositionSideId");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrganizationPositionEmployeeLevels");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrganizationPositionEmployeePositionSides");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrganizationEmployees");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7326,6 +7326,165 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.ToTable("SubDistricts");
|
b.ToTable("SubDistricts");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<string>("Agency")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("ConditionNote")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("Department")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Government")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<bool?>("IsActive")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<bool?>("IsCondition")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<bool?>("IsDirector")
|
||||||
|
.HasColumnType("tinyint(1)");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationAgencyId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationFaxId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationGovernmentAgencyId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationLevelId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("OrganizationOrder")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationOrganizationId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationShortNameId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationTelExternalId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationTelInternalId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationTypeId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("OrganizationUserNote")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("Pile")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("PosNo")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<string>("PositionCondition")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PositionEmployeeLineId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PositionEmployeePositionId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PositionEmployeeStatusId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("PositionMasterUserNote")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ProfileId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("Qualification")
|
||||||
|
.HasColumnType("longtext");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationAgencyId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationFaxId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationGovernmentAgencyId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationLevelId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationOrganizationId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationShortNameId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationTelExternalId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationTelInternalId");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationTypeId");
|
||||||
|
|
||||||
|
b.HasIndex("PositionEmployeeLineId");
|
||||||
|
|
||||||
|
b.HasIndex("PositionEmployeePositionId");
|
||||||
|
|
||||||
|
b.HasIndex("PositionEmployeeStatusId");
|
||||||
|
|
||||||
|
b.HasIndex("ProfileId");
|
||||||
|
|
||||||
|
b.ToTable("OrganizationEmployees");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -7354,6 +7513,25 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnOrder(101)
|
.HasColumnOrder(101)
|
||||||
.HasComment("User Id ที่สร้างข้อมูล");
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
b.Property<bool>("IsSend")
|
b.Property<bool>("IsSend")
|
||||||
.HasColumnType("tinyint(1)")
|
.HasColumnType("tinyint(1)")
|
||||||
.HasComment("ทำการส่งข้อความแล้วหรือยัง?");
|
.HasComment("ทำการส่งข้อความแล้วหรือยัง?");
|
||||||
|
|
@ -7369,6 +7547,97 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<bool>("IsSendNotification")
|
b.Property<bool>("IsSendNotification")
|
||||||
.HasColumnType("tinyint(1)")
|
.HasColumnType("tinyint(1)")
|
||||||
.HasComment("ส่งการแจ้งเตือนหรือไม่?");
|
.HasComment("ส่งการแจ้งเตือนหรือไม่?");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(105)
|
||||||
|
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<string>("LastUpdateUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(103)
|
||||||
|
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("LastUpdatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(102)
|
||||||
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationEmployeeId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PositionEmployeeLevelId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationEmployeeId");
|
||||||
|
|
||||||
|
b.HasIndex("PositionEmployeeLevelId");
|
||||||
|
|
||||||
|
b.ToTable("OrganizationPositionEmployeeLevels");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
|
||||||
|
{
|
||||||
|
b.Property<Guid>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasColumnOrder(0)
|
||||||
|
.HasComment("PrimaryKey")
|
||||||
|
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAt")
|
||||||
|
.HasColumnType("datetime(6)")
|
||||||
|
.HasColumnOrder(100)
|
||||||
|
.HasComment("สร้างข้อมูลเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedFullName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(200)
|
||||||
|
.HasColumnType("varchar(200)")
|
||||||
|
.HasColumnOrder(104)
|
||||||
|
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||||
|
|
||||||
|
b.Property<string>("CreatedUserId")
|
||||||
|
.IsRequired()
|
||||||
|
.HasMaxLength(40)
|
||||||
|
.HasColumnType("varchar(40)")
|
||||||
|
.HasColumnOrder(101)
|
||||||
|
.HasComment("User Id ที่สร้างข้อมูล");
|
||||||
|
|
||||||
b.Property<string>("LastUpdateFullName")
|
b.Property<string>("LastUpdateFullName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
|
|
@ -7389,6 +7658,19 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnOrder(102)
|
.HasColumnOrder(102)
|
||||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<Guid?>("OrganizationEmployeeId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<Guid?>("PositionEmployeePositionSideId")
|
||||||
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrganizationEmployeeId");
|
||||||
|
|
||||||
|
b.HasIndex("PositionEmployeePositionSideId");
|
||||||
|
|
||||||
|
b.ToTable("OrganizationPositionEmployeePositionSides");
|
||||||
b.Property<string>("MessageContent")
|
b.Property<string>("MessageContent")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
|
|
@ -9924,6 +10206,117 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("District");
|
b.Navigation("District");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationAgency")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationAgencyId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationFax", "OrganizationFax")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationFaxId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "OrganizationGovernmentAgency")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationGovernmentAgencyId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationLevel", "OrganizationLevel")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationLevelId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationOrganizationId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationShortName", "OrganizationShortName")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationShortNameId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelExternal", "OrganizationTelExternal")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationTelExternalId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationTelInternal", "OrganizationTelInternal")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationTelInternalId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationType", "OrganizationType")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrganizationTypeId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLine", "PositionEmployeeLine")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PositionEmployeeLineId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePosition", "PositionEmployeePosition")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PositionEmployeePositionId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeStatus", "PositionEmployeeStatus")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PositionEmployeeStatusId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ProfileId");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationAgency");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationFax");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationGovernmentAgency");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationLevel");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationOrganization");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationShortName");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationTelExternal");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationTelInternal");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationType");
|
||||||
|
|
||||||
|
b.Navigation("PositionEmployeeLine");
|
||||||
|
|
||||||
|
b.Navigation("PositionEmployeePosition");
|
||||||
|
|
||||||
|
b.Navigation("PositionEmployeeStatus");
|
||||||
|
|
||||||
|
b.Navigation("Profile");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeeLevel", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee")
|
||||||
|
.WithMany("OrganizationPositionEmployeeLevels")
|
||||||
|
.HasForeignKey("OrganizationEmployeeId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeeLevel", "PositionEmployeeLevel")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PositionEmployeeLevelId");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationEmployee");
|
||||||
|
|
||||||
|
b.Navigation("PositionEmployeeLevel");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", "OrganizationEmployee")
|
||||||
|
.WithMany("OrganizationPositionEmployeePositionSides")
|
||||||
|
.HasForeignKey("OrganizationEmployeeId");
|
||||||
|
|
||||||
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionEmployeePositionSide", "PositionEmployeePositionSide")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PositionEmployeePositionSideId");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationEmployee");
|
||||||
|
|
||||||
|
b.Navigation("PositionEmployeePositionSide");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
|
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
|
||||||
|
|
@ -10459,6 +10852,13 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("Districts");
|
b.Navigation("Districts");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrgEmployee", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("OrganizationPositionEmployeeLevels");
|
||||||
|
|
||||||
|
b.Navigation("OrganizationPositionEmployeePositionSides");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Organizations");
|
b.Navigation("Organizations");
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using BMA.EHR.Domain.Models.Commands;
|
||||||
using BMA.EHR.Domain.Models.Documents;
|
using BMA.EHR.Domain.Models.Documents;
|
||||||
using BMA.EHR.Domain.Models.HR;
|
using BMA.EHR.Domain.Models.HR;
|
||||||
using BMA.EHR.Domain.Models.MetaData;
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using BMA.EHR.Domain.Models.OrganizationEmployee;
|
||||||
using BMA.EHR.Domain.Models.Notifications;
|
using BMA.EHR.Domain.Models.Notifications;
|
||||||
using BMA.EHR.Domain.Models.Organizations;
|
using BMA.EHR.Domain.Models.Organizations;
|
||||||
using BMA.EHR.Domain.Models.Organizations.Report2;
|
using BMA.EHR.Domain.Models.Organizations.Report2;
|
||||||
|
|
@ -250,6 +251,14 @@ namespace BMA.EHR.Infrastructure.Persistence
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " OrganizationEmployee "
|
||||||
|
|
||||||
|
public DbSet<OrgEmployee> OrganizationEmployees { get; set; }
|
||||||
|
public DbSet<OrganizationPositionEmployeeLevel> OrganizationPositionEmployeeLevels { get; set; }
|
||||||
|
public DbSet<OrganizationPositionEmployeePositionSide> OrganizationPositionEmployeePositionSides { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region " Command "
|
#region " Command "
|
||||||
|
|
||||||
public DbSet<DeploymentChannel> DeploymentChannels { get; set; }
|
public DbSet<DeploymentChannel> DeploymentChannels { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
BucketName = _bucketName,
|
BucketName = _bucketName,
|
||||||
Key = doc?.ObjectRefId.ToString("D"),
|
Key = doc?.ObjectRefId.ToString("D"),
|
||||||
Expires = expires,
|
Expires = expires,
|
||||||
Protocol = _protocol =="HTTPS"?Protocol.HTTPS: Protocol.HTTP
|
Protocol = _protocol == "HTTPS" ? Protocol.HTTPS : Protocol.HTTP
|
||||||
};
|
};
|
||||||
string path = _s3Client.GetPreSignedURL(request);
|
string path = _s3Client.GetPreSignedURL(request);
|
||||||
|
|
||||||
|
|
@ -215,7 +215,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ret = new List<Guid>();
|
var ret = new List<Guid>();
|
||||||
if(id == null)
|
if (id == null)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
var oc = _context.Organizations.FirstOrDefault(x => x.Id == id);
|
var oc = _context.Organizations.FirstOrDefault(x => x.Id == id);
|
||||||
|
|
@ -245,12 +245,12 @@ namespace BMA.EHR.Application.Repositories
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return null;
|
return null;
|
||||||
if (data.ProfileType.Trim().ToUpper() == "OFFICER")
|
if (data.ProfileType.Trim().ToUpper() == "OFFICER")
|
||||||
return "officer";
|
return "OFFICER";
|
||||||
if (data.EmployeeClass.Trim().ToUpper() == "PERM")
|
if (data.EmployeeClass.Trim().ToUpper() == "PERM")
|
||||||
return "employee_perm";
|
return "EMPLOYEE_PERM";
|
||||||
if (data.EmployeeClass.Trim().ToUpper() == "TEMP")
|
if (data.EmployeeClass.Trim().ToUpper() == "TEMP")
|
||||||
return "employee_temp";
|
return "EMPLOYEE_TEMP";
|
||||||
return "employee";
|
return "EMPLOYEE";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,29 +1,36 @@
|
||||||
{
|
{
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"MinimumLevel": {
|
"MinimumLevel": {
|
||||||
"Default": "Information",
|
"Default": "Information",
|
||||||
"Override": {
|
"Override": {
|
||||||
"Microsoft": "Information",
|
"Microsoft": "Information",
|
||||||
"System": "Warning"
|
"System": "Warning"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
"ElasticConfiguration": {
|
||||||
"ElasticConfiguration": {
|
"Uri": "http://localhost:9200"
|
||||||
"Uri": "http://localhost:9200"
|
},
|
||||||
},
|
"AllowedHosts": "*",
|
||||||
"AllowedHosts": "*",
|
"ConnectionStrings": {
|
||||||
"ConnectionStrings": {
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
},
|
||||||
},
|
"Jwt": {
|
||||||
"Jwt": {
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||||
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
},
|
||||||
},
|
"EPPlus": {
|
||||||
"EPPlus": {
|
"ExcelPackage": {
|
||||||
"ExcelPackage": {
|
"LicenseContext": "NonCommercial"
|
||||||
"LicenseContext": "NonCommercial"
|
}
|
||||||
}
|
},
|
||||||
},
|
"MinIO": {
|
||||||
"Protocol": "HTTPS"
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
}
|
"AccessKey": "frappet",
|
||||||
|
"SecretKey": "P@ssw0rd",
|
||||||
|
"BucketName": "bma-recruit"
|
||||||
|
},
|
||||||
|
"Protocol": "HTTPS"
|
||||||
|
}
|
||||||
|
|
||||||
46
BMA.EHR.OrganizationEmployee.Service/.github/workflows/build-local.yaml
vendored
Normal file
46
BMA.EHR.OrganizationEmployee.Service/.github/workflows/build-local.yaml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
# use for local build with act
|
||||||
|
name: build-local
|
||||||
|
run-name: build-local ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.frappet.com
|
||||||
|
IMAGE_NAME: demo/bma-ehr-metadata-service
|
||||||
|
jobs:
|
||||||
|
# act workflow_dispatch -W .github/workflows/build-local.yaml --input IMAGE_VER=test-v6.1
|
||||||
|
build-local:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
# skip Set up QEMU because it fail on act and container
|
||||||
|
- name: Gen Version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||||
|
- name: Test Version
|
||||||
|
run: |
|
||||||
|
echo $GITHUB_REF
|
||||||
|
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
# - name: Login in to registry
|
||||||
|
# uses: docker/login-action@v2
|
||||||
|
# with:
|
||||||
|
# registry: ${{env.REGISTRY}}
|
||||||
|
# username: ${{secrets.DOCKER_USER}}
|
||||||
|
# password: ${{secrets.DOCKER_PASS}}
|
||||||
|
- name: Build and load local docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64
|
||||||
|
load: true
|
||||||
|
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||||
86
BMA.EHR.OrganizationEmployee.Service/.github/workflows/release.yaml
vendored
Normal file
86
BMA.EHR.OrganizationEmployee.Service/.github/workflows/release.yaml
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
name: release-dev
|
||||||
|
run-name: release-dev ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
# push:
|
||||||
|
# tags:
|
||||||
|
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
# tags-ignore:
|
||||||
|
# - '2.*'
|
||||||
|
# Allow run workflow manually from Action tab
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.frappet.com
|
||||||
|
IMAGE_NAME: ehr/bma-ehr-org-employee-service
|
||||||
|
DEPLOY_HOST: frappet.com
|
||||||
|
COMPOSE_PATH: /home/frappet/docker/bma-ehr-org-employee
|
||||||
|
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||||
|
release-dev:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
# skip Set up QEMU because it fail on act and container
|
||||||
|
- name: Gen Version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||||
|
- name: Test Version
|
||||||
|
run: |
|
||||||
|
echo $GITHUB_REF
|
||||||
|
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{env.REGISTRY}}
|
||||||
|
username: ${{secrets.DOCKER_USER}}
|
||||||
|
password: ${{secrets.DOCKER_PASS}}
|
||||||
|
- name: Build and load local docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||||
|
|
||||||
|
- name: Reload docker compose
|
||||||
|
uses: appleboy/ssh-action@v0.1.8
|
||||||
|
with:
|
||||||
|
host: ${{env.DEPLOY_HOST}}
|
||||||
|
username: frappet
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
cd "${{env.COMPOSE_PATH}}"
|
||||||
|
docker-compose pull
|
||||||
|
docker-compose up -d
|
||||||
|
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||||
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
|
# if: success()
|
||||||
|
# with:
|
||||||
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
|
# message: |
|
||||||
|
# -Success✅✅✅
|
||||||
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
|
# if: failure()
|
||||||
|
# with:
|
||||||
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
|
# message: |
|
||||||
|
# -Failure❌❌❌
|
||||||
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net7.0</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<UserSecretsId>3d68209a-41b1-4d00-914e-b895d74467c0</UserSecretsId>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<DockerfileContext>.</DockerfileContext>
|
||||||
|
<RootNamespace>BMA.EHR.OrganizationEmployee.Service</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.9" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="6.32.0" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.18.1" />
|
||||||
|
<PackageReference Include="runtime.osx.10.10-x64.CoreCompat.System.Drawing" Version="6.0.5.128" />
|
||||||
|
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
|
||||||
|
<PackageReference Include="Sentry.AspNetCore" Version="3.33.1" />
|
||||||
|
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
|
||||||
|
<PackageReference Include="Serilog.Exceptions" Version="8.4.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.Elasticsearch" Version="9.0.3" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\BMA.EHR.API.Command\BMA.EHR.API.Command.csproj" />
|
||||||
|
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -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.OrganizationEmployee.Service
|
||||||
|
{
|
||||||
|
public class ConfigureSwaggerOptions : IConfigureNamedOptions<SwaggerGenOptions>
|
||||||
|
{
|
||||||
|
private readonly IApiVersionDescriptionProvider _provider;
|
||||||
|
|
||||||
|
public ConfigureSwaggerOptions(
|
||||||
|
IApiVersionDescriptionProvider provider)
|
||||||
|
{
|
||||||
|
_provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure(SwaggerGenOptions options)
|
||||||
|
{
|
||||||
|
// add swagger document for every API version discovered
|
||||||
|
foreach (var description in _provider.ApiVersionDescriptions)
|
||||||
|
{
|
||||||
|
options.EnableAnnotations();
|
||||||
|
|
||||||
|
options.SwaggerDoc(
|
||||||
|
description.GroupName,
|
||||||
|
CreateVersionInfo(description));
|
||||||
|
}
|
||||||
|
|
||||||
|
options.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
In = ParameterLocation.Header,
|
||||||
|
Description = "Please enter a valid token",
|
||||||
|
Name = "Authorization",
|
||||||
|
Type = SecuritySchemeType.Http,
|
||||||
|
BearerFormat = "JWT",
|
||||||
|
Scheme = "Bearer"
|
||||||
|
});
|
||||||
|
|
||||||
|
options.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
|
{
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Reference = new OpenApiReference
|
||||||
|
{
|
||||||
|
Type = ReferenceType.SecurityScheme,
|
||||||
|
Id = "Bearer"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new string[]{}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// generate the XML docs that'll drive the swagger docs
|
||||||
|
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
|
||||||
|
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
|
||||||
|
options.IncludeXmlComments(xmlPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure(string name, SwaggerGenOptions options)
|
||||||
|
{
|
||||||
|
Configure(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
private OpenApiInfo CreateVersionInfo(
|
||||||
|
ApiVersionDescription desc)
|
||||||
|
{
|
||||||
|
var info = new OpenApiInfo()
|
||||||
|
{
|
||||||
|
Title = "BMA EHR OrganizationEmployee 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,347 @@
|
||||||
|
using System.Security.Claims;
|
||||||
|
using BMA.EHR.Application.Repositories;
|
||||||
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
|
using BMA.EHR.Domain.Models.OrganizationEmployee;
|
||||||
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
using BMA.EHR.OrganizationEmployee.Service.Requests;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.OrganizationEmployee.Service.Controllers
|
||||||
|
{
|
||||||
|
[Route("api/v{version:apiVersion}/organization-employee")]
|
||||||
|
[ApiVersion("1.0")]
|
||||||
|
[ApiController]
|
||||||
|
[Produces("application/json")]
|
||||||
|
[Authorize]
|
||||||
|
[SwaggerTag("โครงสร้างตำแหน่งลูกจ้าง")]
|
||||||
|
public class OrganizationEmployeeController : BaseController
|
||||||
|
{
|
||||||
|
private readonly ApplicationDBContext _context;
|
||||||
|
private readonly MinIOService _documentService;
|
||||||
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
|
public OrganizationEmployeeController(ApplicationDBContext context,
|
||||||
|
MinIOService documentService,
|
||||||
|
IHttpContextAccessor httpContextAccessor)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_documentService = documentService;
|
||||||
|
_httpContextAccessor = httpContextAccessor;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region " Properties "
|
||||||
|
|
||||||
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
[HttpGet()]
|
||||||
|
public async Task<ActionResult<ResponseObject>> Get()
|
||||||
|
{
|
||||||
|
var data = await _context.OrganizationEmployees.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Agency = x.Agency,
|
||||||
|
ConditionNote = x.ConditionNote,
|
||||||
|
Department = x.Department,
|
||||||
|
Government = x.Government,
|
||||||
|
IsActive = x.IsActive,
|
||||||
|
IsCondition = x.IsCondition,
|
||||||
|
IsDirector = x.IsDirector,
|
||||||
|
OrganizationUserNote = x.OrganizationUserNote,
|
||||||
|
Qualification = x.Qualification,
|
||||||
|
Pile = x.Pile,
|
||||||
|
PosNo = x.PosNo,
|
||||||
|
PositionCondition = x.PositionCondition,
|
||||||
|
PositionMasterUserNote = x.PositionMasterUserNote,
|
||||||
|
OrganizationOrder = x.OrganizationOrder,
|
||||||
|
|
||||||
|
OrganizationFaxId = x.OrganizationFax == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationFax.Id,
|
||||||
|
OrganizationLevelId = x.OrganizationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationLevel.Id,
|
||||||
|
OrganizationOrganizationId = x.OrganizationOrganization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationOrganization.Id,
|
||||||
|
OrganizationTelExternalId = x.OrganizationTelExternal == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationTelExternal.Id,
|
||||||
|
OrganizationTelInternalId = x.OrganizationTelInternal == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationTelInternal.Id,
|
||||||
|
OrganizationTypeId = x.OrganizationType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationType.Id,
|
||||||
|
PositionEmployeeStatusId = x.PositionEmployeeStatus == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionEmployeeStatus.Id,
|
||||||
|
PositionEmployeeLineId = x.PositionEmployeeLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionEmployeeLine.Id,
|
||||||
|
PositionEmployeePositionId = x.PositionEmployeePosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionEmployeePosition.Id,
|
||||||
|
OrganizationAgencyId = x.OrganizationAgency == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationAgency.Id,
|
||||||
|
OrganizationGovernmentAgencyId = x.OrganizationGovernmentAgency == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationGovernmentAgency.Id,
|
||||||
|
OrganizationShortNameId = x.OrganizationShortName == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationShortName.Id,
|
||||||
|
|
||||||
|
OrganizationFax = x.OrganizationFax == null ? null : x.OrganizationFax.Name,
|
||||||
|
OrganizationLevel = x.OrganizationLevel == null ? null : x.OrganizationLevel.Name,
|
||||||
|
OrganizationOrganization = x.OrganizationOrganization == null ? null : x.OrganizationOrganization.Name,
|
||||||
|
OrganizationTelExternal = x.OrganizationTelExternal == null ? null : x.OrganizationTelExternal.Name,
|
||||||
|
OrganizationTelInternal = x.OrganizationTelInternal == null ? null : x.OrganizationTelInternal.Name,
|
||||||
|
OrganizationType = x.OrganizationType == null ? null : x.OrganizationType.Name,
|
||||||
|
PositionEmployeeStatus = x.PositionEmployeeStatus == null ? null : x.PositionEmployeeStatus.Name,
|
||||||
|
PositionEmployeeLine = x.PositionEmployeeLine == null ? null : x.PositionEmployeeLine.Name,
|
||||||
|
PositionEmployeePosition = x.PositionEmployeePosition == null ? null : x.PositionEmployeePosition.Name,
|
||||||
|
OrganizationAgencyCode = x.OrganizationShortName == null ? null : x.OrganizationShortName.AgencyCode,
|
||||||
|
OrganizationGovernmentAgencyCode = x.OrganizationShortName == null ? null : x.OrganizationShortName.GovernmentCode,
|
||||||
|
// OrganizationAgency = x.OrganizationAgency == null ? null : x.OrganizationAgency.Name,
|
||||||
|
// OrganizationGovernmentAgency = x.OrganizationGovernmentAgency == null ? null : x.OrganizationGovernmentAgency.Name,
|
||||||
|
OrganizationShortName = x.OrganizationShortName == null ? null : x.OrganizationShortName.Name,
|
||||||
|
PositionEmployeeLevels = x.OrganizationPositionEmployeeLevels.Select(y => new
|
||||||
|
{
|
||||||
|
Id = y.PositionEmployeeLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : y.PositionEmployeeLevel.Id,
|
||||||
|
Name = y.PositionEmployeeLevel == null ? null : y.PositionEmployeeLevel.Name,
|
||||||
|
}),
|
||||||
|
PositionEmployeePositionSides = x.OrganizationPositionEmployeePositionSides.Select(y => new
|
||||||
|
{
|
||||||
|
Id = y.PositionEmployeePositionSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : y.PositionEmployeePositionSide.Id,
|
||||||
|
Name = y.PositionEmployeePositionSide == null ? null : y.PositionEmployeePositionSide.Name,
|
||||||
|
}),
|
||||||
|
}).ToListAsync();
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{orgEmployeeId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetById(Guid orgEmployeeId)
|
||||||
|
{
|
||||||
|
var data = await _context.OrganizationEmployees.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Agency = x.Agency,
|
||||||
|
ConditionNote = x.ConditionNote,
|
||||||
|
Department = x.Department,
|
||||||
|
Government = x.Government,
|
||||||
|
IsActive = x.IsActive,
|
||||||
|
IsCondition = x.IsCondition,
|
||||||
|
IsDirector = x.IsDirector,
|
||||||
|
OrganizationUserNote = x.OrganizationUserNote,
|
||||||
|
Qualification = x.Qualification,
|
||||||
|
Pile = x.Pile,
|
||||||
|
PosNo = x.PosNo,
|
||||||
|
PositionCondition = x.PositionCondition,
|
||||||
|
PositionMasterUserNote = x.PositionMasterUserNote,
|
||||||
|
OrganizationOrder = x.OrganizationOrder,
|
||||||
|
|
||||||
|
OrganizationFaxId = x.OrganizationFax == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationFax.Id,
|
||||||
|
OrganizationLevelId = x.OrganizationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationLevel.Id,
|
||||||
|
OrganizationOrganizationId = x.OrganizationOrganization == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationOrganization.Id,
|
||||||
|
OrganizationTelExternalId = x.OrganizationTelExternal == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationTelExternal.Id,
|
||||||
|
OrganizationTelInternalId = x.OrganizationTelInternal == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationTelInternal.Id,
|
||||||
|
OrganizationTypeId = x.OrganizationType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationType.Id,
|
||||||
|
PositionEmployeeStatusId = x.PositionEmployeeStatus == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionEmployeeStatus.Id,
|
||||||
|
PositionEmployeeLineId = x.PositionEmployeeLine == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionEmployeeLine.Id,
|
||||||
|
PositionEmployeePositionId = x.PositionEmployeePosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionEmployeePosition.Id,
|
||||||
|
OrganizationAgencyId = x.OrganizationAgency == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationAgency.Id,
|
||||||
|
OrganizationGovernmentAgencyId = x.OrganizationGovernmentAgency == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationGovernmentAgency.Id,
|
||||||
|
OrganizationShortNameId = x.OrganizationShortName == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.OrganizationShortName.Id,
|
||||||
|
|
||||||
|
OrganizationFaxName = x.OrganizationFax == null ? null : x.OrganizationFax.Name,
|
||||||
|
OrganizationLevelName = x.OrganizationLevel == null ? null : x.OrganizationLevel.Name,
|
||||||
|
OrganizationOrganizationName = x.OrganizationOrganization == null ? null : x.OrganizationOrganization.Name,
|
||||||
|
OrganizationTelExternalName = x.OrganizationTelExternal == null ? null : x.OrganizationTelExternal.Name,
|
||||||
|
OrganizationTelInternalName = x.OrganizationTelInternal == null ? null : x.OrganizationTelInternal.Name,
|
||||||
|
OrganizationTypeName = x.OrganizationType == null ? null : x.OrganizationType.Name,
|
||||||
|
PositionEmployeeStatusName = x.PositionEmployeeStatus == null ? null : x.PositionEmployeeStatus.Name,
|
||||||
|
PositionEmployeeLineName = x.PositionEmployeeLine == null ? null : x.PositionEmployeeLine.Name,
|
||||||
|
PositionEmployeePositionName = x.PositionEmployeePosition == null ? null : x.PositionEmployeePosition.Name,
|
||||||
|
OrganizationAgencyName = x.OrganizationShortName == null ? null : x.OrganizationShortName.AgencyCode,
|
||||||
|
OrganizationGovernmentAgencyName = x.OrganizationShortName == null ? null : x.OrganizationShortName.GovernmentCode,
|
||||||
|
// OrganizationAgencyName = x.OrganizationAgency == null ? null : x.OrganizationAgency.Name,
|
||||||
|
// OrganizationGovernmentAgencyName = x.OrganizationGovernmentAgency == null ? null : x.OrganizationGovernmentAgency.Name,
|
||||||
|
OrganizationShortNameName = x.OrganizationShortName == null ? null : x.OrganizationShortName.Name,
|
||||||
|
PositionEmployeeLevels = x.OrganizationPositionEmployeeLevels.Select(y => new
|
||||||
|
{
|
||||||
|
Id = y.PositionEmployeeLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : y.PositionEmployeeLevel.Id,
|
||||||
|
Name = y.PositionEmployeeLevel == null ? null : y.PositionEmployeeLevel.Name,
|
||||||
|
}),
|
||||||
|
PositionEmployeePositionSides = x.OrganizationPositionEmployeePositionSides.Select(y => new
|
||||||
|
{
|
||||||
|
Id = y.PositionEmployeePositionSide == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : y.PositionEmployeePositionSide.Id,
|
||||||
|
Name = y.PositionEmployeePositionSide == null ? null : y.PositionEmployeePositionSide.Name,
|
||||||
|
}),
|
||||||
|
}).FirstOrDefaultAsync(x => x.Id == orgEmployeeId);
|
||||||
|
if (data == null)
|
||||||
|
return Error(GlobalMessages.OrganizationEmployeeNotFound, 404);
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost()]
|
||||||
|
public async Task<ActionResult<ResponseObject>> Post([FromBody] PersonAddressRequest req)
|
||||||
|
{
|
||||||
|
var positionEmployeeLevel = new List<OrganizationPositionEmployeeLevel>();
|
||||||
|
foreach (var p in req.PositionEmployeeLevelsId)
|
||||||
|
{
|
||||||
|
var _data = new OrganizationPositionEmployeeLevel
|
||||||
|
{
|
||||||
|
PositionEmployeeLevel = await _context.PositionEmployeeLevels.FindAsync(p),
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
positionEmployeeLevel.Add(_data);
|
||||||
|
}
|
||||||
|
var positionEmployeePositionSide = new List<OrganizationPositionEmployeePositionSide>();
|
||||||
|
foreach (var p in req.PositionEmployeePositionSidesId)
|
||||||
|
{
|
||||||
|
var _data = new OrganizationPositionEmployeePositionSide
|
||||||
|
{
|
||||||
|
PositionEmployeePositionSide = await _context.PositionEmployeePositionSides.FindAsync(p),
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
positionEmployeePositionSide.Add(_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = new OrgEmployee
|
||||||
|
{
|
||||||
|
Agency = req.Agency,
|
||||||
|
ConditionNote = req.ConditionNote,
|
||||||
|
Department = req.Department,
|
||||||
|
Government = req.Government,
|
||||||
|
IsActive = req.IsActive,
|
||||||
|
IsCondition = req.IsCondition,
|
||||||
|
IsDirector = req.IsDirector,
|
||||||
|
OrganizationUserNote = req.OrganizationUserNote,
|
||||||
|
Qualification = req.Qualification,
|
||||||
|
Pile = req.Pile,
|
||||||
|
PosNo = req.PosNo,
|
||||||
|
PositionCondition = req.PositionCondition,
|
||||||
|
PositionMasterUserNote = req.PositionMasterUserNote,
|
||||||
|
OrganizationOrder = req.OrganizationOrder,
|
||||||
|
OrganizationFax = await _context.OrganizationFaxs.FindAsync(req.OrganizationFaxId),
|
||||||
|
OrganizationLevel = await _context.OrganizationLevels.FindAsync(req.OrganizationLevelId),
|
||||||
|
OrganizationOrganization = await _context.OrganizationOrganizations.FindAsync(req.OrganizationOrganizationId),
|
||||||
|
OrganizationTelExternal = await _context.OrganizationTelExternals.FindAsync(req.OrganizationTelExternalId),
|
||||||
|
OrganizationTelInternal = await _context.OrganizationTelInternals.FindAsync(req.OrganizationTelInternalId),
|
||||||
|
OrganizationType = await _context.OrganizationTypes.FindAsync(req.OrganizationTypeId),
|
||||||
|
PositionEmployeeStatus = await _context.PositionEmployeeStatuses.FindAsync(req.PositionEmployeeStatusId),
|
||||||
|
PositionEmployeeLine = await _context.PositionEmployeeLines.FindAsync(req.PositionEmployeeLineId),
|
||||||
|
PositionEmployeePosition = await _context.PositionEmployeePositions.FindAsync(req.PositionEmployeePositionId),
|
||||||
|
OrganizationAgency = await _context.Organizations.FindAsync(req.OrganizationAgencyId),
|
||||||
|
OrganizationGovernmentAgency = await _context.Organizations.FindAsync(req.OrganizationGovernmentAgencyId),
|
||||||
|
OrganizationShortName = await _context.OrganizationShortNames.FindAsync(req.OrganizationShortNameId),
|
||||||
|
OrganizationPositionEmployeeLevels = positionEmployeeLevel,
|
||||||
|
OrganizationPositionEmployeePositionSides = positionEmployeePositionSide,
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
await _context.OrganizationEmployees.AddAsync(data);
|
||||||
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
return Success("placement");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("{orgEmployeeId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> Put([FromBody] PersonAddressRequest req, Guid orgEmployeeId)
|
||||||
|
{
|
||||||
|
var organizationEmployee = await _context.OrganizationEmployees
|
||||||
|
.Include(x => x.OrganizationPositionEmployeeLevels)
|
||||||
|
.Include(x => x.OrganizationPositionEmployeePositionSides)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == orgEmployeeId);
|
||||||
|
if (organizationEmployee == null)
|
||||||
|
return Error(GlobalMessages.OrganizationEmployeeNotFound, 404);
|
||||||
|
|
||||||
|
_context.OrganizationPositionEmployeeLevels.RemoveRange(organizationEmployee.OrganizationPositionEmployeeLevels);
|
||||||
|
_context.OrganizationPositionEmployeePositionSides.RemoveRange(organizationEmployee.OrganizationPositionEmployeePositionSides);
|
||||||
|
|
||||||
|
var positionEmployeeLevel = new List<OrganizationPositionEmployeeLevel>();
|
||||||
|
foreach (var p in req.PositionEmployeeLevelsId)
|
||||||
|
{
|
||||||
|
var _data = new OrganizationPositionEmployeeLevel
|
||||||
|
{
|
||||||
|
PositionEmployeeLevel = await _context.PositionEmployeeLevels.FindAsync(p),
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
positionEmployeeLevel.Add(_data);
|
||||||
|
}
|
||||||
|
var positionEmployeePositionSide = new List<OrganizationPositionEmployeePositionSide>();
|
||||||
|
foreach (var p in req.PositionEmployeePositionSidesId)
|
||||||
|
{
|
||||||
|
var _data = new OrganizationPositionEmployeePositionSide
|
||||||
|
{
|
||||||
|
PositionEmployeePositionSide = await _context.PositionEmployeePositionSides.FindAsync(p),
|
||||||
|
CreatedUserId = FullName ?? "",
|
||||||
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
CreatedAt = DateTime.Now,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
};
|
||||||
|
positionEmployeePositionSide.Add(_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
organizationEmployee.Agency = req.Agency;
|
||||||
|
organizationEmployee.ConditionNote = req.ConditionNote;
|
||||||
|
organizationEmployee.Department = req.Department;
|
||||||
|
organizationEmployee.Government = req.Government;
|
||||||
|
organizationEmployee.IsActive = req.IsActive;
|
||||||
|
organizationEmployee.IsCondition = req.IsCondition;
|
||||||
|
organizationEmployee.IsDirector = req.IsDirector;
|
||||||
|
organizationEmployee.OrganizationUserNote = req.OrganizationUserNote;
|
||||||
|
organizationEmployee.Qualification = req.Qualification;
|
||||||
|
organizationEmployee.Pile = req.Pile;
|
||||||
|
organizationEmployee.PosNo = req.PosNo;
|
||||||
|
organizationEmployee.PositionCondition = req.PositionCondition;
|
||||||
|
organizationEmployee.PositionMasterUserNote = req.PositionMasterUserNote;
|
||||||
|
organizationEmployee.OrganizationOrder = req.OrganizationOrder;
|
||||||
|
organizationEmployee.OrganizationFax = await _context.OrganizationFaxs.FindAsync(req.OrganizationFaxId);
|
||||||
|
organizationEmployee.OrganizationLevel = await _context.OrganizationLevels.FindAsync(req.OrganizationLevelId);
|
||||||
|
organizationEmployee.OrganizationOrganization = await _context.OrganizationOrganizations.FindAsync(req.OrganizationOrganizationId);
|
||||||
|
organizationEmployee.OrganizationTelExternal = await _context.OrganizationTelExternals.FindAsync(req.OrganizationTelExternalId);
|
||||||
|
organizationEmployee.OrganizationTelInternal = await _context.OrganizationTelInternals.FindAsync(req.OrganizationTelInternalId);
|
||||||
|
organizationEmployee.OrganizationType = await _context.OrganizationTypes.FindAsync(req.OrganizationTypeId);
|
||||||
|
organizationEmployee.PositionEmployeeStatus = await _context.PositionEmployeeStatuses.FindAsync(req.PositionEmployeeStatusId);
|
||||||
|
organizationEmployee.PositionEmployeeLine = await _context.PositionEmployeeLines.FindAsync(req.PositionEmployeeLineId);
|
||||||
|
organizationEmployee.PositionEmployeePosition = await _context.PositionEmployeePositions.FindAsync(req.PositionEmployeePositionId);
|
||||||
|
organizationEmployee.OrganizationAgency = await _context.Organizations.FindAsync(req.OrganizationAgencyId);
|
||||||
|
organizationEmployee.OrganizationGovernmentAgency = await _context.Organizations.FindAsync(req.OrganizationGovernmentAgencyId);
|
||||||
|
organizationEmployee.OrganizationShortName = await _context.OrganizationShortNames.FindAsync(req.OrganizationShortNameId);
|
||||||
|
organizationEmployee.OrganizationPositionEmployeeLevels = positionEmployeeLevel;
|
||||||
|
organizationEmployee.OrganizationPositionEmployeePositionSides = positionEmployeePositionSide;
|
||||||
|
organizationEmployee.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
organizationEmployee.LastUpdateUserId = UserId ?? "";
|
||||||
|
organizationEmployee.LastUpdatedAt = DateTime.Now;
|
||||||
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
return Success("placement");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{orgEmployeeId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> Delete(Guid orgEmployeeId)
|
||||||
|
{
|
||||||
|
var organizationEmployee = await _context.OrganizationEmployees
|
||||||
|
.Include(x => x.OrganizationPositionEmployeeLevels)
|
||||||
|
.Include(x => x.OrganizationPositionEmployeePositionSides)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == orgEmployeeId);
|
||||||
|
if (organizationEmployee == null)
|
||||||
|
return Error(GlobalMessages.OrganizationEmployeeNotFound, 404);
|
||||||
|
_context.OrganizationPositionEmployeeLevels.RemoveRange(organizationEmployee.OrganizationPositionEmployeeLevels);
|
||||||
|
_context.OrganizationPositionEmployeePositionSides.RemoveRange(organizationEmployee.OrganizationPositionEmployeePositionSides);
|
||||||
|
_context.OrganizationEmployees.Remove(organizationEmployee);
|
||||||
|
_context.SaveChanges();
|
||||||
|
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
BMA.EHR.OrganizationEmployee.Service/Dockerfile
Normal file
22
BMA.EHR.OrganizationEmployee.Service/Dockerfile
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
#See https://aka.ms/containerfastmode to understand 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.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj", "BMA.EHR.OrganizationEmployee.Service/"]
|
||||||
|
RUN dotnet restore "BMA.EHR.OrganizationEmployee.Service/BMA.EHR.OrganizationEmployee.Service.csproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/BMA.EHR.OrganizationEmployee.Service"
|
||||||
|
RUN dotnet build "BMA.EHR.OrganizationEmployee.Service.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
RUN dotnet publish "BMA.EHR.OrganizationEmployee.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.OrganizationEmployee.Service.dll"]
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Shared;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace BMA.EHR.OrganizationEmployee.Service
|
||||||
|
{
|
||||||
|
public class ErrorHandlerMiddleware
|
||||||
|
{
|
||||||
|
#region " Fields "
|
||||||
|
|
||||||
|
private readonly RequestDelegate _next;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Constructor and Destructor "
|
||||||
|
|
||||||
|
public ErrorHandlerMiddleware(RequestDelegate next)
|
||||||
|
{
|
||||||
|
_next = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region " Methods "
|
||||||
|
|
||||||
|
public async Task Invoke(HttpContext context)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _next(context);
|
||||||
|
|
||||||
|
var response = context.Response;
|
||||||
|
response.ContentType = "application/json";
|
||||||
|
|
||||||
|
var responseModel = new ResponseObject();
|
||||||
|
responseModel.Status = response.StatusCode;
|
||||||
|
|
||||||
|
if (responseModel.Status == (int)HttpStatusCode.Unauthorized)
|
||||||
|
{
|
||||||
|
responseModel.Message = GlobalMessages.NotAuthorized;
|
||||||
|
await response.WriteAsJsonAsync(responseModel);
|
||||||
|
}
|
||||||
|
if (responseModel.Status == (int)HttpStatusCode.Forbidden)
|
||||||
|
{
|
||||||
|
responseModel.Message = GlobalMessages.ForbiddenAccess;
|
||||||
|
await response.WriteAsJsonAsync(responseModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception error)
|
||||||
|
{
|
||||||
|
var response = context.Response;
|
||||||
|
response.ContentType = "application/json";
|
||||||
|
|
||||||
|
var responseModel = new ResponseObject();
|
||||||
|
responseModel.Status = response.StatusCode;
|
||||||
|
var msg = error.Message;
|
||||||
|
var inner = error.InnerException;
|
||||||
|
while (inner != null)
|
||||||
|
{
|
||||||
|
msg += $" {inner.Message}\r\n";
|
||||||
|
inner = inner.InnerException;
|
||||||
|
}
|
||||||
|
responseModel.Result = msg;
|
||||||
|
|
||||||
|
switch (response.StatusCode)
|
||||||
|
{
|
||||||
|
case (int)HttpStatusCode.Unauthorized:
|
||||||
|
responseModel.Message = GlobalMessages.NotAuthorized;
|
||||||
|
break;
|
||||||
|
case (int)HttpStatusCode.Forbidden:
|
||||||
|
responseModel.Message = GlobalMessages.ForbiddenAccess;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
responseModel.Status = (int)HttpStatusCode.InternalServerError;
|
||||||
|
responseModel.Message = GlobalMessages.ExceptionOccured;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
await response.WriteAsJsonAsync(responseModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
159
BMA.EHR.OrganizationEmployee.Service/Program.cs
Normal file
159
BMA.EHR.OrganizationEmployee.Service/Program.cs
Normal file
|
|
@ -0,0 +1,159 @@
|
||||||
|
using BMA.EHR.Application;
|
||||||
|
using BMA.EHR.Infrastructure;
|
||||||
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
using BMA.EHR.OrganizationEmployee.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);
|
||||||
|
{
|
||||||
|
var issuer = builder.Configuration["Jwt:Issuer"];
|
||||||
|
var key = builder.Configuration["Jwt:Key"];
|
||||||
|
|
||||||
|
|
||||||
|
IdentityModelEventSource.ShowPII = true;
|
||||||
|
|
||||||
|
builder.Services.AddHttpContextAccessor();
|
||||||
|
|
||||||
|
builder.Services.AddApiVersioning(opt =>
|
||||||
|
{
|
||||||
|
opt.DefaultApiVersion = new ApiVersion(1, 0);
|
||||||
|
opt.AssumeDefaultVersionWhenUnspecified = true;
|
||||||
|
opt.ReportApiVersions = true;
|
||||||
|
opt.ApiVersionReader = ApiVersionReader.Combine(new UrlSegmentApiVersionReader(),
|
||||||
|
new HeaderApiVersionReader("x-api-version"),
|
||||||
|
new MediaTypeApiVersionReader("x-api-version"));
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddVersionedApiExplorer(setup =>
|
||||||
|
{
|
||||||
|
setup.GroupNameFormat = "'v'VVV";
|
||||||
|
setup.SubstituteApiVersionInUrl = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.Services.AddEndpointsApiExplorer();
|
||||||
|
|
||||||
|
// Authorization
|
||||||
|
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).AddJwtBearer(opt =>
|
||||||
|
{
|
||||||
|
opt.RequireHttpsMetadata = false; //false for dev
|
||||||
|
opt.Authority = issuer;
|
||||||
|
opt.TokenValidationParameters = new()
|
||||||
|
{
|
||||||
|
ValidateIssuer = true,
|
||||||
|
ValidateAudience = false,
|
||||||
|
ValidateLifetime = true,
|
||||||
|
ValidateIssuerSigningKey = true,
|
||||||
|
ValidIssuer = issuer,
|
||||||
|
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key))
|
||||||
|
};
|
||||||
|
});
|
||||||
|
builder.Services.AddAuthorization();
|
||||||
|
|
||||||
|
// use serilog
|
||||||
|
ConfigureLogs();
|
||||||
|
builder.Host.UseSerilog();
|
||||||
|
|
||||||
|
// Add config CORS
|
||||||
|
builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
||||||
|
{
|
||||||
|
builder
|
||||||
|
.AllowAnyOrigin()
|
||||||
|
.AllowAnyMethod()
|
||||||
|
.AllowAnyHeader()
|
||||||
|
.SetIsOriginAllowedToAllowWildcardSubdomains();
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
// Add services to the container.
|
||||||
|
builder.Services.AddApplication();
|
||||||
|
builder.Services.AddPersistence(builder.Configuration);
|
||||||
|
|
||||||
|
builder.Services.AddControllers(options =>
|
||||||
|
{
|
||||||
|
options.SuppressAsyncSuffixInActionNames = false;
|
||||||
|
})
|
||||||
|
.AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
|
||||||
|
|
||||||
|
builder.Services.AddSwaggerGen();
|
||||||
|
builder.Services.ConfigureOptions<ConfigureSwaggerOptions>();
|
||||||
|
|
||||||
|
builder.Services.AddHealthChecks();
|
||||||
|
}
|
||||||
|
|
||||||
|
var app = builder.Build();
|
||||||
|
{
|
||||||
|
var apiVersionDescriptionProvider = app.Services.GetRequiredService<IApiVersionDescriptionProvider>();
|
||||||
|
|
||||||
|
if (app.Environment.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI(options =>
|
||||||
|
{
|
||||||
|
foreach (var description in apiVersionDescriptionProvider.ApiVersionDescriptions)
|
||||||
|
{
|
||||||
|
options.SwaggerEndpoint($"/swagger/{description.GroupName}/swagger.json",
|
||||||
|
description.GroupName.ToUpperInvariant());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
app.MapHealthChecks("/health");
|
||||||
|
|
||||||
|
//app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||||
|
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<ApplicationDBContext>();
|
||||||
|
await db.Database.MigrateAsync();
|
||||||
|
|
||||||
|
app.Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureLogs()
|
||||||
|
{
|
||||||
|
var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.AddJsonFile(
|
||||||
|
$"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json",
|
||||||
|
optional: true)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
Log.Logger = new LoggerConfiguration()
|
||||||
|
.Enrich.FromLogContext()
|
||||||
|
.MinimumLevel.Error()
|
||||||
|
.WriteTo.Console()
|
||||||
|
.Enrich.WithExceptionDetails()
|
||||||
|
.WriteTo.Elasticsearch(ConfigureElasticSink(configuration, environment ?? ""))
|
||||||
|
.Enrich.WithProperty("Environment", environment)
|
||||||
|
.ReadFrom.Configuration(configuration)
|
||||||
|
.CreateLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
ElasticsearchSinkOptions ConfigureElasticSink(IConfigurationRoot configuration, string environment)
|
||||||
|
{
|
||||||
|
return new ElasticsearchSinkOptions(new Uri(configuration["ElasticConfiguration:Uri"] ?? ""))
|
||||||
|
{
|
||||||
|
AutoRegisterTemplate = true,
|
||||||
|
IndexFormat = $"{Assembly.GetExecutingAssembly()?.GetName()?.Name?.ToLower().Replace(".", "-")}-{environment?.ToLower().Replace(".", "-")}"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "http://localhost:5195"
|
||||||
|
},
|
||||||
|
"https": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "swagger",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
},
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"applicationUrl": "https://localhost:7208;http://localhost:5195"
|
||||||
|
},
|
||||||
|
"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:2329",
|
||||||
|
"sslPort": 44319
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.OrganizationEmployee.Service.Requests
|
||||||
|
{
|
||||||
|
public class PersonAddressRequest
|
||||||
|
{
|
||||||
|
public string? Agency { get; set; }
|
||||||
|
public string? ConditionNote { get; set; }
|
||||||
|
public string? Department { get; set; }
|
||||||
|
public string? Government { get; set; }
|
||||||
|
public bool? IsActive { get; set; }
|
||||||
|
public bool? IsCondition { get; set; }
|
||||||
|
public bool? IsDirector { get; set; }
|
||||||
|
public string? OrganizationUserNote { get; set; }
|
||||||
|
public string? Qualification { get; set; }
|
||||||
|
public string? Pile { get; set; }
|
||||||
|
public string? PosNo { get; set; }
|
||||||
|
public string? PositionCondition { get; set; }
|
||||||
|
public string? PositionMasterUserNote { get; set; }
|
||||||
|
public string? OrganizationOrder { get; set; }
|
||||||
|
public string? OrganizationShortName { get; set; }
|
||||||
|
|
||||||
|
public Guid? OrganizationFaxId { get; set; }
|
||||||
|
public Guid? OrganizationLevelId { get; set; }
|
||||||
|
public Guid? OrganizationOrganizationId { get; set; }
|
||||||
|
public Guid? OrganizationTelExternalId { get; set; }
|
||||||
|
public Guid? OrganizationTelInternalId { get; set; }
|
||||||
|
public Guid? OrganizationTypeId { get; set; }
|
||||||
|
|
||||||
|
public Guid? PositionEmployeeStatusId { get; set; }
|
||||||
|
// public Guid? PositionEmployeeTypeId { get; set; }
|
||||||
|
// public Guid? PositionEmployeeExecutiveId { get; set; }
|
||||||
|
public Guid? PositionEmployeeLineId { get; set; }
|
||||||
|
public Guid? PositionEmployeePositionId { get; set; }
|
||||||
|
// public Guid? PositionEmployeeExecutiveSideId { get; set; }
|
||||||
|
public Guid? OrganizationAgencyId { get; set; }
|
||||||
|
public Guid? OrganizationGovernmentAgencyId { get; set; }
|
||||||
|
public Guid? OrganizationShortNameId { get; set; }
|
||||||
|
public Guid[] PositionEmployeeLevelsId { get; set; }
|
||||||
|
public Guid[] PositionEmployeePositionSidesId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Microsoft.AspNetCore": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
BMA.EHR.OrganizationEmployee.Service/appsettings.json
Normal file
36
BMA.EHR.OrganizationEmployee.Service/appsettings.json
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"Serilog": {
|
||||||
|
"MinimumLevel": {
|
||||||
|
"Default": "Information",
|
||||||
|
"Override": {
|
||||||
|
"Microsoft": "Information",
|
||||||
|
"System": "Warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ElasticConfiguration": {
|
||||||
|
"Uri": "http://localhost:9200"
|
||||||
|
},
|
||||||
|
"AllowedHosts": "*",
|
||||||
|
"ConnectionStrings": {
|
||||||
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
|
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
|
},
|
||||||
|
"Jwt": {
|
||||||
|
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||||
|
"Issuer": "https://identity.frappet.com/realms/bma-ehr"
|
||||||
|
},
|
||||||
|
"EPPlus": {
|
||||||
|
"ExcelPackage": {
|
||||||
|
"LicenseContext": "NonCommercial"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"MinIO": {
|
||||||
|
"Endpoint": "https://s3.frappet.com/",
|
||||||
|
"AccessKey": "frappet",
|
||||||
|
"SecretKey": "P@ssw0rd",
|
||||||
|
"BucketName": "bma-recruit"
|
||||||
|
},
|
||||||
|
"Protocol": "HTTPS"
|
||||||
|
}
|
||||||
|
|
||||||
9
BMA.EHR.OrganizationEmployee.Service/nuget.config
Normal file
9
BMA.EHR.OrganizationEmployee.Service/nuget.config
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<packageSources>
|
||||||
|
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
||||||
|
<clear />
|
||||||
|
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
|
||||||
|
<add key="private_nuget" value="https://nuget.frappet.synology.me/v3/index.json" />
|
||||||
|
</packageSources>
|
||||||
|
</configuration>
|
||||||
184
BMA.EHR.OrganizationEmployee.Service/wwwroot/index.html
Normal file
184
BMA.EHR.OrganizationEmployee.Service/wwwroot/index.html
Normal file
|
|
@ -0,0 +1,184 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
|
~ and other contributors as indicated by the @author tags.
|
||||||
|
~
|
||||||
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
~ you may not use this file except in compliance with the License.
|
||||||
|
~ You may obtain a copy of the License at
|
||||||
|
~
|
||||||
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
~
|
||||||
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
~ See the License for the specific language governing permissions and
|
||||||
|
~ limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="./keycloak.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button onclick="keycloak.login()">Login</button>
|
||||||
|
<button onclick="keycloak.login({ action: 'UPDATE_PASSWORD' })">Update Password</button>
|
||||||
|
<button onclick="keycloak.logout()">Logout</button>
|
||||||
|
<button onclick="keycloak.register()">Register</button>
|
||||||
|
<button onclick="keycloak.accountManagement()">Account</button>
|
||||||
|
<button onclick="refreshToken(9999)">Refresh Token</button>
|
||||||
|
<button onclick="refreshToken(30)">Refresh Token (if <30s validity)</button>
|
||||||
|
<button onclick="loadProfile()">Get Profile</button>
|
||||||
|
<button onclick="updateProfile()">Update profile</button>
|
||||||
|
<button onclick="loadUserInfo()">Get User Info</button>
|
||||||
|
<button onclick="output(keycloak.tokenParsed)">Show Token</button>
|
||||||
|
<button onclick="output(keycloak.refreshTokenParsed)">Show Refresh Token</button>
|
||||||
|
<button onclick="output(keycloak.idTokenParsed)">Show ID Token</button>
|
||||||
|
<button onclick="showExpires()">Show Expires</button>
|
||||||
|
<button onclick="output(keycloak)">Show Details</button>
|
||||||
|
<button onclick="output(keycloak.createLoginUrl())">Show Login URL</button>
|
||||||
|
<button onclick="output(keycloak.createLogoutUrl())">Show Logout URL</button>
|
||||||
|
<button onclick="output(keycloak.createRegisterUrl())">Show Register URL</button>
|
||||||
|
<button onclick="output(keycloak.createAccountUrl())">Show Account URL</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2>Result</h2>
|
||||||
|
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="output"></pre>
|
||||||
|
|
||||||
|
<h2>Events</h2>
|
||||||
|
<pre style="background-color: #ddd; border: 1px solid #ccc; padding: 10px; word-wrap: break-word; white-space: pre-wrap;" id="events"></pre>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function loadProfile() {
|
||||||
|
keycloak.loadUserProfile().success(function(profile) {
|
||||||
|
output(profile);
|
||||||
|
}).error(function() {
|
||||||
|
output('Failed to load profile');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateProfile() {
|
||||||
|
var url = keycloak.createAccountUrl().split('?')[0];
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
req.open('POST', url, true);
|
||||||
|
req.setRequestHeader('Accept', 'application/json');
|
||||||
|
req.setRequestHeader('Content-Type', 'application/json');
|
||||||
|
req.setRequestHeader('Authorization', 'bearer ' + keycloak.token);
|
||||||
|
|
||||||
|
req.onreadystatechange = function () {
|
||||||
|
if (req.readyState == 4) {
|
||||||
|
if (req.status == 200) {
|
||||||
|
output('Success');
|
||||||
|
} else {
|
||||||
|
output('Failed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
req.send('{"email":"myemail@foo.bar","firstName":"test","lastName":"bar"}');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadUserInfo() {
|
||||||
|
keycloak.loadUserInfo().success(function(userInfo) {
|
||||||
|
output(userInfo);
|
||||||
|
}).error(function() {
|
||||||
|
output('Failed to load user info');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshToken(minValidity) {
|
||||||
|
keycloak.updateToken(minValidity).then(function(refreshed) {
|
||||||
|
if (refreshed) {
|
||||||
|
output(keycloak.tokenParsed);
|
||||||
|
} else {
|
||||||
|
output('Token not refreshed, valid for ' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds');
|
||||||
|
}
|
||||||
|
}).catch(function() {
|
||||||
|
output('Failed to refresh token');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showExpires() {
|
||||||
|
if (!keycloak.tokenParsed) {
|
||||||
|
output("Not authenticated");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var o = 'Token Expires:\t\t' + new Date((keycloak.tokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||||
|
o += 'Token Expires in:\t' + Math.round(keycloak.tokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds\n';
|
||||||
|
|
||||||
|
if (keycloak.refreshTokenParsed) {
|
||||||
|
o += 'Refresh Token Expires:\t' + new Date((keycloak.refreshTokenParsed.exp + keycloak.timeSkew) * 1000).toLocaleString() + '\n';
|
||||||
|
o += 'Refresh Expires in:\t' + Math.round(keycloak.refreshTokenParsed.exp + keycloak.timeSkew - new Date().getTime() / 1000) + ' seconds';
|
||||||
|
}
|
||||||
|
|
||||||
|
output(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
function output(data) {
|
||||||
|
if (typeof data === 'object') {
|
||||||
|
data = JSON.stringify(data, null, ' ');
|
||||||
|
}
|
||||||
|
document.getElementById('output').innerHTML = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function event(event) {
|
||||||
|
var e = document.getElementById('events').innerHTML;
|
||||||
|
document.getElementById('events').innerHTML = new Date().toLocaleString() + "\t" + event + "\n" + e;
|
||||||
|
}
|
||||||
|
|
||||||
|
var keycloak = Keycloak();
|
||||||
|
|
||||||
|
keycloak.onAuthSuccess = function () {
|
||||||
|
event('Auth Success');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthError = function (errorData) {
|
||||||
|
event("Auth Error: " + JSON.stringify(errorData) );
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthRefreshSuccess = function () {
|
||||||
|
event('Auth Refresh Success');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthRefreshError = function () {
|
||||||
|
event('Auth Refresh Error');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onAuthLogout = function () {
|
||||||
|
event('Auth Logout');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onTokenExpired = function () {
|
||||||
|
event('Access token expired.');
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.onActionUpdate = function (status) {
|
||||||
|
switch (status) {
|
||||||
|
case 'success':
|
||||||
|
event('Action completed successfully'); break;
|
||||||
|
case 'cancelled':
|
||||||
|
event('Action cancelled by user'); break;
|
||||||
|
case 'error':
|
||||||
|
event('Action failed'); break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Flow can be changed to 'implicit' or 'hybrid', but then client must enable implicit flow in admin console too
|
||||||
|
var initOptions = {
|
||||||
|
responseMode: 'fragment',
|
||||||
|
flow: 'standard'
|
||||||
|
};
|
||||||
|
|
||||||
|
keycloak.init(initOptions).then(function(authenticated) {
|
||||||
|
output('Init Success (' + (authenticated ? 'Authenticated' : 'Not Authenticated') + ')');
|
||||||
|
}).catch(function() {
|
||||||
|
output('Init Error');
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1766
BMA.EHR.OrganizationEmployee.Service/wwwroot/keycloak.js
Normal file
1766
BMA.EHR.OrganizationEmployee.Service/wwwroot/keycloak.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"realm": "bma-ehr",
|
||||||
|
"auth-server-url": "https://identity.frappet.com",
|
||||||
|
"ssl-required": "external",
|
||||||
|
"resource": "bma-ehr",
|
||||||
|
"public-client": true
|
||||||
|
}
|
||||||
25
BMA.EHR.Placement.Service/.dockerignore
Normal file
25
BMA.EHR.Placement.Service/.dockerignore
Normal file
|
|
@ -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
|
||||||
46
BMA.EHR.Placement.Service/.github/workflows/build-local.yaml
vendored
Normal file
46
BMA.EHR.Placement.Service/.github/workflows/build-local.yaml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
# use for local build with act
|
||||||
|
name: build-local
|
||||||
|
run-name: build-local ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.frappet.com
|
||||||
|
IMAGE_NAME: demo/bma-ehr-metadata-service
|
||||||
|
jobs:
|
||||||
|
# act workflow_dispatch -W .github/workflows/build-local.yaml --input IMAGE_VER=test-v6.1
|
||||||
|
build-local:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
# skip Set up QEMU because it fail on act and container
|
||||||
|
- name: Gen Version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||||
|
- name: Test Version
|
||||||
|
run: |
|
||||||
|
echo $GITHUB_REF
|
||||||
|
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
# - name: Login in to registry
|
||||||
|
# uses: docker/login-action@v2
|
||||||
|
# with:
|
||||||
|
# registry: ${{env.REGISTRY}}
|
||||||
|
# username: ${{secrets.DOCKER_USER}}
|
||||||
|
# password: ${{secrets.DOCKER_PASS}}
|
||||||
|
- name: Build and load local docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64
|
||||||
|
load: true
|
||||||
|
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||||
86
BMA.EHR.Placement.Service/.github/workflows/release.yaml
vendored
Normal file
86
BMA.EHR.Placement.Service/.github/workflows/release.yaml
vendored
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
name: release-dev
|
||||||
|
run-name: release-dev ${{ github.actor }}
|
||||||
|
on:
|
||||||
|
# push:
|
||||||
|
# tags:
|
||||||
|
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
# tags-ignore:
|
||||||
|
# - '2.*'
|
||||||
|
# Allow run workflow manually from Action tab
|
||||||
|
workflow_dispatch:
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.frappet.com
|
||||||
|
IMAGE_NAME: ehr/bma-ehr-placement-service
|
||||||
|
DEPLOY_HOST: frappet.com
|
||||||
|
COMPOSE_PATH: /home/frappet/docker/bma-ehr-placement
|
||||||
|
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# act workflow_dispatch -W .github/workflows/release.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||||
|
release-dev:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
# skip Set up QEMU because it fail on act and container
|
||||||
|
- name: Gen Version
|
||||||
|
id: gen_ver
|
||||||
|
run: |
|
||||||
|
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||||
|
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||||
|
else
|
||||||
|
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
fi
|
||||||
|
if [[ $IMAGE_VER == '' ]]; then
|
||||||
|
IMAGE_VER='test-vBeta'
|
||||||
|
fi
|
||||||
|
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||||
|
- name: Test Version
|
||||||
|
run: |
|
||||||
|
echo $GITHUB_REF
|
||||||
|
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{env.REGISTRY}}
|
||||||
|
username: ${{secrets.DOCKER_USER}}
|
||||||
|
password: ${{secrets.DOCKER_PASS}}
|
||||||
|
- name: Build and load local docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||||
|
|
||||||
|
- name: Reload docker compose
|
||||||
|
uses: appleboy/ssh-action@v0.1.8
|
||||||
|
with:
|
||||||
|
host: ${{env.DEPLOY_HOST}}
|
||||||
|
username: frappet
|
||||||
|
password: ${{ secrets.SSH_PASSWORD }}
|
||||||
|
port: 22
|
||||||
|
script: |
|
||||||
|
cd "${{env.COMPOSE_PATH}}"
|
||||||
|
docker-compose pull
|
||||||
|
docker-compose up -d
|
||||||
|
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||||
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
|
# if: success()
|
||||||
|
# with:
|
||||||
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
|
# message: |
|
||||||
|
# -Success✅✅✅
|
||||||
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
|
# - uses: snow-actions/line-notify@v1.1.0
|
||||||
|
# if: failure()
|
||||||
|
# with:
|
||||||
|
# access_token: ${{ env.TOKEN_LINE }}
|
||||||
|
# message: |
|
||||||
|
# -Failure❌❌❌
|
||||||
|
# Image: ${{env.IMAGE_NAME}}
|
||||||
|
# Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||||
|
# By: ${{secrets.DOCKER_USER}}
|
||||||
|
|
@ -15,10 +15,11 @@ using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace BMA.EHR.Placement.Service.Controllers
|
namespace BMA.EHR.Placement.Service.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]/placement")]
|
[Route("api/v{version:apiVersion}/placement")]
|
||||||
[ApiController]
|
[ApiVersion("1.0")]
|
||||||
[Produces("application/json")]
|
[ApiController]
|
||||||
[Authorize]
|
[Produces("application/json")]
|
||||||
|
[Authorize]
|
||||||
[SwaggerTag("ระบบบรรจุ")]
|
[SwaggerTag("ระบบบรรจุ")]
|
||||||
public class PlacementController : BaseController
|
public class PlacementController : BaseController
|
||||||
{
|
{
|
||||||
|
|
@ -261,6 +262,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
|
PositionPath = p.PositionPath == null ? null : p.PositionPath.Name,
|
||||||
IsEducation = p.IsEducation,
|
IsEducation = p.IsEducation,
|
||||||
}),
|
}),
|
||||||
|
RegistAddress = x.RegistAddress,
|
||||||
RegistSubDistrict = x.RegistSubDistrict == null ? null : x.RegistSubDistrict.Name,
|
RegistSubDistrict = x.RegistSubDistrict == null ? null : x.RegistSubDistrict.Name,
|
||||||
RegistSubDistrictId = x.RegistSubDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistSubDistrict.Id,
|
RegistSubDistrictId = x.RegistSubDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistSubDistrict.Id,
|
||||||
RegistZipCode = x.RegistSubDistrict == null ? null : x.RegistSubDistrict.ZipCode,
|
RegistZipCode = x.RegistSubDistrict == null ? null : x.RegistSubDistrict.ZipCode,
|
||||||
|
|
@ -268,6 +270,7 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
RegistDistrictId = x.RegistDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistDistrict.Id,
|
RegistDistrictId = x.RegistDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistDistrict.Id,
|
||||||
RegistProvince = x.RegistProvince == null ? null : x.RegistProvince.Name,
|
RegistProvince = x.RegistProvince == null ? null : x.RegistProvince.Name,
|
||||||
RegistProvinceId = x.RegistProvince == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistProvince.Id,
|
RegistProvinceId = x.RegistProvince == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.RegistProvince.Id,
|
||||||
|
CurrentAddress = x.CurrentAddress,
|
||||||
CurrentSubDistrict = x.CurrentSubDistrict == null ? null : x.CurrentSubDistrict.Name,
|
CurrentSubDistrict = x.CurrentSubDistrict == null ? null : x.CurrentSubDistrict.Name,
|
||||||
CurrentSubDistrictId = x.CurrentSubDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.CurrentSubDistrict.Id,
|
CurrentSubDistrictId = x.CurrentSubDistrict == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.CurrentSubDistrict.Id,
|
||||||
CurrentZipCode = x.CurrentSubDistrict == null ? null : x.CurrentSubDistrict.ZipCode,
|
CurrentZipCode = x.CurrentSubDistrict == null ? null : x.CurrentSubDistrict.ZipCode,
|
||||||
|
|
@ -336,20 +339,44 @@ namespace BMA.EHR.Placement.Service.Controllers
|
||||||
[HttpGet("pass/stat/{examId:length(36)}")]
|
[HttpGet("pass/stat/{examId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetDashboardByPlacement(Guid examId)
|
public async Task<ActionResult<ResponseObject>> GetDashboardByPlacement(Guid examId)
|
||||||
{
|
{
|
||||||
var placement = await _context.Placements
|
if (PlacementAdmin == true)
|
||||||
.Where(x => x.Id == examId)
|
{
|
||||||
.Select(x => new
|
var placement = await _context.Placements
|
||||||
{
|
.Where(x => x.Id == examId)
|
||||||
Total = x.PlacementProfiles.Count(),
|
.Select(x => new
|
||||||
UnContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
|
{
|
||||||
PrepareContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
|
Total = x.PlacementProfiles.Count(),
|
||||||
Contain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
|
UnContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
|
||||||
Disclaim = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
|
PrepareContain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
|
||||||
}).FirstOrDefaultAsync();
|
Contain = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
|
||||||
if (placement == null)
|
Disclaim = x.PlacementProfiles.Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
|
||||||
return Error(GlobalMessages.DataNotFound, 404);
|
}).FirstOrDefaultAsync();
|
||||||
|
if (placement == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
return Success(placement);
|
return Success(placement);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var profileOrg = await _context.Profiles.FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId ?? "00000000-0000-0000-0000-000000000000"));
|
||||||
|
if (profileOrg == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
var ocIdList = _documentService.GetAllIdByRoot(profileOrg.OcId);
|
||||||
|
var placement = await _context.Placements
|
||||||
|
.Where(x => x.Id == examId)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Total = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Count(),
|
||||||
|
UnContain = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "UN-CONTAIN").Count(),
|
||||||
|
PrepareContain = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "PREPARE-CONTAIN").Count(),
|
||||||
|
Contain = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "CONTAIN").Count(),
|
||||||
|
Disclaim = x.PlacementProfiles.Where(p => ocIdList.Contains(p.OrganizationPosition.Organization.Id)).Where(p => p.PlacementStatus.Trim().ToUpper() == "DISCLAIM").Count(),
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
if (placement == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
return Success(placement);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("pass/deferment"), DisableRequestSizeLimit]
|
[HttpPost("pass/deferment"), DisableRequestSizeLimit]
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,13 @@ EXPOSE 443
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj", "BMA.EHR.Placement.Service/"]
|
|
||||||
RUN dotnet restore "BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj"
|
COPY ["BMA.EHR.Application.csproj", "./BMA.EHR.Application"]
|
||||||
|
COPY ["BMA.EHR.Domain.csproj", "./BMA.EHR.Domain"]
|
||||||
|
COPY ["BMA.EHR.Infrastructure.csproj", "./BMA.EHR.Infrastructure"]
|
||||||
|
|
||||||
|
COPY ["BMA.EHR.Placement.Service.csproj", "./BMA.EHR.Placement.Service"]
|
||||||
|
RUN dotnet restore "./BMA.EHR.Placement.Service/BMA.EHR.Placement.Service.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/BMA.EHR.Placement.Service"
|
WORKDIR "/src/BMA.EHR.Placement.Service"
|
||||||
RUN dotnet build "BMA.EHR.Placement.Service.csproj" -c Release -o /app/build
|
RUN dotnet build "BMA.EHR.Placement.Service.csproj" -c Release -o /app/build
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,10 @@
|
||||||
"AllowedHosts": "*",
|
"AllowedHosts": "*",
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
|
||||||
|
<<<<<<< HEAD
|
||||||
// "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
// "DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
|
=======
|
||||||
|
>>>>>>> develop
|
||||||
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
"DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||||
},
|
},
|
||||||
"Jwt": {
|
"Jwt": {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.API.Command", "BMA.
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Placement.Service", "BMA.EHR.Placement.Service\BMA.EHR.Placement.Service.csproj", "{81610EF7-AF80-44D8-9263-925C821CF45F}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BMA.EHR.Placement.Service", "BMA.EHR.Placement.Service\BMA.EHR.Placement.Service.csproj", "{81610EF7-AF80-44D8-9263-925C821CF45F}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.OrganizationEmployee.Service", "BMA.EHR.OrganizationEmployee.Service\BMA.EHR.OrganizationEmployee.Service.csproj", "{A54AA069-8B0E-4784-953B-5DA9F9C8285E}"
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMA.EHR.Report.Service", "BMA.EHR.Report.Service\BMA.EHR.Report.Service.csproj", "{AC4B2602-C543-4165-85D7-F6F92F553D80}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
|
@ -51,6 +52,10 @@ Global
|
||||||
{81610EF7-AF80-44D8-9263-925C821CF45F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{81610EF7-AF80-44D8-9263-925C821CF45F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{81610EF7-AF80-44D8-9263-925C821CF45F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{81610EF7-AF80-44D8-9263-925C821CF45F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{81610EF7-AF80-44D8-9263-925C821CF45F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{81610EF7-AF80-44D8-9263-925C821CF45F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A54AA069-8B0E-4784-953B-5DA9F9C8285E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A54AA069-8B0E-4784-953B-5DA9F9C8285E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A54AA069-8B0E-4784-953B-5DA9F9C8285E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A54AA069-8B0E-4784-953B-5DA9F9C8285E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{AC4B2602-C543-4165-85D7-F6F92F553D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
|
@ -67,6 +72,7 @@ Global
|
||||||
{FA618F0C-1AF5-49AB-AE13-C020B403B64F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
|
{FA618F0C-1AF5-49AB-AE13-C020B403B64F} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
|
||||||
{FC7215BD-5651-4226-9210-8894E8FA8767} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
|
{FC7215BD-5651-4226-9210-8894E8FA8767} = {F3C2F68F-8DC8-45A3-825B-24F17867D380}
|
||||||
{81610EF7-AF80-44D8-9263-925C821CF45F} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
{81610EF7-AF80-44D8-9263-925C821CF45F} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||||
|
{A54AA069-8B0E-4784-953B-5DA9F9C8285E} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||||
{AC4B2602-C543-4165-85D7-F6F92F553D80} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
{AC4B2602-C543-4165-85D7-F6F92F553D80} = {FA618F0C-1AF5-49AB-AE13-C020B403B64F}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue