Add Command Controller Code (Not Complete)

This commit is contained in:
suphonchai Phoonsawat 2023-07-20 14:53:09 +07:00
parent 9ee5b86a26
commit 7f5ed43f3f
27 changed files with 58797 additions and 84 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,314 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class ChangeCommandTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Command_CommandStatuses_CommandStatusId",
table: "Command");
migrationBuilder.DropForeignKey(
name: "FK_Command_CommandTypes_CommandTypeId",
table: "Command");
migrationBuilder.DropForeignKey(
name: "FK_CommandDocuments_Command_CommandId",
table: "CommandDocuments");
migrationBuilder.DropPrimaryKey(
name: "PK_Command",
table: "Command");
migrationBuilder.DropColumn(
name: "Discriminator",
table: "Command");
migrationBuilder.RenameTable(
name: "Command",
newName: "Commands");
migrationBuilder.RenameIndex(
name: "IX_Command_CommandTypeId",
table: "Commands",
newName: "IX_Commands_CommandTypeId");
migrationBuilder.RenameIndex(
name: "IX_Command_CommandStatusId",
table: "Commands",
newName: "IX_Commands_CommandStatusId");
migrationBuilder.UpdateData(
table: "Commands",
keyColumn: "PositionName",
keyValue: null,
column: "PositionName",
value: "");
migrationBuilder.AlterColumn<string>(
name: "PositionName",
table: "Commands",
type: "longtext",
nullable: false,
comment: "ตำแหน่งที่บรรจุ",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ตำแหน่งที่บรรจุ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "ExamRoundId",
table: "Commands",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
comment: "อ้างอิงรอบการสอบ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "อ้างอิงรอบการสอบ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.UpdateData(
table: "Commands",
keyColumn: "ConclusionResultNo",
keyValue: null,
column: "ConclusionResultNo",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ConclusionResultNo",
table: "Commands",
type: "longtext",
nullable: false,
comment: "มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<DateTime>(
name: "ConclusionResultDate",
table: "Commands",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
migrationBuilder.UpdateData(
table: "Commands",
keyColumn: "ConclusionRegisterNo",
keyValue: null,
column: "ConclusionRegisterNo",
value: "");
migrationBuilder.AlterColumn<string>(
name: "ConclusionRegisterNo",
table: "Commands",
type: "longtext",
nullable: false,
comment: "มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)",
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<DateTime>(
name: "ConclusionRegisterDate",
table: "Commands",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
comment: "ลงวันที่ (เรื่อง รับสมัครสอบฯ)",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true,
oldComment: "ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
migrationBuilder.AddPrimaryKey(
name: "PK_Commands",
table: "Commands",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CommandDocuments_Commands_CommandId",
table: "CommandDocuments",
column: "CommandId",
principalTable: "Commands",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Commands_CommandStatuses_CommandStatusId",
table: "Commands",
column: "CommandStatusId",
principalTable: "CommandStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Commands_CommandTypes_CommandTypeId",
table: "Commands",
column: "CommandTypeId",
principalTable: "CommandTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CommandDocuments_Commands_CommandId",
table: "CommandDocuments");
migrationBuilder.DropForeignKey(
name: "FK_Commands_CommandStatuses_CommandStatusId",
table: "Commands");
migrationBuilder.DropForeignKey(
name: "FK_Commands_CommandTypes_CommandTypeId",
table: "Commands");
migrationBuilder.DropPrimaryKey(
name: "PK_Commands",
table: "Commands");
migrationBuilder.RenameTable(
name: "Commands",
newName: "Command");
migrationBuilder.RenameIndex(
name: "IX_Commands_CommandTypeId",
table: "Command",
newName: "IX_Command_CommandTypeId");
migrationBuilder.RenameIndex(
name: "IX_Commands_CommandStatusId",
table: "Command",
newName: "IX_Command_CommandStatusId");
migrationBuilder.AlterColumn<string>(
name: "PositionName",
table: "Command",
type: "longtext",
nullable: true,
comment: "ตำแหน่งที่บรรจุ",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "ตำแหน่งที่บรรจุ")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<Guid>(
name: "ExamRoundId",
table: "Command",
type: "char(36)",
nullable: true,
comment: "อ้างอิงรอบการสอบ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldComment: "อ้างอิงรอบการสอบ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<string>(
name: "ConclusionResultNo",
table: "Command",
type: "longtext",
nullable: true,
comment: "มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<DateTime>(
name: "ConclusionResultDate",
table: "Command",
type: "datetime(6)",
nullable: true,
comment: "ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
migrationBuilder.AlterColumn<string>(
name: "ConclusionRegisterNo",
table: "Command",
type: "longtext",
nullable: true,
comment: "มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)",
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<DateTime>(
name: "ConclusionRegisterDate",
table: "Command",
type: "datetime(6)",
nullable: true,
comment: "ลงวันที่ (เรื่อง รับสมัครสอบฯ)",
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldComment: "ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
migrationBuilder.AddColumn<string>(
name: "Discriminator",
table: "Command",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddPrimaryKey(
name: "PK_Command",
table: "Command",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Command_CommandStatuses_CommandStatusId",
table: "Command",
column: "CommandStatusId",
principalTable: "CommandStatuses",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Command_CommandTypes_CommandTypeId",
table: "Command",
column: "CommandTypeId",
principalTable: "CommandTypes",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CommandDocuments_Command_CommandId",
table: "CommandDocuments",
column: "CommandId",
principalTable: "Command",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,55 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class addfieldtoCommandTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "CommandAffectDate",
table: "Commands",
type: "datetime(6)",
nullable: true,
comment: "วันที่คำสั่งมีผล");
migrationBuilder.AddColumn<DateTime>(
name: "CommandExcecuteDate",
table: "Commands",
type: "datetime(6)",
nullable: true,
comment: "วันที่ออกคำสั่ง");
migrationBuilder.AddColumn<string>(
name: "CommandSubject",
table: "Commands",
type: "varchar(500)",
maxLength: 500,
nullable: false,
defaultValue: "",
comment: "คำสั่งเรื่อง")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CommandAffectDate",
table: "Commands");
migrationBuilder.DropColumn(
name: "CommandExcecuteDate",
table: "Commands");
migrationBuilder.DropColumn(
name: "CommandSubject",
table: "Commands");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class addSequencetoCommandTypeTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Sequence",
table: "CommandTypes",
type: "int",
nullable: false,
defaultValue: 0,
comment: "ลำดับการทำงาน");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Sequence",
table: "CommandTypes");
}
}
}

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class RemoveSequencefromCommandTypeTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Sequence",
table: "CommandTypes");
migrationBuilder.AddColumn<int>(
name: "Sequence",
table: "CommandStatuses",
type: "int",
nullable: false,
defaultValue: 0,
comment: "ลำดับการทำงาน");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Sequence",
table: "CommandStatuses");
migrationBuilder.AddColumn<int>(
name: "Sequence",
table: "CommandTypes",
type: "int",
nullable: false,
defaultValue: 0,
comment: "ลำดับการทำงาน");
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddAuthorizedPositiontoCommandTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "AuthorizedPosition",
table: "Commands",
type: "longtext",
nullable: false,
comment: "ตำแหน่งผู้มีอำนาจลงนาม")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AuthorizedPosition",
table: "Commands");
}
}
}

View file

@ -28,6 +28,11 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("AuthorizedPosition")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ตำแหน่งผู้มีอำนาจลงนาม");
b.Property<string>("AuthorizedUserFullName")
.IsRequired()
.HasColumnType("longtext")
@ -37,6 +42,14 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงผู้มีอำนาจลงนาม");
b.Property<DateTime?>("CommandAffectDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่คำสั่งมีผล");
b.Property<DateTime?>("CommandExcecuteDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ออกคำสั่ง");
b.Property<string>("CommandNo")
.IsRequired()
.HasMaxLength(10)
@ -47,6 +60,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงสถานะคำสั่ง");
b.Property<string>("CommandSubject")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("varchar(500)")
.HasComment("คำสั่งเรื่อง");
b.Property<Guid>("CommandTypeId")
.HasColumnType("char(36)")
.HasComment("รหัสอ้างอิงประเภทคำสั่ง");
@ -57,6 +76,24 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(4)")
.HasComment("ปีที่ออกคำสั่ง");
b.Property<DateTime>("ConclusionRegisterDate")
.HasColumnType("datetime(6)")
.HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
b.Property<string>("ConclusionRegisterNo")
.IsRequired()
.HasColumnType("longtext")
.HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)");
b.Property<DateTime>("ConclusionResultDate")
.HasColumnType("datetime(6)")
.HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
b.Property<string>("ConclusionResultNo")
.IsRequired()
.HasColumnType("longtext")
.HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
@ -76,9 +113,9 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Discriminator")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("ExamRoundId")
.HasColumnType("char(36)")
.HasComment("อ้างอิงรอบการสอบ");
b.Property<Guid>("IssuerOrganizationId")
.HasColumnType("char(36)")
@ -108,17 +145,18 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("PositionName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ตำแหน่งที่บรรจุ");
b.HasKey("Id");
b.HasIndex("CommandStatusId");
b.HasIndex("CommandTypeId");
b.ToTable("Command");
b.HasDiscriminator<string>("Discriminator").HasValue("Command");
b.UseTphMappingStrategy();
b.ToTable("Commands");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
@ -241,6 +279,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(100)")
.HasComment("สถานะของคำสั่ง");
b.Property<int>("Sequence")
.HasColumnType("int")
.HasComment("ลำดับการทำงาน");
b.HasKey("Id");
b.ToTable("CommandStatuses");
@ -10227,40 +10269,6 @@ namespace BMA.EHR.Infrastructure.Migrations
b.ToTable("PlacementTypes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.PlacementCommand", b =>
{
b.HasBaseType("BMA.EHR.Domain.Models.Commands.Core.Command");
b.Property<DateTime>("ConclusionRegisterDate")
.HasColumnType("datetime(6)")
.HasComment("ลงวันที่ (เรื่อง รับสมัครสอบฯ)");
b.Property<string>("ConclusionRegisterNo")
.IsRequired()
.HasColumnType("longtext")
.HasComment("มติ กก. ครั้งที่ (เรื่อง รับสมัครสอบฯ)");
b.Property<DateTime>("ConclusionResultDate")
.HasColumnType("datetime(6)")
.HasComment("ลงวันที่ (เรื่อง ผลการสอบแข่งขัน)");
b.Property<string>("ConclusionResultNo")
.IsRequired()
.HasColumnType("longtext")
.HasComment("มติ กก. ครั้งที่ (เรื่อง ผลการสอบแข่งขัน)");
b.Property<Guid>("ExamRoundId")
.HasColumnType("char(36)")
.HasComment("อ้างอิงรอบการสอบ");
b.Property<string>("PositionName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ตำแหน่งที่บรรจุ");
b.HasDiscriminator().HasValue("PlacementCommand");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus")