แก้ api เพิ่มเติมการ upload image and document

This commit is contained in:
Suphonchai Phoonsawat 2023-05-02 22:59:01 +07:00
parent 86ec5de116
commit 6acd497afe
23 changed files with 4081 additions and 53 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,117 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recruit.Service.Migrations
{
/// <inheritdoc />
public partial class AddImportImageandDocumentTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RecruitImportDocument",
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"),
RecruitImportId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "Id รอบสมัครสอบ", collation: "ascii_general_ci"),
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "Id เอกสาร", collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_RecruitImportDocument", x => x.Id);
table.ForeignKey(
name: "FK_RecruitImportDocument_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RecruitImportDocument_RecruitImports_RecruitImportId",
column: x => x.RecruitImportId,
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "RecruitImportImage",
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"),
RecruitImportId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "Id รอบสมัครสอบ", collation: "ascii_general_ci"),
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "Id ไฟล์รูป", collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_RecruitImportImage", x => x.Id);
table.ForeignKey(
name: "FK_RecruitImportImage_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RecruitImportImage_RecruitImports_RecruitImportId",
column: x => x.RecruitImportId,
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_RecruitImportDocument_DocumentId",
table: "RecruitImportDocument",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_RecruitImportDocument_RecruitImportId",
table: "RecruitImportDocument",
column: "RecruitImportId");
migrationBuilder.CreateIndex(
name: "IX_RecruitImportImage_DocumentId",
table: "RecruitImportImage",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_RecruitImportImage_RecruitImportId",
table: "RecruitImportImage",
column: "RecruitImportId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RecruitImportDocument");
migrationBuilder.DropTable(
name: "RecruitImportImage");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,206 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recruit.Service.Migrations
{
/// <inheritdoc />
public partial class AddImportImageandDocumentTable2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocument_Documents_DocumentId",
table: "RecruitImportDocument");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocument_RecruitImports_RecruitImportId",
table: "RecruitImportDocument");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImage_Documents_DocumentId",
table: "RecruitImportImage");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImage_RecruitImports_RecruitImportId",
table: "RecruitImportImage");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportImage",
table: "RecruitImportImage");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportDocument",
table: "RecruitImportDocument");
migrationBuilder.RenameTable(
name: "RecruitImportImage",
newName: "RecruitImportImages");
migrationBuilder.RenameTable(
name: "RecruitImportDocument",
newName: "RecruitImportDocuments");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImage_RecruitImportId",
table: "RecruitImportImages",
newName: "IX_RecruitImportImages_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImage_DocumentId",
table: "RecruitImportImages",
newName: "IX_RecruitImportImages_DocumentId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocument_RecruitImportId",
table: "RecruitImportDocuments",
newName: "IX_RecruitImportDocuments_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocument_DocumentId",
table: "RecruitImportDocuments",
newName: "IX_RecruitImportDocuments_DocumentId");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportImages",
table: "RecruitImportImages",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportDocuments",
table: "RecruitImportDocuments",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocuments_Documents_DocumentId",
table: "RecruitImportDocuments",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocuments_RecruitImports_RecruitImportId",
table: "RecruitImportDocuments",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImages_Documents_DocumentId",
table: "RecruitImportImages",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImages_RecruitImports_RecruitImportId",
table: "RecruitImportImages",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocuments_Documents_DocumentId",
table: "RecruitImportDocuments");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocuments_RecruitImports_RecruitImportId",
table: "RecruitImportDocuments");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImages_Documents_DocumentId",
table: "RecruitImportImages");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImages_RecruitImports_RecruitImportId",
table: "RecruitImportImages");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportImages",
table: "RecruitImportImages");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportDocuments",
table: "RecruitImportDocuments");
migrationBuilder.RenameTable(
name: "RecruitImportImages",
newName: "RecruitImportImage");
migrationBuilder.RenameTable(
name: "RecruitImportDocuments",
newName: "RecruitImportDocument");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImages_RecruitImportId",
table: "RecruitImportImage",
newName: "IX_RecruitImportImage_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImages_DocumentId",
table: "RecruitImportImage",
newName: "IX_RecruitImportImage_DocumentId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocuments_RecruitImportId",
table: "RecruitImportDocument",
newName: "IX_RecruitImportDocument_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocuments_DocumentId",
table: "RecruitImportDocument",
newName: "IX_RecruitImportDocument_DocumentId");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportImage",
table: "RecruitImportImage",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportDocument",
table: "RecruitImportDocument",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocument_Documents_DocumentId",
table: "RecruitImportDocument",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocument_RecruitImports_RecruitImportId",
table: "RecruitImportDocument",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImage_Documents_DocumentId",
table: "RecruitImportImage",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImage_RecruitImports_RecruitImportId",
table: "RecruitImportImage",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View file

@ -716,6 +716,70 @@ namespace BMA.EHR.Recruit.Service.Migrations
b.ToTable("RecruitImports");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImportDocument", 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<Guid>("DocumentId")
.HasColumnType("char(36)")
.HasComment("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>("RecruitImportId")
.HasColumnType("char(36)")
.HasComment("Id รอบสมัครสอบ");
b.HasKey("Id");
b.HasIndex("DocumentId");
b.HasIndex("RecruitImportId");
b.ToTable("RecruitImportDocuments");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImportHistory", b =>
{
b.Property<Guid>("Id")
@ -779,6 +843,70 @@ namespace BMA.EHR.Recruit.Service.Migrations
b.ToTable("RecruitImportHistories");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImportImage", 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<Guid>("DocumentId")
.HasColumnType("char(36)")
.HasComment("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>("RecruitImportId")
.HasColumnType("char(36)")
.HasComment("Id รอบสมัครสอบ");
b.HasKey("Id");
b.HasIndex("DocumentId");
b.HasIndex("RecruitImportId");
b.ToTable("RecruitImportImages");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitOccupation", b =>
{
b.Property<Guid>("Id")
@ -1263,6 +1391,25 @@ namespace BMA.EHR.Recruit.Service.Migrations
b.Navigation("ImportFile");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImportDocument", b =>
{
b.HasOne("BMA.EHR.Recruit.Service.Models.Documents.Document", "Document")
.WithMany()
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImport", "RecruitImport")
.WithMany("RecruitDocuments")
.HasForeignKey("RecruitImportId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Document");
b.Navigation("RecruitImport");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImportHistory", b =>
{
b.HasOne("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImport", "RecruitImport")
@ -1274,6 +1421,25 @@ namespace BMA.EHR.Recruit.Service.Migrations
b.Navigation("RecruitImport");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImportImage", b =>
{
b.HasOne("BMA.EHR.Recruit.Service.Models.Documents.Document", "Document")
.WithMany()
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Recruit.Service.Models.Recruits.RecruitImport", "RecruitImport")
.WithMany("RecruitImages")
.HasForeignKey("RecruitImportId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Document");
b.Navigation("RecruitImport");
});
modelBuilder.Entity("BMA.EHR.Recruit.Service.Models.Recruits.RecruitOccupation", b =>
{
b.HasOne("BMA.EHR.Recruit.Service.Models.Recruits.Recruit", "Recruit")
@ -1345,6 +1511,10 @@ namespace BMA.EHR.Recruit.Service.Migrations
{
b.Navigation("ImportHostories");
b.Navigation("RecruitDocuments");
b.Navigation("RecruitImages");
b.Navigation("Recruits");
b.Navigation("ScoreImport")