Add Deploy And Receiver Table Structure
This commit is contained in:
parent
73407d3e73
commit
70cc95e408
7 changed files with 12358 additions and 8 deletions
|
|
@ -1,11 +1,6 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
|
|
@ -51,8 +46,6 @@ namespace BMA.EHR.Domain.Models.Commands.Core
|
|||
[Required, MaxLength(500), Comment("คำสั่งเรื่อง")]
|
||||
public string CommandSubject { get; set; } = string.Empty;
|
||||
|
||||
public virtual List<CommandDocument> Documents { get; set; } = new();
|
||||
|
||||
#region " For Placement Command "
|
||||
|
||||
[Required, Comment("อ้างอิงรอบการสอบ")]
|
||||
|
|
@ -74,5 +67,11 @@ namespace BMA.EHR.Domain.Models.Commands.Core
|
|||
public DateTime ConclusionResultDate { get; set; } = DateTime.Now;
|
||||
|
||||
#endregion
|
||||
|
||||
public virtual List<CommandDocument> Documents { get; set; } = new();
|
||||
|
||||
public virtual List<CommandReceiver> Receivers { get; set; }
|
||||
|
||||
public virtual List<CommandDeployment> Deployments { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
BMA.EHR.Domain/Models/Commands/Core/CommandDeployment.cs
Normal file
26
BMA.EHR.Domain/Models/Commands/Core/CommandDeployment.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
public class CommandDeployment:EntityBase
|
||||
{
|
||||
[Comment("รหัสอ้างอิงคำสั่ง")]
|
||||
public Guid CommandId { get; set; } = Guid.Empty;
|
||||
|
||||
public Command Command { get; set; } = new();
|
||||
|
||||
[Required,Comment("รหัสอ้างอิงผู้ใช้งานระบบ")]
|
||||
public string ReceiveUserId { get; set; } = string.Empty;
|
||||
|
||||
[Required,Comment("ส่งอีเมล์หรือไม่?")]
|
||||
public bool IsSendMail { get; set; } = true;
|
||||
|
||||
[Required, Comment("ส่งกล่องข้อความหรือไม่?")]
|
||||
public bool IsSendInbox { get; set; } = true;
|
||||
|
||||
[Required, Comment("ส่งแจ้งเตือนหรือไม่?")]
|
||||
public bool IsSendNotification { get; set; } = true;
|
||||
}
|
||||
}
|
||||
33
BMA.EHR.Domain/Models/Commands/Core/CommandReceiver.cs
Normal file
33
BMA.EHR.Domain/Models/Commands/Core/CommandReceiver.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Commands.Core
|
||||
{
|
||||
public class CommandReceiver : EntityBase
|
||||
{
|
||||
[Comment("รหัสอ้างอิงคำสั่ง")]
|
||||
public Guid CommandId { get; set; } = Guid.Empty;
|
||||
|
||||
public Command Command { get; set; } = new();
|
||||
|
||||
[Required,Comment("ลำดับในบัญชีแนบท้าย")]
|
||||
public int Sequence { get; set; } = 0;
|
||||
|
||||
[MaxLength(13), Required, Comment("เลขประจำตัวประชาชน")]
|
||||
public string CitizenId { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(50),Required,Comment("คำนำหน้านาม")]
|
||||
public string Prefix { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(100), Required, Comment("ชื่อ")]
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
||||
[MaxLength(100), Required, Comment("นามสกุล")]
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
|
||||
[Column(TypeName = "text"),Comment("หมายเหตุ")]
|
||||
public string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
11988
BMA.EHR.Infrastructure/Migrations/20230727032202_Add Command Deploy and Receiver.Designer.cs
generated
Normal file
11988
BMA.EHR.Infrastructure/Migrations/20230727032202_Add Command Deploy and Receiver.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddCommandDeployandReceiver : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CommandDeployments",
|
||||
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"),
|
||||
CommandId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงคำสั่ง", collation: "ascii_general_ci"),
|
||||
ReceiveUserId = table.Column<string>(type: "longtext", nullable: false, comment: "รหัสอ้างอิงผู้ใช้งานระบบ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsSendMail = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งอีเมล์หรือไม่?"),
|
||||
IsSendInbox = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งกล่องข้อความหรือไม่?"),
|
||||
IsSendNotification = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งแจ้งเตือนหรือไม่?")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CommandDeployments", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CommandDeployments_Commands_CommandId",
|
||||
column: x => x.CommandId,
|
||||
principalTable: "Commands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CommandReceivers",
|
||||
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"),
|
||||
CommandId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสอ้างอิงคำสั่ง", collation: "ascii_general_ci"),
|
||||
Sequence = table.Column<int>(type: "int", nullable: false, comment: "ลำดับในบัญชีแนบท้าย"),
|
||||
CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: false, comment: "เลขประจำตัวประชาชน")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Prefix = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "คำนำหน้านาม")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
Comment = table.Column<string>(type: "text", nullable: false, comment: "หมายเหตุ")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CommandReceivers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CommandReceivers_Commands_CommandId",
|
||||
column: x => x.CommandId,
|
||||
principalTable: "Commands",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CommandDeployments_CommandId",
|
||||
table: "CommandDeployments",
|
||||
column: "CommandId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CommandReceivers_CommandId",
|
||||
table: "CommandReceivers",
|
||||
column: "CommandId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CommandDeployments");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CommandReceivers");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -159,6 +159,81 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("Commands");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDeployment", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<Guid>("CommandId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสอ้างอิงคำสั่ง");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<bool>("IsSendInbox")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งกล่องข้อความหรือไม่?");
|
||||
|
||||
b.Property<bool>("IsSendMail")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งอีเมล์หรือไม่?");
|
||||
|
||||
b.Property<bool>("IsSendNotification")
|
||||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("ส่งแจ้งเตือนหรือไม่?");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("ReceiveUserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("รหัสอ้างอิงผู้ใช้งานระบบ");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CommandId");
|
||||
|
||||
b.ToTable("CommandDeployments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -226,6 +301,97 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.ToTable("CommandDocuments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandReceiver", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)")
|
||||
.HasColumnOrder(0)
|
||||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("CitizenId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(13)
|
||||
.HasColumnType("varchar(13)")
|
||||
.HasComment("เลขประจำตัวประชาชน");
|
||||
|
||||
b.Property<Guid>("CommandId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("รหัสอ้างอิงคำสั่ง");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasComment("หมายเหตุ");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
.HasComment("สร้างข้อมูลเมื่อ");
|
||||
|
||||
b.Property<string>("CreatedFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(104)
|
||||
.HasComment("ชื่อ User ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("CreatedUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasComment("ชื่อ");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)")
|
||||
.HasComment("นามสกุล");
|
||||
|
||||
b.Property<string>("LastUpdateFullName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("varchar(200)")
|
||||
.HasColumnOrder(105)
|
||||
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<string>("LastUpdateUserId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(40)
|
||||
.HasColumnType("varchar(40)")
|
||||
.HasColumnOrder(103)
|
||||
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
|
||||
|
||||
b.Property<DateTime?>("LastUpdatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(102)
|
||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||
|
||||
b.Property<string>("Prefix")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)")
|
||||
.HasComment("คำนำหน้านาม");
|
||||
|
||||
b.Property<int>("Sequence")
|
||||
.HasColumnType("int")
|
||||
.HasComment("ลำดับในบัญชีแนบท้าย");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CommandId");
|
||||
|
||||
b.ToTable("CommandReceivers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -10429,6 +10595,17 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("CommandType");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDeployment", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command")
|
||||
.WithMany("Deployments")
|
||||
.HasForeignKey("CommandId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Command");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandDocument", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command")
|
||||
|
|
@ -10448,6 +10625,17 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
b.Navigation("Document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.CommandReceiver", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.Command", "Command")
|
||||
.WithMany("Receivers")
|
||||
.HasForeignKey("CommandId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Command");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitTypeLeave", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
|
||||
|
|
@ -11584,7 +11772,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
|
||||
{
|
||||
b.Navigation("Deployments");
|
||||
|
||||
b.Navigation("Documents");
|
||||
|
||||
b.Navigation("Receivers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
|
||||
|
|
|
|||
|
|
@ -272,9 +272,12 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
|
||||
public DbSet<DeploymentChannel> DeploymentChannels { get; set; }
|
||||
|
||||
|
||||
public DbSet<Command> Commands { get; set; }
|
||||
|
||||
public DbSet<CommandDeployment> CommandDeployments { get; set; }
|
||||
|
||||
public DbSet<CommandReceiver> CommandReceivers { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Message Queue "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue