LingAdmin/Backend/LingAdmin.API/Migrations/20260128092921_AddInventory...

521 lines
19 KiB
C#
Raw Normal View History

2026-04-16 18:13:06 +08:00
// <auto-generated />
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("20260128092921_AddInventoryAndAudit")]
partial class AddInventoryAndAudit
{
/// <inheritdoc />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Action")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Timestamp")
.HasColumnType("datetime2");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.Property<string>("Sku")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Icon")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Order")
.HasColumnType("int");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime>("Date")
.HasColumnType("datetime2");
b.Property<string>("Department")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("ReqNo")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Requester")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ItemName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("Price")
.HasColumnType("decimal(18,2)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<int>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Key")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("LanguageCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Translations");
});
modelBuilder.Entity("LingAdmin.API.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Role")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
b.HasData(
new
{
Id = 1,
Email = "john@example.com",
Name = "John Doe",
Role = "Admin",
Status = "Active"
},
new
{
Id = 2,
Email = "jane@example.com",
Name = "Jane Smith",
Role = "User",
Status = "Inactive"
},
new
{
Id = 3,
Email = "bob@example.com",
Name = "Bob Johnson",
Role = "Editor",
Status = "Active"
},
new
{
Id = 4,
Email = "alice@example.com",
Name = "Alice Williams",
Role = "User",
Status = "Active"
},
new
{
Id = 5,
Email = "charlie@example.com",
Name = "Charlie Brown",
Role = "User",
Status = "Inactive"
},
new
{
Id = 6,
Email = "david@example.com",
Name = "David Miller",
Role = "Admin",
Status = "Active"
},
new
{
Id = 7,
Email = "eva@example.com",
Name = "Eva Davis",
Role = "Editor",
Status = "Active"
},
new
{
Id = 8,
Email = "frank@example.com",
Name = "Frank Wilson",
Role = "User",
Status = "Inactive"
},
new
{
Id = 9,
Email = "grace@example.com",
Name = "Grace Taylor",
Role = "User",
Status = "Active"
},
new
{
Id = 10,
Email = "henry@example.com",
Name = "Henry Anderson",
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
}
}
}