From 6e17b22dd16fb772a45264c8590dd9077ff7ccff Mon Sep 17 00:00:00 2001 From: Wind-Explorer Date: Sun, 9 Feb 2025 13:44:01 +0800 Subject: [PATCH] Increased "Who am I" length limit --- AceJobAgency.client/src/pages/MemberPage.tsx | 4 +- AceJobAgency/Entities/User.cs | 2 +- ...209053730_IncreasedWhoamiLimit.Designer.cs | 100 ++++++++++++++++++ .../20250209053730_IncreasedWhoamiLimit.cs | 42 ++++++++ .../Migrations/DataContextModelSnapshot.cs | 4 +- 5 files changed, 147 insertions(+), 5 deletions(-) create mode 100644 AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.Designer.cs create mode 100644 AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.cs diff --git a/AceJobAgency.client/src/pages/MemberPage.tsx b/AceJobAgency.client/src/pages/MemberPage.tsx index d141ebd..a991b5d 100644 --- a/AceJobAgency.client/src/pages/MemberPage.tsx +++ b/AceJobAgency.client/src/pages/MemberPage.tsx @@ -138,10 +138,10 @@ export default function MemberPage() {

Who am I

- + {userProfile.whoAmI.length > 0 ? ( {userProfile.whoAmI} diff --git a/AceJobAgency/Entities/User.cs b/AceJobAgency/Entities/User.cs index 45c0e6f..f38ab36 100644 --- a/AceJobAgency/Entities/User.cs +++ b/AceJobAgency/Entities/User.cs @@ -40,7 +40,7 @@ namespace AceJobAgency.Entities [MaxLength(128)] public required string ResumeName { get; set; } - [MaxLength(255)] + [MaxLength(2048)] public string WhoAmI { get; set; } = string.Empty; public int IsActive { get; set; } = 1; diff --git a/AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.Designer.cs b/AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.Designer.cs new file mode 100644 index 0000000..6b1f9ea --- /dev/null +++ b/AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.Designer.cs @@ -0,0 +1,100 @@ +// +using System; +using AceJobAgency.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AceJobAgency.Migrations +{ + [DbContext(typeof(DataContext))] + [Migration("20250209053730_IncreasedWhoamiLimit")] + partial class IncreasedWhoamiLimit + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.2") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("AceJobAgency.Entities.User", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("varchar(36)"); + + b.Property("CreatedAt") + .HasColumnType("datetime(6)"); + + b.Property("DateOfBirth") + .HasColumnType("datetime(6)"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("FailedLoginAttempts") + .HasColumnType("int"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("Gender") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("int"); + + b.Property("IsLockedOut") + .HasColumnType("tinyint(1)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("LockoutEndTime") + .HasColumnType("datetime(6)"); + + b.Property("NationalRegistrationIdentityCardNumber") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("varchar(255)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ResumeName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("UpdatedAt") + .HasColumnType("datetime(6)"); + + b.Property("WhoAmI") + .IsRequired() + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.cs b/AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.cs new file mode 100644 index 0000000..4581699 --- /dev/null +++ b/AceJobAgency/Migrations/20250209053730_IncreasedWhoamiLimit.cs @@ -0,0 +1,42 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AceJobAgency.Migrations +{ + /// + public partial class IncreasedWhoamiLimit : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "WhoAmI", + table: "Users", + type: "varchar(2048)", + maxLength: 2048, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(255)", + oldMaxLength: 255) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "WhoAmI", + table: "Users", + type: "varchar(255)", + maxLength: 255, + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(2048)", + oldMaxLength: 2048) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + } + } +} diff --git a/AceJobAgency/Migrations/DataContextModelSnapshot.cs b/AceJobAgency/Migrations/DataContextModelSnapshot.cs index 16f9639..f7d244f 100644 --- a/AceJobAgency/Migrations/DataContextModelSnapshot.cs +++ b/AceJobAgency/Migrations/DataContextModelSnapshot.cs @@ -84,8 +84,8 @@ namespace AceJobAgency.Migrations b.Property("WhoAmI") .IsRequired() - .HasMaxLength(255) - .HasColumnType("varchar(255)"); + .HasMaxLength(2048) + .HasColumnType("varchar(2048)"); b.HasKey("Id");