From fd34ac4822e45c636013109df1aff28f118bcfcb Mon Sep 17 00:00:00 2001 From: Mohd Ariff Date: Wed, 27 Nov 2024 16:30:29 +0800 Subject: [PATCH] Update --- Areas/Inventory/Models/ItemModel.cs | 4 +- Controllers/API/Inventory/InvMainAPI.cs | 8 +- ...20241127081155_UpdateItemModel.Designer.cs | 648 ++++++++++++++++++ Migrations/20241127081155_UpdateItemModel.cs | 96 +++ Migrations/AuthDBContextModelSnapshot.cs | 39 +- 5 files changed, 780 insertions(+), 15 deletions(-) create mode 100644 Migrations/20241127081155_UpdateItemModel.Designer.cs create mode 100644 Migrations/20241127081155_UpdateItemModel.cs diff --git a/Areas/Inventory/Models/ItemModel.cs b/Areas/Inventory/Models/ItemModel.cs index 069de0b..32aa1a8 100644 --- a/Areas/Inventory/Models/ItemModel.cs +++ b/Areas/Inventory/Models/ItemModel.cs @@ -6,7 +6,9 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models public class ItemModel { [Key] - public string? ItemID { get; set; } + public int ItemID { get; set; } + [Required] + public string? UniqueID { get; set; } public required int CompanyId { get; set; } public required int DepartmentId { get; set; } public required int ProductId { get; set; } diff --git a/Controllers/API/Inventory/InvMainAPI.cs b/Controllers/API/Inventory/InvMainAPI.cs index 6dcc84f..df46aff 100644 --- a/Controllers/API/Inventory/InvMainAPI.cs +++ b/Controllers/API/Inventory/InvMainAPI.cs @@ -181,9 +181,11 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory } try - { - _authDbContext.Items.Add(item); - await _authDbContext.SaveChangesAsync(); + { var itemDepartment = _authDbContext.Departments.Include(d => d.Company).Where(d => d.DepartmentId == item.DepartmentId).FirstOrDefault(); + string conpanyInitial = itemDepartment.Company.Name.ToString().Substring(0, 1).ToUpper(); + var uniqueId = Guid.NewGuid().ToString(); + //_authDbContext.Items.Add(item); + //await _authDbContext.SaveChangesAsync(); var updatedList = await _authDbContext.Items.ToListAsync(); return Json(updatedList); } diff --git a/Migrations/20241127081155_UpdateItemModel.Designer.cs b/Migrations/20241127081155_UpdateItemModel.Designer.cs new file mode 100644 index 0000000..0de93af --- /dev/null +++ b/Migrations/20241127081155_UpdateItemModel.Designer.cs @@ -0,0 +1,648 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using PSTW_CentralSystem.DBContext; + +#nullable disable + +namespace PSTW_CentralSystem.Migrations +{ + [DbContext(typeof(AuthDBContext))] + [Migration("20241127081155_UpdateItemModel")] + partial class UpdateItemModel + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.11") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetRoleClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("longtext"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserClaims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("ProviderKey") + .HasColumnType("varchar(255)"); + + b.Property("ProviderDisplayName") + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("AspNetUserLogins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("int"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("AspNetUserRoles", (string)null); + + b.HasData( + new + { + UserId = 1, + RoleId = 1 + }); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("int"); + + b.Property("LoginProvider") + .HasColumnType("varchar(255)"); + + b.Property("Name") + .HasColumnType("varchar(255)"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AspNetUserTokens", (string)null); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b => + { + b.Property("CompanyId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("CompanyId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("CompanyId"); + + b.ToTable("Companies"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => + { + b.Property("DepartmentId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("DepartmentId")); + + b.Property("CompanyId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("DepartmentId"); + + b.HasIndex("CompanyId"); + + b.ToTable("Departments"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => + { + b.Property("ItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); + + b.Property("CompanyId") + .HasColumnType("int"); + + b.Property("ConvertPrice") + .HasColumnType("float"); + + b.Property("Currency") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("CurrencyRate") + .HasColumnType("float"); + + b.Property("DODate") + .HasColumnType("datetime(6)"); + + b.Property("DepartmentId") + .HasColumnType("int"); + + b.Property("EndWDate") + .HasColumnType("datetime(6)"); + + b.Property("InvoiceDate") + .HasColumnType("datetime(6)"); + + b.Property("PONo") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("PriceInRM") + .HasColumnType("float"); + + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("PurchaseDate") + .HasColumnType("datetime(6)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SerialNumber") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Supplier") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UniqueID") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Warranty") + .HasColumnType("int"); + + b.HasKey("ItemID"); + + b.HasIndex("CompanyId"); + + b.HasIndex("DepartmentId"); + + b.HasIndex("ProductId"); + + b.ToTable("Items"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", b => + { + b.Property("ManufacturerId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ManufacturerId")); + + b.Property("ManufacturerName") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("ManufacturerId"); + + b.ToTable("Manufacturers"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => + { + b.Property("ProductId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ProductId")); + + b.Property("Category") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ImageProduct") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ManufacturerId") + .HasColumnType("int"); + + b.Property("ModelNo") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ProductName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("QuantityProduct") + .HasColumnType("int"); + + b.HasKey("ProductId"); + + b.HasIndex("ManufacturerId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b => + { + b.Property("SupplierId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SupplierId")); + + b.Property("SupplierEmail") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SupplierGender") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SupplierName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("SupplierPhoneNo") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("SupplierId"); + + b.ToTable("Suppliers"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b => + { + b.Property("SettingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("SettingId")); + + b.Property("AllowedUserType") + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("MethodAllowedUserType") + .HasColumnType("json"); + + b.Property("ModuleName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("varchar(50)"); + + b.Property("ModuleStatus") + .HasColumnType("int"); + + b.HasKey("SettingId"); + + b.ToTable("ModuleSettings"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Description") + .HasColumnType("longtext"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("AspNetRoles", (string)null); + + b.HasData( + new + { + Id = 1, + Description = "Can access all pages", + Name = "SuperAdmin", + NormalizedName = "SUPERADMIN" + }, + new + { + Id = 2, + Description = "Can access some admin pages", + Name = "SystemAdmin", + NormalizedName = "SYSTEMADMIN" + }, + new + { + Id = 3, + Description = "Can access operation pages", + Name = "Engineer", + NormalizedName = "ENGINEER" + }, + new + { + Id = 4, + Description = "Can access data viewer pages", + Name = "Observer", + NormalizedName = "OBSERVER" + }); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Models.UserModel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("longtext"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("FullName") + .HasColumnType("longtext"); + + b.Property("LockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LockoutEnd") + .HasColumnType("datetime(6)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("longtext"); + + b.Property("PhoneNumber") + .HasColumnType("longtext"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("SecurityStamp") + .HasColumnType("longtext"); + + b.Property("TwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("UserStatus") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("AspNetUsers", (string)null); + + b.HasData( + new + { + Id = 1, + AccessFailedCount = 0, + ConcurrencyStamp = "a04422b5-87e6-445c-9640-91f82b7ab925", + Email = "admin@pstw.com.my", + EmailConfirmed = true, + FullName = "MAAdmin", + LockoutEnabled = false, + NormalizedEmail = "ADMIN@PSTW.COM.MY", + NormalizedUserName = "ADMIN@PSTW.COM.MY", + PasswordHash = "AQAAAAIAAYagAAAAECKZDbSSf9PVXnc5gc11ayb/qGSLIVi595BpbLpr4GeEDCONiPEEGeKOF7Hmt2evRA==", + PhoneNumberConfirmed = false, + SecurityStamp = "a9620efc-3783-46d6-a769-9fa7b0cca19b", + TwoFactorEnabled = false, + UserName = "admin@pstw.com.my" + }, + new + { + Id = 2, + AccessFailedCount = 0, + ConcurrencyStamp = "608f450b-bfc3-4e15-a815-c9f25e0b92f4", + Email = "sysadmin@pstw.com.my", + EmailConfirmed = true, + FullName = "SysAdmin", + LockoutEnabled = false, + NormalizedEmail = "SYSADMIN@PSTW.COM.MY", + NormalizedUserName = "SYSADMIN@PSTW.COM.MY", + PasswordHash = "AQAAAAIAAYagAAAAED3P9MR4LRFRqUDqLBBwF3lpXLNrOzcoEkMjr2SJSU2u2z0mvwXXGtZO3wPy8PcwQQ==", + PhoneNumberConfirmed = false, + SecurityStamp = "0282ae31-790c-403a-8f42-3596b2d1e454", + TwoFactorEnabled = false, + UserName = "sysadmin@pstw.com.my" + }); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("PSTW_CentralSystem.Models.UserModel", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("PSTW_CentralSystem.Models.UserModel", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("PSTW_CentralSystem.Models.RoleModel", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PSTW_CentralSystem.Models.UserModel", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("PSTW_CentralSystem.Models.UserModel", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => + { + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") + .WithMany("Departments") + .HasForeignKey("CompanyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => + { + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") + .WithMany() + .HasForeignKey("CompanyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", "Department") + .WithMany() + .HasForeignKey("DepartmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") + .WithMany("Items") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Company"); + + b.Navigation("Department"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => + { + b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer") + .WithMany() + .HasForeignKey("ManufacturerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Manufacturer"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b => + { + b.Navigation("Departments"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => + { + b.Navigation("Items"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20241127081155_UpdateItemModel.cs b/Migrations/20241127081155_UpdateItemModel.cs new file mode 100644 index 0000000..4bbd63b --- /dev/null +++ b/Migrations/20241127081155_UpdateItemModel.cs @@ -0,0 +1,96 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PSTW_CentralSystem.Migrations +{ + /// + public partial class UpdateItemModel : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "QuantityProduct", + table: "Products", + type: "int", + nullable: true, + oldClrType: typeof(int), + oldType: "int"); + + migrationBuilder.AlterColumn( + name: "ItemID", + table: "Items", + type: "int", + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(255)") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn) + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "UniqueID", + table: "Items", + type: "longtext", + nullable: false) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.UpdateData( + table: "AspNetUsers", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, + values: new object[] { "a04422b5-87e6-445c-9640-91f82b7ab925", "AQAAAAIAAYagAAAAECKZDbSSf9PVXnc5gc11ayb/qGSLIVi595BpbLpr4GeEDCONiPEEGeKOF7Hmt2evRA==", "a9620efc-3783-46d6-a769-9fa7b0cca19b" }); + + migrationBuilder.UpdateData( + table: "AspNetUsers", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, + values: new object[] { "608f450b-bfc3-4e15-a815-c9f25e0b92f4", "AQAAAAIAAYagAAAAED3P9MR4LRFRqUDqLBBwF3lpXLNrOzcoEkMjr2SJSU2u2z0mvwXXGtZO3wPy8PcwQQ==", "0282ae31-790c-403a-8f42-3596b2d1e454" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "UniqueID", + table: "Items"); + + migrationBuilder.AlterColumn( + name: "QuantityProduct", + table: "Products", + type: "int", + nullable: false, + defaultValue: 0, + oldClrType: typeof(int), + oldType: "int", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ItemID", + table: "Items", + type: "varchar(255)", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.UpdateData( + table: "AspNetUsers", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, + values: new object[] { "dde44c98-793e-452c-8123-5252dc03d655", "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==", "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf" }); + + migrationBuilder.UpdateData( + table: "AspNetUsers", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" }, + values: new object[] { "b529f4f9-3426-4a74-b048-d8995fe3e647", "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==", "065ee938-093c-4816-ad28-f2e0831a7550" }); + } + } +} diff --git a/Migrations/AuthDBContextModelSnapshot.cs b/Migrations/AuthDBContextModelSnapshot.cs index 8990bb0..6fd9ad2 100644 --- a/Migrations/AuthDBContextModelSnapshot.cs +++ b/Migrations/AuthDBContextModelSnapshot.cs @@ -173,8 +173,11 @@ namespace PSTW_CentralSystem.Migrations modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b => { - b.Property("ItemID") - .HasColumnType("varchar(255)"); + b.Property("ItemID") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("ItemID")); b.Property("CompanyId") .HasColumnType("int"); @@ -225,6 +228,10 @@ namespace PSTW_CentralSystem.Migrations .IsRequired() .HasColumnType("longtext"); + b.Property("UniqueID") + .IsRequired() + .HasColumnType("longtext"); + b.Property("Warranty") .HasColumnType("int"); @@ -283,7 +290,7 @@ namespace PSTW_CentralSystem.Migrations .IsRequired() .HasColumnType("longtext"); - b.Property("QuantityProduct") + b.Property("QuantityProduct") .HasColumnType("int"); b.HasKey("ProductId"); @@ -491,16 +498,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 1, AccessFailedCount = 0, - ConcurrencyStamp = "dde44c98-793e-452c-8123-5252dc03d655", + ConcurrencyStamp = "a04422b5-87e6-445c-9640-91f82b7ab925", Email = "admin@pstw.com.my", EmailConfirmed = true, FullName = "MAAdmin", LockoutEnabled = false, NormalizedEmail = "ADMIN@PSTW.COM.MY", NormalizedUserName = "ADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==", + PasswordHash = "AQAAAAIAAYagAAAAECKZDbSSf9PVXnc5gc11ayb/qGSLIVi595BpbLpr4GeEDCONiPEEGeKOF7Hmt2evRA==", PhoneNumberConfirmed = false, - SecurityStamp = "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf", + SecurityStamp = "a9620efc-3783-46d6-a769-9fa7b0cca19b", TwoFactorEnabled = false, UserName = "admin@pstw.com.my" }, @@ -508,16 +515,16 @@ namespace PSTW_CentralSystem.Migrations { Id = 2, AccessFailedCount = 0, - ConcurrencyStamp = "b529f4f9-3426-4a74-b048-d8995fe3e647", + ConcurrencyStamp = "608f450b-bfc3-4e15-a815-c9f25e0b92f4", Email = "sysadmin@pstw.com.my", EmailConfirmed = true, FullName = "SysAdmin", LockoutEnabled = false, NormalizedEmail = "SYSADMIN@PSTW.COM.MY", NormalizedUserName = "SYSADMIN@PSTW.COM.MY", - PasswordHash = "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==", + PasswordHash = "AQAAAAIAAYagAAAAED3P9MR4LRFRqUDqLBBwF3lpXLNrOzcoEkMjr2SJSU2u2z0mvwXXGtZO3wPy8PcwQQ==", PhoneNumberConfirmed = false, - SecurityStamp = "065ee938-093c-4816-ad28-f2e0831a7550", + SecurityStamp = "0282ae31-790c-403a-8f42-3596b2d1e454", TwoFactorEnabled = false, UserName = "sysadmin@pstw.com.my" }); @@ -577,7 +584,7 @@ namespace PSTW_CentralSystem.Migrations modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b => { b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company") - .WithMany() + .WithMany("Departments") .HasForeignKey("CompanyId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -600,7 +607,7 @@ namespace PSTW_CentralSystem.Migrations .IsRequired(); b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", "Product") - .WithMany() + .WithMany("Items") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -622,6 +629,16 @@ namespace PSTW_CentralSystem.Migrations b.Navigation("Manufacturer"); }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b => + { + b.Navigation("Departments"); + }); + + modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b => + { + b.Navigation("Items"); + }); #pragma warning restore 612, 618 } }