exam_service

This commit is contained in:
SpecialX
2025-06-11 15:02:20 +08:00
parent 97843ab5fd
commit e26881ec2f
52 changed files with 3510 additions and 1174 deletions

View File

@@ -12,7 +12,7 @@ using TechHelper.Context;
namespace TechHelper.Server.Migrations
{
[DbContext(typeof(ApplicationContext))]
[Migration("20250528090233_init")]
[Migration("20250610025325_init")]
partial class init
{
/// <inheritdoc />
@@ -158,7 +158,8 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<Guid>("AssignmentId")
b.Property<Guid?>("AssignmentId")
.IsRequired()
.HasColumnType("char(36)")
.HasColumnName("assignment");
@@ -180,7 +181,7 @@ namespace TechHelper.Server.Migrations
b.Property<Guid?>("ParentGroup")
.HasColumnType("char(36)")
.HasColumnName("sub_group");
.HasColumnName("parent_group");
b.Property<string>("Title")
.IsRequired()
@@ -188,10 +189,14 @@ namespace TechHelper.Server.Migrations
.HasColumnType("longtext")
.HasColumnName("title");
b.Property<decimal?>("TotalPoints")
.HasColumnType("decimal(65,30)")
b.Property<float?>("TotalPoints")
.HasColumnType("float")
.HasColumnName("total_points");
b.Property<bool>("ValidQuestionGroup")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question_group");
b.HasKey("Id");
b.HasIndex("AssignmentId");
@@ -210,7 +215,7 @@ namespace TechHelper.Server.Migrations
b.Property<Guid>("AssignmentGroupId")
.HasColumnType("char(36)")
.HasColumnName("detail_id");
.HasColumnName("group_id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
@@ -404,6 +409,10 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("updated_at");
b.Property<bool>("ValidQuestion")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question");
b.HasKey("Id");
b.HasIndex("CreatedBy");
@@ -653,19 +662,19 @@ namespace TechHelper.Server.Migrations
b.HasData(
new
{
Id = new Guid("ea0c88d8-1a52-4034-bb37-5a95043821eb"),
Id = new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"),
Name = "Student",
NormalizedName = "STUDENT"
},
new
{
Id = new Guid("9de22e41-c096-4d5a-b55a-ce0122aa3ada"),
Id = new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"),
Name = "Teacher",
NormalizedName = "TEACHER"
},
new
{
Id = new Guid("dee718d9-b731-485f-96bb-a59ce777870f"),
Id = new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"),
Name = "Administrator",
NormalizedName = "ADMINISTRATOR"
});

View File

@@ -281,7 +281,8 @@ namespace TechHelper.Server.Migrations
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
updated_at = table.Column<DateTime>(type: "datetime(6)", rowVersion: true, nullable: false),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
valid_question = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
@@ -330,17 +331,18 @@ namespace TechHelper.Server.Migrations
.Annotation("MySql:CharSet", "utf8mb4"),
descript = table.Column<string>(type: "longtext", maxLength: 65535, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
total_points = table.Column<decimal>(type: "decimal(65,30)", nullable: true),
total_points = table.Column<float>(type: "float", nullable: true),
number = table.Column<byte>(type: "tinyint unsigned", nullable: false),
sub_group = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
parent_group = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
valid_question_group = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_assignment_group", x => x.id);
table.ForeignKey(
name: "FK_assignment_group_assignment_group_sub_group",
column: x => x.sub_group,
name: "FK_assignment_group_assignment_group_parent_group",
column: x => x.parent_group,
principalTable: "assignment_group",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
@@ -482,18 +484,18 @@ namespace TechHelper.Server.Migrations
{
id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
question_id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
group_id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
question_number = table.Column<byte>(type: "tinyint unsigned", nullable: false),
created_at = table.Column<DateTime>(type: "datetime(6)", nullable: false),
score = table.Column<float>(type: "float", nullable: true),
detail_id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
deleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false)
},
constraints: table =>
{
table.PrimaryKey("PK_assignment_questions", x => x.id);
table.ForeignKey(
name: "FK_assignment_questions_assignment_group_detail_id",
column: x => x.detail_id,
name: "FK_assignment_questions_assignment_group_group_id",
column: x => x.group_id,
principalTable: "assignment_group",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
@@ -554,9 +556,9 @@ namespace TechHelper.Server.Migrations
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ new Guid("9de22e41-c096-4d5a-b55a-ce0122aa3ada"), null, "Teacher", "TEACHER" },
{ new Guid("dee718d9-b731-485f-96bb-a59ce777870f"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("ea0c88d8-1a52-4034-bb37-5a95043821eb"), null, "Student", "STUDENT" }
{ new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"), null, "Student", "STUDENT" },
{ new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"), null, "Teacher", "TEACHER" }
});
migrationBuilder.CreateIndex(
@@ -612,14 +614,14 @@ namespace TechHelper.Server.Migrations
column: "assignment");
migrationBuilder.CreateIndex(
name: "IX_assignment_group_sub_group",
name: "IX_assignment_group_parent_group",
table: "assignment_group",
column: "sub_group");
column: "parent_group");
migrationBuilder.CreateIndex(
name: "IX_assignment_questions_detail_id",
name: "IX_assignment_questions_group_id",
table: "assignment_questions",
column: "detail_id");
column: "group_id");
migrationBuilder.CreateIndex(
name: "IX_assignment_questions_question_id",

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,93 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace TechHelper.Server.Migrations
{
/// <inheritdoc />
public partial class assignmentnot_required : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"));
migrationBuilder.AlterColumn<Guid>(
name: "assignment",
table: "assignment_group",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ new Guid("b2e087e6-ea32-46c4-aeb3-09b936cd0cf4"), null, "Teacher", "TEACHER" },
{ new Guid("ba33e047-8354-4f2c-b8b1-1f46441c28fc"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("d4b41bc3-612e-49dd-aeda-6a98ea0e4e68"), null, "Student", "STUDENT" }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("b2e087e6-ea32-46c4-aeb3-09b936cd0cf4"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("ba33e047-8354-4f2c-b8b1-1f46441c28fc"));
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: new Guid("d4b41bc3-612e-49dd-aeda-6a98ea0e4e68"));
migrationBuilder.AlterColumn<Guid>(
name: "assignment",
table: "assignment_group",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ new Guid("02a808ba-bd16-4f90-bf2b-0bc42f767e00"), null, "Administrator", "ADMINISTRATOR" },
{ new Guid("9e526681-e57e-46b5-a01c-5731b27bfc4a"), null, "Student", "STUDENT" },
{ new Guid("dfdfb884-4063-4161-84e0-9c225f4e883c"), null, "Teacher", "TEACHER" }
});
}
}
}

View File

@@ -155,7 +155,7 @@ namespace TechHelper.Server.Migrations
.HasColumnType("char(36)")
.HasColumnName("id");
b.Property<Guid>("AssignmentId")
b.Property<Guid?>("AssignmentId")
.HasColumnType("char(36)")
.HasColumnName("assignment");
@@ -177,7 +177,7 @@ namespace TechHelper.Server.Migrations
b.Property<Guid?>("ParentGroup")
.HasColumnType("char(36)")
.HasColumnName("sub_group");
.HasColumnName("parent_group");
b.Property<string>("Title")
.IsRequired()
@@ -185,10 +185,14 @@ namespace TechHelper.Server.Migrations
.HasColumnType("longtext")
.HasColumnName("title");
b.Property<decimal?>("TotalPoints")
.HasColumnType("decimal(65,30)")
b.Property<float?>("TotalPoints")
.HasColumnType("float")
.HasColumnName("total_points");
b.Property<bool>("ValidQuestionGroup")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question_group");
b.HasKey("Id");
b.HasIndex("AssignmentId");
@@ -207,7 +211,7 @@ namespace TechHelper.Server.Migrations
b.Property<Guid>("AssignmentGroupId")
.HasColumnType("char(36)")
.HasColumnName("detail_id");
.HasColumnName("group_id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
@@ -401,6 +405,10 @@ namespace TechHelper.Server.Migrations
.HasColumnType("datetime(6)")
.HasColumnName("updated_at");
b.Property<bool>("ValidQuestion")
.HasColumnType("tinyint(1)")
.HasColumnName("valid_question");
b.HasKey("Id");
b.HasIndex("CreatedBy");
@@ -650,19 +658,19 @@ namespace TechHelper.Server.Migrations
b.HasData(
new
{
Id = new Guid("ea0c88d8-1a52-4034-bb37-5a95043821eb"),
Id = new Guid("d4b41bc3-612e-49dd-aeda-6a98ea0e4e68"),
Name = "Student",
NormalizedName = "STUDENT"
},
new
{
Id = new Guid("9de22e41-c096-4d5a-b55a-ce0122aa3ada"),
Id = new Guid("b2e087e6-ea32-46c4-aeb3-09b936cd0cf4"),
Name = "Teacher",
NormalizedName = "TEACHER"
},
new
{
Id = new Guid("dee718d9-b731-485f-96bb-a59ce777870f"),
Id = new Guid("ba33e047-8354-4f2c-b8b1-1f46441c28fc"),
Name = "Administrator",
NormalizedName = "ADMINISTRATOR"
});
@@ -821,8 +829,7 @@ namespace TechHelper.Server.Migrations
b.HasOne("Entities.Contracts.Assignment", "Assignment")
.WithMany("AssignmentGroups")
.HasForeignKey("AssignmentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Entities.Contracts.AssignmentGroup", "ParentAssignmentGroup")
.WithMany("ChildAssignmentGroups")