diff --git a/2021-backend.csproj b/2021-backend.csproj
index a2f8c70..9194aa0 100644
--- a/2021-backend.csproj
+++ b/2021-backend.csproj
@@ -1,7 +1,7 @@
- net5.0
+ net6.0
_2021_backend
2023ab1c-9547-4989-a343-cd3428e085fe
_2021_backend.Program
@@ -19,21 +19,25 @@
-
+
-
-
-
-
+
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
-
+
-
-
+
+
+
+
+
+
diff --git a/Controllers/SubmissionController.cs b/Controllers/SubmissionController.cs
index 5402683..b5a24a5 100644
--- a/Controllers/SubmissionController.cs
+++ b/Controllers/SubmissionController.cs
@@ -33,7 +33,7 @@ namespace _2021_backend.Controllers
{
if(aDto.Timelist != null)if (aDto.Timelist.Any(it => it.Day.Day == tm.Day.Day && it.BeginTime.TimeOfDay == tm.BeginTime.TimeOfDay))
{
- sub.Timelist.Add(tm.Guid);
+ sub.Timelist.Add(tm.Id);
}
}
var q = Context.Students.Where(stu => (stu.Name == aDto.Name || stu.Stuid == aDto.Stuid));
@@ -49,7 +49,7 @@ namespace _2021_backend.Controllers
stu = q.FirstOrDefault();
stu.Update(sub);
}
- sub.Host = stu.Guid;
+ sub.Host = stu.Id;
Context.Submissions.Add(sub);
Context.SaveChanges();
await TencentSMS.Send(Context, SMSType.Signed, stu, _2021_backend.Models.User.Bot.stuID);
@@ -96,7 +96,7 @@ namespace _2021_backend.Controllers
Student stu = Context.Students.FirstOrDefault(r => r.Stuid == stuid);
if (stu == null)
{
- return StatusCode(400, ApiResponse.Error("INVALID_STUDENT_GUID"));
+ return StatusCode(400, ApiResponse.Error("INVALID_STUDENT_int"));
}
SessionDto time;
try
@@ -108,8 +108,8 @@ namespace _2021_backend.Controllers
Console.WriteLine(ex);
return StatusCode(400, ApiResponse.Error("MALFORMED_DATA"));
};
- //get the selected session guids;
- Guid targetSession = Guid.Empty;
+ //get the selected session ints;
+ int targetSession = 0;
var sessions = Context.Sessions.ToList();
var s = sessions.Find((Session s) =>
{
@@ -120,15 +120,15 @@ namespace _2021_backend.Controllers
if (Context.Sessions.Find(stu.InterviewTime) != null)
{
var olds = Context.Sessions.Find(stu.InterviewTime);
- olds.Students.Remove(stu.Guid);
+ olds.Students.Remove(stu.Id);
Context.SaveChanges();
overwritten = true;
}
- targetSession = s.Guid;
- s.Students.Add(stu.Guid);
- stu.Timelist = new List { targetSession};
+ targetSession = s.Id;
+ s.Students.Add(stu.Id);
+ stu.Timelist = new List { targetSession};
stu.Status = status.已选时间;
- stu.InterviewTime = s.Guid;
+ stu.InterviewTime = s.Id;
await TencentSMS.Send(Context, SMSType.TimeSet, stu, "smsbot");
Context.SaveChanges();
if (overwritten) return Ok(ApiResponse.Success("overwritten"));
diff --git a/Data/BackendContext.cs b/Data/BackendContext.cs
index fa8127f..f58711b 100644
--- a/Data/BackendContext.cs
+++ b/Data/BackendContext.cs
@@ -19,15 +19,15 @@ namespace _2021_backend.Data
protected override void OnModelCreating(ModelBuilder mb)
{
mb.Entity()
- .HasKey(r => r.Guid);
+ .HasKey(r => r.Id);
mb.Entity()
- .HasKey(u => u.Guid);
+ .HasKey(u => u.Id);
mb.Entity()
- .HasKey(u => u.Guid);
+ .HasKey(u => u.Id);
mb.Entity()
- .HasKey(u => u.Guid);
+ .HasKey(u => u.Id);
mb.Entity()
- .HasKey(u => u.Guid);
+ .HasKey(u => u.Id);
}
}
}
diff --git a/Migrations/20211018220015_Initial.Designer.cs b/Migrations/20220222090619_initial.Designer.cs
similarity index 62%
rename from Migrations/20211018220015_Initial.Designer.cs
rename to Migrations/20220222090619_initial.Designer.cs
index 325da57..d981e82 100644
--- a/Migrations/20211018220015_Initial.Designer.cs
+++ b/Migrations/20220222090619_initial.Designer.cs
@@ -8,58 +8,100 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using _2021_backend.Data;
+#nullable disable
+
namespace _2021_backend.Migrations
{
[DbContext(typeof(BackendContext))]
- [Migration("20211018220015_Initial")]
- partial class Initial
+ [Migration("20220222090619_initial")]
+ partial class initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("Relational:MaxIdentifierLength", 63)
- .HasAnnotation("ProductVersion", "5.0.9")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+ .HasAnnotation("ProductVersion", "6.0.2")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("_2021_backend.Models.Comment", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AddTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Content")
.IsRequired()
.HasColumnType("text");
- b.Property("Operator")
- .HasColumnType("uuid");
+ b.Property("Operator")
+ .HasColumnType("integer");
- b.Property("Student")
- .HasColumnType("uuid");
+ b.Property("Student")
+ .HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
b.ToTable("Comments");
});
+ modelBuilder.Entity("_2021_backend.Models.Session", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("BeginTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Capacity")
+ .HasColumnType("integer");
+
+ b.Property>("Chiefs")
+ .HasColumnType("integer[]");
+
+ b.Property("Day")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Place")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SendSMS")
+ .HasColumnType("boolean");
+
+ b.Property>("Students")
+ .HasColumnType("integer[]");
+
+ b.HasKey("Id");
+
+ b.ToTable("Sessions");
+ });
+
modelBuilder.Entity("_2021_backend.Models.SMS", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property>("Data")
.HasColumnType("text[]");
- b.Property("Host")
- .HasColumnType("uuid");
+ b.Property("Host")
+ .HasColumnType("integer");
b.Property("SendTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Sender")
.HasColumnType("text");
@@ -70,52 +112,21 @@ namespace _2021_backend.Migrations
b.Property("Type")
.HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
b.ToTable("SMS");
});
- modelBuilder.Entity("_2021_backend.Models.Session", b =>
- {
- b.Property("Guid")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("BeginTime")
- .HasColumnType("timestamp without time zone");
-
- b.Property("Capacity")
- .HasColumnType("integer");
-
- b.Property>("Chiefs")
- .HasColumnType("uuid[]");
-
- b.Property("Day")
- .HasColumnType("timestamp without time zone");
-
- b.Property("Place")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("SendSMS")
- .HasColumnType("boolean");
-
- b.Property>("Students")
- .HasColumnType("uuid[]");
-
- b.HasKey("Guid");
-
- b.ToTable("Sessions");
- });
-
modelBuilder.Entity("_2021_backend.Models.Student", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
- b.Property>("Comments")
- .HasColumnType("uuid[]");
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property>("Comments")
+ .HasColumnType("integer[]");
b.Property("Email")
.HasColumnType("text");
@@ -126,23 +137,23 @@ namespace _2021_backend.Migrations
b.Property("Grade")
.HasColumnType("integer");
- b.Property("InterviewTime")
- .HasColumnType("uuid");
+ b.Property("InterviewTime")
+ .HasColumnType("integer");
b.Property("LastSubmission")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Major")
.HasColumnType("text");
- b.Property>("Messages")
- .HasColumnType("uuid[]");
+ b.Property>("Messages")
+ .HasColumnType("integer[]");
b.Property("Name")
.HasColumnType("text");
b.Property("RegisterTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Score")
.HasColumnType("integer");
@@ -156,28 +167,30 @@ namespace _2021_backend.Migrations
b.Property("Stuid")
.HasColumnType("text");
- b.Property>("Submissions")
- .HasColumnType("uuid[]");
+ b.Property>("Submissions")
+ .HasColumnType("integer[]");
b.Property("Tel")
.HasColumnType("text");
- b.Property>("Timelist")
- .HasColumnType("uuid[]");
+ b.Property>("Timelist")
+ .HasColumnType("integer[]");
b.Property("Yard")
.HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
b.ToTable("Students");
});
modelBuilder.Entity("_2021_backend.Models.Submission", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Address")
.HasColumnType("text");
@@ -191,8 +204,8 @@ namespace _2021_backend.Migrations
b.Property("Grade")
.HasColumnType("integer");
- b.Property("Host")
- .HasColumnType("uuid");
+ b.Property("Host")
+ .HasColumnType("integer");
b.Property("Major")
.HasColumnType("text");
@@ -207,27 +220,29 @@ namespace _2021_backend.Migrations
.HasColumnType("text");
b.Property("SubmitTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Tel")
.HasColumnType("text");
- b.Property>("Timelist")
- .HasColumnType("uuid[]");
+ b.Property>("Timelist")
+ .HasColumnType("integer[]");
b.Property("Yard")
.HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
b.ToTable("Submissions");
});
modelBuilder.Entity("_2021_backend.Models.User", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.HasColumnType("text");
@@ -241,7 +256,7 @@ namespace _2021_backend.Migrations
b.Property("stuID")
.HasColumnType("text");
- b.HasKey("Guid");
+ b.HasKey("Id");
b.ToTable("Users");
});
diff --git a/Migrations/20211018220015_Initial.cs b/Migrations/20220222090619_initial.cs
similarity index 63%
rename from Migrations/20211018220015_Initial.cs
rename to Migrations/20220222090619_initial.cs
index a21aa59..f14fefb 100644
--- a/Migrations/20211018220015_Initial.cs
+++ b/Migrations/20220222090619_initial.cs
@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
namespace _2021_backend.Migrations
{
- public partial class Initial : Migration
+ public partial class initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
@@ -12,57 +15,61 @@ namespace _2021_backend.Migrations
name: "Comments",
columns: table => new
{
- Guid = table.Column(type: "uuid", nullable: false),
- Operator = table.Column(type: "uuid", nullable: false),
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Operator = table.Column(type: "integer", nullable: false),
Content = table.Column(type: "text", nullable: false),
- AddTime = table.Column(type: "timestamp without time zone", nullable: false),
- Student = table.Column(type: "uuid", nullable: false)
+ AddTime = table.Column(type: "timestamp with time zone", nullable: false),
+ Student = table.Column(type: "integer", nullable: false)
},
constraints: table =>
{
- table.PrimaryKey("PK_Comments", x => x.Guid);
+ table.PrimaryKey("PK_Comments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Sessions",
columns: table => new
{
- Guid = table.Column(type: "uuid", nullable: false),
- Day = table.Column(type: "timestamp without time zone", nullable: false),
- BeginTime = table.Column(type: "timestamp without time zone", nullable: false),
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Day = table.Column(type: "timestamp with time zone", nullable: false),
+ BeginTime = table.Column(type: "timestamp with time zone", nullable: false),
Place = table.Column(type: "text", nullable: false),
- Chiefs = table.Column>(type: "uuid[]", nullable: true),
+ Chiefs = table.Column>(type: "integer[]", nullable: true),
Capacity = table.Column(type: "integer", nullable: false),
SendSMS = table.Column(type: "boolean", nullable: false),
- Students = table.Column>(type: "uuid[]", nullable: true)
+ Students = table.Column>(type: "integer[]", nullable: true)
},
constraints: table =>
{
- table.PrimaryKey("PK_Sessions", x => x.Guid);
+ table.PrimaryKey("PK_Sessions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "SMS",
columns: table => new
{
- Guid = table.Column(type: "uuid", nullable: false),
- Host = table.Column(type: "uuid", nullable: false),
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Host = table.Column(type: "integer", nullable: false),
Tel = table.Column(type: "text", nullable: true),
Data = table.Column>(type: "text[]", nullable: true),
Type = table.Column(type: "integer", nullable: false),
Sender = table.Column(type: "text", nullable: true),
- SendTime = table.Column(type: "timestamp without time zone", nullable: false)
+ SendTime = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
- table.PrimaryKey("PK_SMS", x => x.Guid);
+ table.PrimaryKey("PK_SMS", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Students",
columns: table => new
{
- Guid = table.Column(type: "uuid", nullable: false),
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
Name = table.Column(type: "text", nullable: true),
Stuid = table.Column(type: "text", nullable: true),
Sex = table.Column(type: "integer", nullable: false),
@@ -72,27 +79,28 @@ namespace _2021_backend.Migrations
Email = table.Column(type: "text", nullable: true),
Tel = table.Column(type: "text", nullable: true),
Exp = table.Column(type: "integer", nullable: false),
- InterviewTime = table.Column(type: "uuid", nullable: false),
- Submissions = table.Column>(type: "uuid[]", nullable: true),
- Messages = table.Column>(type: "uuid[]", nullable: true),
- Timelist = table.Column>(type: "uuid[]", nullable: true),
- Comments = table.Column>(type: "uuid[]", nullable: true),
+ InterviewTime = table.Column(type: "integer", nullable: false),
+ Submissions = table.Column>(type: "integer[]", nullable: true),
+ Messages = table.Column>(type: "integer[]", nullable: true),
+ Timelist = table.Column>(type: "integer[]", nullable: true),
+ Comments = table.Column>(type: "integer[]", nullable: true),
Score = table.Column(type: "integer", nullable: false),
Status = table.Column(type: "integer", nullable: false),
- LastSubmission = table.Column(type: "timestamp without time zone", nullable: false),
- RegisterTime = table.Column(type: "timestamp without time zone", nullable: false)
+ LastSubmission = table.Column(type: "timestamp with time zone", nullable: false),
+ RegisterTime = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
- table.PrimaryKey("PK_Students", x => x.Guid);
+ table.PrimaryKey("PK_Students", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Submissions",
columns: table => new
{
- Guid = table.Column(type: "uuid", nullable: false),
- Host = table.Column(type: "uuid", nullable: false),
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Host = table.Column(type: "integer", nullable: false),
Name = table.Column(type: "text", nullable: true),
Stuid = table.Column(type: "text", nullable: true),
Sex = table.Column(type: "integer", nullable: false),
@@ -102,20 +110,21 @@ namespace _2021_backend.Migrations
Email = table.Column(type: "text", nullable: true),
Tel = table.Column(type: "text", nullable: true),
Exp = table.Column(type: "integer", nullable: false),
- Timelist = table.Column>(type: "uuid[]", nullable: true),
+ Timelist = table.Column>(type: "integer[]", nullable: true),
Address = table.Column(type: "text", nullable: true),
- SubmitTime = table.Column(type: "timestamp without time zone", nullable: false)
+ SubmitTime = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
- table.PrimaryKey("PK_Submissions", x => x.Guid);
+ table.PrimaryKey("PK_Submissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
- Guid = table.Column(type: "uuid", nullable: false),
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
stuID = table.Column(type: "text", nullable: true),
Name = table.Column(type: "text", nullable: true),
Secret = table.Column(type: "text", nullable: true),
@@ -123,7 +132,7 @@ namespace _2021_backend.Migrations
},
constraints: table =>
{
- table.PrimaryKey("PK_Users", x => x.Guid);
+ table.PrimaryKey("PK_Users", x => x.Id);
});
}
diff --git a/Migrations/BackendContextModelSnapshot.cs b/Migrations/BackendContextModelSnapshot.cs
index 9d6cb10..1bef7f3 100644
--- a/Migrations/BackendContextModelSnapshot.cs
+++ b/Migrations/BackendContextModelSnapshot.cs
@@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using _2021_backend.Data;
+#nullable disable
+
namespace _2021_backend.Migrations
{
[DbContext(typeof(BackendContext))]
@@ -16,48 +18,88 @@ namespace _2021_backend.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("Relational:MaxIdentifierLength", 63)
- .HasAnnotation("ProductVersion", "5.0.9")
- .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
+ .HasAnnotation("ProductVersion", "6.0.2")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("_2021_backend.Models.Comment", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("AddTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Content")
.IsRequired()
.HasColumnType("text");
- b.Property("Operator")
- .HasColumnType("uuid");
+ b.Property("Operator")
+ .HasColumnType("integer");
- b.Property("Student")
- .HasColumnType("uuid");
+ b.Property("Student")
+ .HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
- b.ToTable("Comments");
+ b.ToTable("Comments", (string)null);
+ });
+
+ modelBuilder.Entity("_2021_backend.Models.Session", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("BeginTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Capacity")
+ .HasColumnType("integer");
+
+ b.Property>("Chiefs")
+ .HasColumnType("integer[]");
+
+ b.Property("Day")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Place")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SendSMS")
+ .HasColumnType("boolean");
+
+ b.Property>("Students")
+ .HasColumnType("integer[]");
+
+ b.HasKey("Id");
+
+ b.ToTable("Sessions", (string)null);
});
modelBuilder.Entity("_2021_backend.Models.SMS", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property>("Data")
.HasColumnType("text[]");
- b.Property("Host")
- .HasColumnType("uuid");
+ b.Property("Host")
+ .HasColumnType("integer");
b.Property("SendTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Sender")
.HasColumnType("text");
@@ -68,52 +110,21 @@ namespace _2021_backend.Migrations
b.Property("Type")
.HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
- b.ToTable("SMS");
- });
-
- modelBuilder.Entity("_2021_backend.Models.Session", b =>
- {
- b.Property("Guid")
- .ValueGeneratedOnAdd()
- .HasColumnType("uuid");
-
- b.Property("BeginTime")
- .HasColumnType("timestamp without time zone");
-
- b.Property("Capacity")
- .HasColumnType("integer");
-
- b.Property>("Chiefs")
- .HasColumnType("uuid[]");
-
- b.Property("Day")
- .HasColumnType("timestamp without time zone");
-
- b.Property("Place")
- .IsRequired()
- .HasColumnType("text");
-
- b.Property("SendSMS")
- .HasColumnType("boolean");
-
- b.Property>("Students")
- .HasColumnType("uuid[]");
-
- b.HasKey("Guid");
-
- b.ToTable("Sessions");
+ b.ToTable("SMS", (string)null);
});
modelBuilder.Entity("_2021_backend.Models.Student", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
- b.Property>("Comments")
- .HasColumnType("uuid[]");
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property>("Comments")
+ .HasColumnType("integer[]");
b.Property("Email")
.HasColumnType("text");
@@ -124,23 +135,23 @@ namespace _2021_backend.Migrations
b.Property("Grade")
.HasColumnType("integer");
- b.Property("InterviewTime")
- .HasColumnType("uuid");
+ b.Property("InterviewTime")
+ .HasColumnType("integer");
b.Property("LastSubmission")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Major")
.HasColumnType("text");
- b.Property>("Messages")
- .HasColumnType("uuid[]");
+ b.Property>("Messages")
+ .HasColumnType("integer[]");
b.Property("Name")
.HasColumnType("text");
b.Property("RegisterTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Score")
.HasColumnType("integer");
@@ -154,28 +165,30 @@ namespace _2021_backend.Migrations
b.Property("Stuid")
.HasColumnType("text");
- b.Property>("Submissions")
- .HasColumnType("uuid[]");
+ b.Property>("Submissions")
+ .HasColumnType("integer[]");
b.Property("Tel")
.HasColumnType("text");
- b.Property>("Timelist")
- .HasColumnType("uuid[]");
+ b.Property>("Timelist")
+ .HasColumnType("integer[]");
b.Property("Yard")
.HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
- b.ToTable("Students");
+ b.ToTable("Students", (string)null);
});
modelBuilder.Entity("_2021_backend.Models.Submission", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Address")
.HasColumnType("text");
@@ -189,8 +202,8 @@ namespace _2021_backend.Migrations
b.Property("Grade")
.HasColumnType("integer");
- b.Property("Host")
- .HasColumnType("uuid");
+ b.Property("Host")
+ .HasColumnType("integer");
b.Property("Major")
.HasColumnType("text");
@@ -205,27 +218,29 @@ namespace _2021_backend.Migrations
.HasColumnType("text");
b.Property("SubmitTime")
- .HasColumnType("timestamp without time zone");
+ .HasColumnType("timestamp with time zone");
b.Property("Tel")
.HasColumnType("text");
- b.Property>("Timelist")
- .HasColumnType("uuid[]");
+ b.Property>("Timelist")
+ .HasColumnType("integer[]");
b.Property("Yard")
.HasColumnType("integer");
- b.HasKey("Guid");
+ b.HasKey("Id");
- b.ToTable("Submissions");
+ b.ToTable("Submissions", (string)null);
});
modelBuilder.Entity("_2021_backend.Models.User", b =>
{
- b.Property("Guid")
+ b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("uuid");
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.HasColumnType("text");
@@ -239,9 +254,9 @@ namespace _2021_backend.Migrations
b.Property("stuID")
.HasColumnType("text");
- b.HasKey("Guid");
+ b.HasKey("Id");
- b.ToTable("Users");
+ b.ToTable("Users", (string)null);
});
#pragma warning restore 612, 618
}
diff --git a/Models/Comment.cs b/Models/Comment.cs
index cc843d8..61c6f0b 100644
--- a/Models/Comment.cs
+++ b/Models/Comment.cs
@@ -11,30 +11,31 @@ namespace _2021_backend.Models
{
public Comment()
{
- Guid = Guid.NewGuid();
- AddTime = DateTime.Now;
+ Id = 0;
+ AddTime = DateTime.Now;
}
[Key]
- public Guid Guid { get; set; }
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; set; }
[Required()]
- [Display(Name ="评论者")]
- public Guid Operator { get; set; }
+ [Display(Name = "评论者")]
+ public int Operator { get; set; }
[Required()]
- [Display(Name ="内容")]
+ [Display(Name = "内容")]
public string Content { get; set; }
[Display(Name = "评论时间")]
[DataType(DataType.DateTime)]
public DateTime AddTime { get; set; }
- [Display(Name ="被评论者")]
- public Guid Student { get; set; }
- public Comment(Guid opid,string content, Guid stuguid)
+ [Display(Name = "被评论者")]
+ public int Student { get; set; }
+ public Comment(int opid, string content, int stuint)
{
- Guid = Guid.NewGuid();
+ Id = 0;
Operator = opid;
Content = content;
- Student = stuguid;
+ Student = stuint;
AddTime = DateTime.Now;
}
diff --git a/Models/SMS.cs b/Models/SMS.cs
index 7b0e2c9..98177f9 100644
--- a/Models/SMS.cs
+++ b/Models/SMS.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
+using System.ComponentModel.DataAnnotations.Schema;
namespace _2021_backend.Models
{
@@ -18,16 +19,16 @@ namespace _2021_backend.Models
{
public SMS()
{
- Guid = Guid.NewGuid();
+ Id = 0;
Tel = "";
Data = new List { };
Type = SMSType.Accept;
Sender = "";
SendTime = DateTime.Now;
}
- public SMS(SMSPartialDto dto, Guid host)
+ public SMS(SMSPartialDto dto, int host)
{
- Guid = Guid.NewGuid();
+ Id = 0;
Tel = dto.SubscriberNumber;
Host = host;
Sender = dto.SubscriberNumber.ToString();
@@ -37,17 +38,18 @@ namespace _2021_backend.Models
SendTime = tm;
}
[Key]
- public Guid Guid { get; set; }
- [Display(Name ="Host")]
- public Guid Host { get; set; }
- [Display(Name ="电话号码")]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public int Id { get; set; }
+ [Display(Name = "Host")]
+ public int Host { get; set; }
+ [Display(Name = "电话号码")]
public string Tel { get; set; }
- [Display(Name ="短信内容")]
+ [Display(Name = "短信内容")]
public List Data { get; set; }
- [Display(Name ="短信类型")]
+ [Display(Name = "短信类型")]
public SMSType Type { get; set; }
- [Display(Name ="发送者")]
+ [Display(Name = "发送者")]
public string Sender { get; set; }
[Display(Name = "发送时间")]
[DisplayFormat(DataFormatString = "{0:g}", ApplyFormatInEditMode = true)]
diff --git a/Models/Session.cs b/Models/Session.cs
index 16c9f2a..c459cb9 100644
--- a/Models/Session.cs
+++ b/Models/Session.cs
@@ -14,12 +14,13 @@ namespace _2021_backend.Models
public Session()
{
- Guid = Guid.NewGuid();
+ Id = 0;
}
[Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Required()]
- [Display(Name = "场次GUID")]
- public Guid Guid { get; set; }
+ [Display(Name = "场次int")]
+ public int Id { get; set; }
[Required()]
[Display(Name = "活动日期")]
[DataType(DataType.Date)]
@@ -35,7 +36,7 @@ namespace _2021_backend.Models
[Required()]
public string Place { get; set; }
[Display(Name = "主活动官")]
- public List Chiefs { get; set; }
+ public List Chiefs { get; set; }
[Display(Name = "可容纳人数")]
public int Capacity { get; set; }
@@ -43,7 +44,7 @@ namespace _2021_backend.Models
[Display(Name = "短信通知")]
public bool SendSMS { get; set; }
[Display(Name = "活动的人")]
- public List Students { get; set; }
+ public List Students { get; set; }
}
public class SessionDto
@@ -57,7 +58,7 @@ namespace _2021_backend.Models
public class SessionDtoComparer : IEqualityComparer
{
#region IEqualityComparer Members
- public bool Equals(SessionDto a,SessionDto b)
+ public bool Equals(SessionDto a, SessionDto b)
{
return a.Day == b.Day && a.BeginTime == b.BeginTime;
}
diff --git a/Models/Student.cs b/Models/Student.cs
index 51fea32..ee7ef3f 100644
--- a/Models/Student.cs
+++ b/Models/Student.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;
@@ -64,22 +65,22 @@ namespace _2021_backend.Models
Major = sub.Major;
Yard = sub.Yard;
Exp = sub.Exp;
- Timelist = sub.Timelist;
- Submissions.Add(sub.Guid);
+ Timelist = sub.Timelist;
+ Submissions.Add(sub.Id);
}
public Student()
{
- Guid = Guid.NewGuid();
- Comments = new List();
- Messages = new List();
- Submissions = new List();
- Timelist = new List();
+ Id = 0;
+ Comments = new List();
+ Messages = new List();
+ Submissions = new List();
+ Timelist = new List();
}
public static Student create(Submission sub)
{
Student student = new Student();
- student.Guid = Guid.NewGuid();
+ student.Id = 0;
student.Name = sub.Name;
student.Email = sub.Email;
student.Tel = sub.Tel;
@@ -90,13 +91,14 @@ namespace _2021_backend.Models
student.Yard = sub.Yard;
student.Exp = sub.Exp;
student.Timelist = sub.Timelist;
- student.Submissions.Add(sub.Guid);
+ student.Submissions.Add(sub.Id);
student.RegisterTime = sub.SubmitTime;
return student;
}
[Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Display(Name = "ID")]
- public Guid Guid { get; set; }
+ public int Id { get; set; }
[Display(Name = "姓名")]
public string Name { get; set; }
[Display(Name = "学号")]
@@ -107,7 +109,7 @@ namespace _2021_backend.Models
public grade Grade { get; set; }
[Display(Name = "学园")]
- public yard Yard { get; set; }
+ public yard Yard { get; set; }
[Display(Name = "专业")]
public string Major { get; set; }
[Display(Name = "电子邮件")]
@@ -116,20 +118,20 @@ namespace _2021_backend.Models
public string Tel { get; set; }
[Display(Name = "经验程度")]
- public experience Exp { get; set; }
+ public experience Exp { get; set; }
[Display(Name = "最终场次")]
- public Guid InterviewTime { get; set; }
+ public int InterviewTime { get; set; }
[Display(Name = "提交记录")]
- public List Submissions { get; set; }
+ public List Submissions { get; set; }
[Display(Name = "短信记录")]
- public List Messages { get; set; }
+ public List