add message queue table for notification system

This commit is contained in:
Suphonchai Phoonsawat 2023-07-12 21:08:46 +07:00
parent 1c99718a30
commit 841bf32175
12 changed files with 21322 additions and 3 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,57 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddMessageQueue : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "MessageQueues",
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"),
SenderSystem = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ส่งจากระบบงาน")
.Annotation("MySql:CharSet", "utf8mb4"),
Subject = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "หัวเรื่อง")
.Annotation("MySql:CharSet", "utf8mb4"),
MessageContent = table.Column<string>(type: "longtext", nullable: false, comment: "รายละเอียดข้อความ")
.Annotation("MySql:CharSet", "utf8mb4"),
MessagePayLoad = table.Column<string>(type: "longtext", nullable: false, comment: "สิ่งที่แนบมาด้วย")
.Annotation("MySql:CharSet", "utf8mb4"),
ReceiverUserId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสของผู้รับข้อความ", collation: "ascii_general_ci"),
IsSendEmail = 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: "ส่งการแจ้งเตือนหรือไม่?"),
IsSend = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ทำการส่งข้อความแล้วหรือยัง?")
},
constraints: table =>
{
table.PrimaryKey("PK_MessageQueues", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "MessageQueues");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,32 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddReceiverEmailtoMessageQueue : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ReceiverEmailAddress",
table: "MessageQueues",
type: "varchar(500)",
maxLength: 500,
nullable: false,
defaultValue: "",
comment: "อีเมล์ของผู้รับ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ReceiverEmailAddress",
table: "MessageQueues");
}
}
}

View file

@ -7326,6 +7326,106 @@ namespace BMA.EHR.Infrastructure.Migrations
b.ToTable("SubDistricts");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Notifications.MessageQueueEntity", 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<bool>("IsSend")
.HasColumnType("tinyint(1)")
.HasComment("ทำการส่งข้อความแล้วหรือยัง?");
b.Property<bool>("IsSendEmail")
.HasColumnType("tinyint(1)")
.HasComment("ส่งอีเมลล์หรือไม่?");
b.Property<bool>("IsSendInbox")
.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>("MessageContent")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดข้อความ");
b.Property<string>("MessagePayLoad")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สิ่งที่แนบมาด้วย");
b.Property<string>("ReceiverEmailAddress")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("varchar(500)")
.HasComment("อีเมล์ของผู้รับ");
b.Property<Guid>("ReceiverUserId")
.HasColumnType("char(36)")
.HasComment("รหัสของผู้รับข้อความ");
b.Property<string>("SenderSystem")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("ส่งจากระบบงาน");
b.Property<string>("Subject")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("หัวเรื่อง");
b.HasKey("Id");
b.ToTable("MessageQueues");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b =>
{
b.Property<Guid>("Id")