// using System; using LingAdmin.API.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; #nullable disable namespace LingAdmin.API.Migrations { [DbContext(typeof(AppDbContext))] [Migration("20260128094001_AddUserAuthentication")] partial class AddUserAuthentication { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "8.0.1") .HasAnnotation("Relational:MaxIdentifierLength", 128); SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("LingAdmin.API.Models.AuditLog", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Action") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Timestamp") .HasColumnType("datetime2"); b.Property("User") .IsRequired() .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("AuditLogs"); b.HasData( new { Id = 101, Action = "Login", Timestamp = new DateTime(2023, 10, 26, 10, 0, 0, 0, DateTimeKind.Unspecified), User = "Admin" }, new { Id = 102, Action = "View Report", Timestamp = new DateTime(2023, 10, 26, 10, 5, 0, 0, DateTimeKind.Unspecified), User = "User1" }, new { Id = 103, Action = "Update Settings", Timestamp = new DateTime(2023, 10, 26, 11, 20, 0, 0, DateTimeKind.Unspecified), User = "Admin" }); }); modelBuilder.Entity("LingAdmin.API.Models.InventoryItem", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Name") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Price") .HasColumnType("decimal(18,2)"); b.Property("Sku") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Stock") .HasColumnType("int"); b.HasKey("Id"); b.ToTable("InventoryItems"); b.HasData( new { Id = 1, Name = "Laptop", Price = 1200m, Sku = "SKU001", Stock = 50 }, new { Id = 2, Name = "Mouse", Price = 25m, Sku = "SKU002", Stock = 200 }, new { Id = 3, Name = "Keyboard", Price = 45m, Sku = "SKU003", Stock = 150 }, new { Id = 4, Name = "Monitor", Price = 300m, Sku = "SKU004", Stock = 80 }); }); modelBuilder.Entity("LingAdmin.API.Models.Language", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Code") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Name") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Version") .IsRequired() .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("Languages"); b.HasData( new { Id = 1, Code = "en-US", Name = "English", Version = "1.2" }, new { Id = 2, Code = "zh-CN", Name = "简体中文", Version = "1.3" }); }); modelBuilder.Entity("LingAdmin.API.Models.MenuItem", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Icon") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Name") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Order") .HasColumnType("int"); b.Property("Path") .IsRequired() .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("MenuItems"); b.HasData( new { Id = 1, Icon = "LayoutDashboard", Name = "common.dashboard", Order = 1, Path = "/" }, new { Id = 2, Icon = "FileText", Name = "common.inventory", Order = 2, Path = "/view/inventory" }, new { Id = 3, Icon = "Settings", Name = "common.audit", Order = 3, Path = "/view/audit" }, new { Id = 4, Icon = "FileText", Name = "common.requisitions", Order = 4, Path = "/requisitions" }, new { Id = 5, Icon = "Users", Name = "common.users", Order = 5, Path = "/users" }); }); modelBuilder.Entity("LingAdmin.API.Models.Requisition", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Date") .HasColumnType("datetime2"); b.Property("Department") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Description") .HasColumnType("nvarchar(max)"); b.Property("ReqNo") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Requester") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Status") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("TotalAmount") .HasColumnType("decimal(18,2)"); b.HasKey("Id"); b.ToTable("Requisitions"); b.HasData( new { Id = 101, Date = new DateTime(2023, 10, 25, 0, 0, 0, 0, DateTimeKind.Unspecified), Department = "IT", Description = "Purchase of new laptops for the development team.", ReqNo = "PR-2023001", Requester = "John Doe", Status = "Approved", TotalAmount = 5000m }, new { Id = 102, Date = new DateTime(2023, 10, 26, 0, 0, 0, 0, DateTimeKind.Unspecified), Department = "HR", Description = "Office supplies for HR department.", ReqNo = "PR-2023002", Requester = "Jane Smith", Status = "Pending", TotalAmount = 1200m }, new { Id = 103, Date = new DateTime(2023, 10, 27, 0, 0, 0, 0, DateTimeKind.Unspecified), Department = "Sales", Description = "Marketing materials for Q4 campaign.", ReqNo = "PR-2023003", Requester = "Bob Johnson", Status = "Draft", TotalAmount = 3500m }); }); modelBuilder.Entity("LingAdmin.API.Models.RequisitionItem", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("ItemName") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Price") .HasColumnType("decimal(18,2)"); b.Property("Quantity") .HasColumnType("int"); b.Property("RequisitionId") .HasColumnType("int"); b.HasKey("Id"); b.HasIndex("RequisitionId"); b.ToTable("RequisitionItems"); b.HasData( new { Id = 1, ItemName = "MacBook Pro 16", Price = 2400m, Quantity = 2, RequisitionId = 101 }, new { Id = 2, ItemName = "Dell Monitor 27", Price = 300m, Quantity = 5, RequisitionId = 101 }); }); modelBuilder.Entity("LingAdmin.API.Models.Translation", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("Key") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("LanguageCode") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Value") .IsRequired() .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("Translations"); }); modelBuilder.Entity("LingAdmin.API.Models.User", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("int"); SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); b.Property("CreatedAt") .HasColumnType("datetime2"); b.Property("Email") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("LastLoginAt") .HasColumnType("datetime2"); b.Property("Name") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("PasswordHash") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Role") .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("Status") .IsRequired() .HasColumnType("nvarchar(max)"); b.HasKey("Id"); b.ToTable("Users"); b.HasData( new { Id = 1, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "john@example.com", Name = "John Doe", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "Admin", Status = "Active" }, new { Id = 2, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "jane@example.com", Name = "Jane Smith", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "User", Status = "Inactive" }, new { Id = 3, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "bob@example.com", Name = "Bob Johnson", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "Editor", Status = "Active" }, new { Id = 4, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "alice@example.com", Name = "Alice Williams", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "User", Status = "Active" }, new { Id = 5, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "charlie@example.com", Name = "Charlie Brown", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "User", Status = "Inactive" }, new { Id = 6, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "david@example.com", Name = "David Miller", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "Admin", Status = "Active" }, new { Id = 7, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "eva@example.com", Name = "Eva Davis", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "Editor", Status = "Active" }, new { Id = 8, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "frank@example.com", Name = "Frank Wilson", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "User", Status = "Inactive" }, new { Id = 9, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "grace@example.com", Name = "Grace Taylor", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "User", Status = "Active" }, new { Id = 10, CreatedAt = new DateTime(2023, 10, 1, 0, 0, 0, 0, DateTimeKind.Utc), Email = "henry@example.com", Name = "Henry Anderson", PasswordHash = "gKr1UuNiCaLMqJ2gVPOJEXBEjN+zMdJH96kXgR/1KEA=", Role = "User", Status = "Active" }); }); modelBuilder.Entity("LingAdmin.API.Models.RequisitionItem", b => { b.HasOne("LingAdmin.API.Models.Requisition", "Requisition") .WithMany("Items") .HasForeignKey("RequisitionId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("Requisition"); }); modelBuilder.Entity("LingAdmin.API.Models.Requisition", b => { b.Navigation("Items"); }); #pragma warning restore 612, 618 } } }