This commit is contained in:
MOHD ARIFF 2024-11-26 16:30:40 +08:00
parent caac6c0d39
commit 0168aa1929
23 changed files with 473 additions and 4093 deletions

View File

@ -10,6 +10,6 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
public required string Name { get; set; }
public required int CompanyId { get; set; }
[ForeignKey("CompanyId")]
public virtual required CompanyModel Company { get; set; }
public virtual CompanyModel? Company { get; set; }
}
}

View File

@ -24,10 +24,10 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
public required DateTime EndWDate { get; set; }
public required DateTime InvoiceDate { get; set; }
[ForeignKey("CompanyId")]
public required virtual CompanyModel Company { get; set; }
public virtual CompanyModel? Company { get; set; }
[ForeignKey("DepartmentId")]
public required virtual DepartmentModel Department { get; set; }
public virtual DepartmentModel? Department { get; set; }
[ForeignKey("ProductId")]
public required virtual ProductModel Product { get; set; }
public virtual ProductModel? Product { get; set; }
}
}

View File

@ -8,13 +8,12 @@ namespace PSTW_CentralSystem.Areas.Inventory.Models
[Key]
public int ProductId { get; set; }
public required string ProductName { get; set; }
public required string Manufacturer { get; set; }
public required int ManufacturerId { get; set; }
public required string Category { get; set; }
public required string ModelNo { get; set; }
public required int QuantityProduct { get; set; }
public int? QuantityProduct { get; set; }
public required string ImageProduct { get; set; }
public required int CompanyId { get; set; }
[ForeignKey("CompanyId")]
public required virtual CompanyModel Company { get; set; }
[ForeignKey("ManufacturerId")]
public virtual ManufacturerModel? Manufacturer { get; set; }
}
}

View File

@ -4,7 +4,9 @@
}
@await Html.PartialAsync("~/Areas/Inventory/Views/_InventoryPartial.cshtml");
<div class="row">
<div id="registerProduct" class="card m-1">
<div class="row" v-if="addSection == true">
<form v-on:submit.prevent="addProduct" data-aos="fade-right" >
<div class="container register" data-aos="fade-right">
<div class="row" data-aos="fade-right">
@ -62,14 +64,6 @@
</div>
</div>
@* Min Quantity Coding *@
<div class="form-group row">
<label for="quantityProduct" class="col-sm-3">Quantity:</label>
<div class="col-sm-9">
<input type="number" id="quantityProduct" name="quantityProduct" class="form-control" min="0" required v-model="quantityProduct">
</div>
</div>
@* Image Product Coding *@
<div class="form-group row">
<label for="imageProduct" class="col-sm-3">Image:</label>
@ -83,8 +77,8 @@
</div>
<div class="form-group row">
<div class="col-sm-9 offset-sm-3">
<button type="button" v-on:click="resetForm" class="btn btn-secondary">Reset</button>
<input type="submit" class="btn btn-primary">
<button type="button" v-on:click="resetForm" class="btn btn-secondary mx-1">Reset</button>
<input type="submit" class="btn btn-primary mx-1">
</div>
</div>
</div>
@ -94,24 +88,43 @@
</div>
</div>
</form>
<div class="row">
<button class="btn btn-danger col-md-3 m-1" v-on:click="addSection = false"><i class="fa fa-minus"></i>&nbsp;Hide Add Product Section</button>
</div>
</div>
<div class="row">
<button id="addProductBtn" class="btn btn-success col-md-3 m-1" v-show="addSection == false" v-on:click="addSection = true"><i class="fa fa-plus"></i>&nbsp;Show Add Product Section</button>
</div>
<div class="row">
<table class="table table-bordered table-hover" id="productTable"></table>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
@section Scripts {
@{
await Html.RenderPartialAsync("_ValidationScriptsPartial");
}
<script>
new Vue({
el: '#registerProduct',
data: {
$(function () {
app.mount('#registerProduct');
});
const app = Vue.createApp({
data() {
return {
addSection: false,
productName: null,
manufacturer: '',
manufacturers: null,
category: '',
categories: ["Item", "Part", "Disposable"],
modelNo: null,
quantityProduct: null,
imageProduct: null,
manufactures: [],
showOtherManufacturer: false,
imageSrc: '',
products: null,
}
},
mounted() {
// Fetch companies, depts, and products from the API
@ -119,25 +132,74 @@
this.fetchProducts();
},
methods: {
initiateTable() {
console.log(this.products)
this.manufacturerDatatable = $('#productTable').DataTable({
"data": this.products,
"columns": [
{ "title": "Product Name",
"data": "productName",
},
{ "title": "Model Number",
"data": "modelNo",
},
{ "title": "Manufacturer",
"data": "manufacturer.manufacturerName",
},
{ "title": "productName Category",
"data": "category",
},
{ "title": "Product Stock",
"data": "quantityProduct",
},
{ "title": "Image",
"data": "imageProduct",
},
{ "title": "Delete",
"render": function (data, type, full, meta) {
var deleteButton = `<button type="button" class="btn btn-danger delete-btn" data-id="${full.manufacturerId}">Delete</button>`;
return deleteButton;
},
"width": '10%',
},
],
})
self = this;
// Attach click event listener to the delete buttons
$('#manufacturerTable tbody').on('click', '.delete-btn', function () {
const manufacturerId = $(this).data('id'); // Get the manufacturer ID from the button
self.deleteManufacturer(manufacturerId); // Call the Vue method
});
this.loading = false;
},
async fetchManufactures() {
try {
const response = await fetch('/api/Product/GetManufactures'); // Call the API
if (!response.ok) {
throw new Error('Failed to fetch manufactures');
}
const data = await response.json(); // Get the full response object
this.manufactures = data.manufacturer; // Extract the 'manufacturer' array
} catch (error) {
console.error('Error fetching manufactures:', error);
fetch('/InvMainAPI/ManufacturerList', {
method: 'POST'
})
.then(response => response.json())
.then(data => {
if (data != null && data.length > 0)
{
this.manufacturers = data;
}
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
},
async fetchProducts() {
try {
const response = await fetch('/api/Product/GetProducts'); // Call the API
const response = await fetch('/InvMainAPI/ProductList',{
method: 'POST'
}); // Call the API
if (!response.ok) {
throw new Error('Failed to fetch products');
}
this.products = await response.json(); // Store the fetched products
this.$nextTick(() => {
this.initiateTable()
})
} catch (error) {
console.error('Error fetching products:', error);
}
@ -145,34 +207,33 @@
async addProduct() {
const existingProduct = this.products.find(p => p.modelNo === this.modelNo);
if (existingProduct) {
swal('Product Error', `The model number ${this.modelNo} already exists.`, 'error');
alert('Product Error', `The model number ${this.modelNo} already exists.`, 'error');
return; // Exit early if the modelNo exists
}
// Create the payload
const formData = {
productName: this.productName,
manufacturer: this.manufacturer,
manufacturerId: this.manufacturer,
category: this.category,
modelNo: this.modelNo,
quantityProduct: this.quantityProduct,
imageProduct: this.imageProduct
};
try {
// List of required fields
const requiredFields = ['productName', 'manufacturer', 'category', 'modelNo', 'quantityProduct', 'imageProduct'];
const requiredFields = ['productName', 'manufacturer', 'category', 'modelNo', 'imageProduct'];
// Loop through required fields and check if any are null or empty
for (let field of requiredFields) {
if (this[field] === null || this[field] === '') {
swal('Product Error', `Please fill in required fields: ${field}.`, 'warning');
alert('Product Error', `Please fill in required fields: ${field}.`, 'warning');
return; // Exit early if validation fails
}
}
// Proceed to send the data as raw JSON string
const response = await fetch('/api/Product', {
const response = await fetch('/InvMainAPI/AddProduct', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@ -186,22 +247,20 @@
this.errorMessage = 'Error: ' + (errorData.message || 'Unknown error');
} else {
swal('Success!', 'Product form has been successfully submitted.', 'success');
alert('Success!', 'Product form has been successfully submitted.', 'success');
this.resetForm();
}
} catch (error) {
console.error('Error:', error);
swal('Product Error', `An error occurred: ${error.message}`, 'error');
alert('Product Error', `An error occurred: ${error.message}`, 'error');
}
}
,
},
resetForm() {
this.productName = null;
this.manufacturer = '';
this.category = null;
this.category = '';
this.modelNo = null;
this.quantityProduct = null;
this.imageProduct = null;
this.imageSrc = '';
const fileInput = document.getElementById('imageProduct');
@ -242,23 +301,8 @@
this.imageProduct = null;
}
},
async fetchManufactures() {
fetch('/InvMainAPI/ManufacturerList', {
method: 'POST'
})
.then(response => response.json())
.then(data => {
console.log(data);
if (data != null && data.length > 0)
{
this.manufacturers = data;
}
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
},
}
});
</script>
}

View File

@ -72,7 +72,6 @@
})
.then(response => response.json())
.then(data => {
console.log(data);
if (data != null && data.length > 0)
{
this.manufacturer = data;

View File

@ -23,6 +23,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
_logger = logger;
_authDbContext = authDbContext;
}
#region Manufacturer
[HttpPost("ManufacturerList")]
public async Task<IActionResult> ManufacturerList()
@ -30,6 +31,7 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
var manifacturerList = await _authDbContext.Manufacturers.ToListAsync();
return Json(manifacturerList);
}
[HttpPost("AddManufacturer")]
public async Task<IActionResult> AddManufacturer([FromBody] ManufacturerModel manufacturer)
{
@ -72,6 +74,66 @@ namespace PSTW_CentralSystem.Controllers.API.Inventory
return Ok(new { success = true, message = "Manufacturer deleted successfully" });
}
#endregion Manufacturer
#region Product
[HttpPost("ProductList")]
public async Task<IActionResult> ProductList()
{
var productList = await _authDbContext.Products.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
return Json(productList);
}
[HttpPost("AddProduct")]
public async Task<IActionResult> AddProduct([FromBody] ProductModel product)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (product == null)
{
return NotFound("Product is null");
}
try
{
product.QuantityProduct = 0;
var productImage = product.ImageProduct; // Save image to wwwroot/media/inventory/images | Images name is product.ModelNo | product.ImageProduct is in base64 string
if (!string.IsNullOrEmpty(product.ImageProduct))
{
var bytes = Convert.FromBase64String(product.ImageProduct);
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/media/inventory/images", product.ModelNo);
await System.IO.File.WriteAllBytesAsync(filePath, bytes);
product.ImageProduct = "/media/inventory/images/" + product.ModelNo;
}
_authDbContext.Products.Add(product);
await _authDbContext.SaveChangesAsync();
var updatedList = await _authDbContext.Manufacturers.Include("Manufacturer").Where(x => x.ManufacturerId == x.ManufacturerId).ToListAsync();
return Json(updatedList);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[HttpDelete("DeleteProduct/{id}")]
public async Task<IActionResult> DeleteProduct(int id)
{
var Product = await _authDbContext.Manufacturers.FindAsync(id);
if (Product == null)
{
return NotFound(new { success = false, message = "Product not found" });
}
_authDbContext.Manufacturers.Remove(Product);
await _authDbContext.SaveChangesAsync();
return Ok(new { success = true, message = "Product deleted successfully" });
}
#endregion Product
}
}

View File

@ -1,392 +0,0 @@
// <auto-generated />
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("20241120071120_Initiate")]
partial class Initiate
{
/// <inheritdoc />
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<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("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<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
{
b.Property<int>("SettingId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
b.Property<string>("AllowedUserType")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("MethodAllowedUserType")
.HasColumnType("json");
b.Property<string>("ModuleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("ModuleStatus")
.HasColumnType("int");
b.HasKey("SettingId");
b.ToTable("ModuleSettings");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("FullName")
.HasColumnType("longtext");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int?>("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 = "e4431078-c853-410b-8369-eba4c21937f0",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAENdEN8F2O8D9gJofhSQV6UDhcjh2+C7TvjAC+KgJMUbFJbGBNXPvOORKISb0jRhftA==",
PhoneNumberConfirmed = false,
SecurityStamp = "bce6229e-4b74-4324-a89d-5f3210daccfb",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
new
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "94504423-6916-4a9e-baf2-271beb3b3f2a",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEApFYVWK3qRpzEM6jFFw5EDohJ+xHCxX2EDABsUg65pa0iA1h54wp9yf/gp2qVxvVg==",
PhoneNumberConfirmed = false,
SecurityStamp = "0d07b058-1d11-40a9-875e-6631d26702cb",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", 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<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,392 +0,0 @@
// <auto-generated />
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("20241122082905_addInventoryTable")]
partial class addInventoryTable
{
/// <inheritdoc />
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<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("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<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
{
b.Property<int>("SettingId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
b.Property<string>("AllowedUserType")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("MethodAllowedUserType")
.HasColumnType("json");
b.Property<string>("ModuleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("ModuleStatus")
.HasColumnType("int");
b.HasKey("SettingId");
b.ToTable("ModuleSettings");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("FullName")
.HasColumnType("longtext");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int?>("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 = "f79b6001-14b2-4a38-9053-260da45ada52",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEOYjD3O+nyYU9Fk9q39d6tSeunezi9sWZCz4DbTkHsR6Dc7+FOkgYtFdC/SUbQY6qw==",
PhoneNumberConfirmed = false,
SecurityStamp = "7d64818d-d890-4c39-9bf9-f74c69fcfb1b",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
new
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "bdf8a940-37e3-4c91-9f3e-c69d9aaea315",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEG8sIA+qY2dDrUrmX4jmFgKojC/X8pT9bv60D+yIy93/8vNy6qmRgLqebYjkZ1CjVw==",
PhoneNumberConfirmed = false,
SecurityStamp = "07ca3eae-b820-4219-b52f-7957244e272f",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", 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<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,46 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
/// <inheritdoc />
public partial class addInventoryTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "f79b6001-14b2-4a38-9053-260da45ada52", "AQAAAAIAAYagAAAAEOYjD3O+nyYU9Fk9q39d6tSeunezi9sWZCz4DbTkHsR6Dc7+FOkgYtFdC/SUbQY6qw==", "7d64818d-d890-4c39-9bf9-f74c69fcfb1b" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "bdf8a940-37e3-4c91-9f3e-c69d9aaea315", "AQAAAAIAAYagAAAAEG8sIA+qY2dDrUrmX4jmFgKojC/X8pT9bv60D+yIy93/8vNy6qmRgLqebYjkZ1CjVw==", "07ca3eae-b820-4219-b52f-7957244e272f" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "e4431078-c853-410b-8369-eba4c21937f0", "AQAAAAIAAYagAAAAENdEN8F2O8D9gJofhSQV6UDhcjh2+C7TvjAC+KgJMUbFJbGBNXPvOORKISb0jRhftA==", "bce6229e-4b74-4324-a89d-5f3210daccfb" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "94504423-6916-4a9e-baf2-271beb3b3f2a", "AQAAAAIAAYagAAAAEApFYVWK3qRpzEM6jFFw5EDohJ+xHCxX2EDABsUg65pa0iA1h54wp9yf/gp2qVxvVg==", "0d07b058-1d11-40a9-875e-6631d26702cb" });
}
}
}

View File

@ -1,611 +0,0 @@
// <auto-generated />
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("20241125030825_UpdateInventory")]
partial class UpdateInventory
{
/// <inheritdoc />
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<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("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<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
{
b.Property<int>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CompanyId");
b.ToTable("Companies");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
{
b.Property<int>("DepartmentId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("DepartmentId");
b.HasIndex("CompanyId");
b.ToTable("Departments");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
{
b.Property<int>("ItemID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ItemID"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<float>("ConvertPrice")
.HasColumnType("float");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("CurrencyRate")
.HasColumnType("float");
b.Property<DateTime>("DODate")
.HasColumnType("datetime(6)");
b.Property<string>("Dept")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("EndWDate")
.HasColumnType("datetime(6)");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("InvoiceDate")
.HasColumnType("datetime(6)");
b.Property<string>("PONo")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("PriceInRM")
.HasColumnType("float");
b.Property<string>("ProductCategory")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("PurchaseDate")
.HasColumnType("datetime(6)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("SerialNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Supplier")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("Warranty")
.HasColumnType("int");
b.HasKey("ItemID");
b.HasIndex("CompanyId");
b.ToTable("Items");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.Property<int>("ProductId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
b.Property<string>("Category")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Manufacturer")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ModelNo")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("QuantityProduct")
.HasColumnType("int");
b.HasKey("ProductId");
b.HasIndex("CompanyId");
b.ToTable("Products");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
{
b.Property<int>("SupplierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
b.Property<string>("SupplierEmail")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierGender")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierPhoneNo")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SupplierId");
b.ToTable("Suppliers");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
{
b.Property<int>("SettingId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
b.Property<string>("AllowedUserType")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("MethodAllowedUserType")
.HasColumnType("json");
b.Property<string>("ModuleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("ModuleStatus")
.HasColumnType("int");
b.HasKey("SettingId");
b.ToTable("ModuleSettings");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("FullName")
.HasColumnType("longtext");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int?>("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 = "ca9d09a9-e64c-4e77-b4db-5f3a74347c2e",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEE5O/c/d64bTFVIMdF4bXbFvJTX6o0Tfz5yMhUEHmWqKGGD+QR5awcQMkOxQrZiPyA==",
PhoneNumberConfirmed = false,
SecurityStamp = "2d5b2076-6914-4946-b8d1-58d8b1739a41",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
new
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "29852249-ce04-40a3-b735-6aa3ec4d6fae",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEIxZLeIlI9khL2sAGbA9ueokgHFkd1IKX4bYRAm9vCnd0gHCPfo4SAra5ageTh7aOg==",
PhoneNumberConfirmed = false,
SecurityStamp = "889bcd81-6fec-42e5-ae31-77f759d3d88a",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", 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<int>", 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()
.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.Navigation("Company");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,212 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
/// <inheritdoc />
public partial class UpdateInventory : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Companies",
columns: table => new
{
CompanyId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Companies", x => x.CompanyId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Suppliers",
columns: table => new
{
SupplierId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
SupplierName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplierGender = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplierEmail = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplierPhoneNo = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Suppliers", x => x.SupplierId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Departments",
columns: table => new
{
DepartmentId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CompanyId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Departments", x => x.DepartmentId);
table.ForeignKey(
name: "FK_Departments_Companies_CompanyId",
column: x => x.CompanyId,
principalTable: "Companies",
principalColumn: "CompanyId",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Items",
columns: table => new
{
ItemID = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CompanyId = table.Column<int>(type: "int", nullable: false),
Dept = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProductName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ImageProduct = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ProductCategory = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SerialNumber = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Quantity = table.Column<int>(type: "int", nullable: false),
Supplier = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
PurchaseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
PONo = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Currency = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
PriceInRM = table.Column<float>(type: "float", nullable: false),
CurrencyRate = table.Column<float>(type: "float", nullable: false),
ConvertPrice = table.Column<float>(type: "float", nullable: false),
DODate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Warranty = table.Column<int>(type: "int", nullable: false),
EndWDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
InvoiceDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.ItemID);
table.ForeignKey(
name: "FK_Items_Companies_CompanyId",
column: x => x.CompanyId,
principalTable: "Companies",
principalColumn: "CompanyId",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
ProductId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ProductName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Manufacturer = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Category = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ModelNo = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
QuantityProduct = table.Column<int>(type: "int", nullable: false),
ImageProduct = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CompanyId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.ProductId);
table.ForeignKey(
name: "FK_Products_Companies_CompanyId",
column: x => x.CompanyId,
principalTable: "Companies",
principalColumn: "CompanyId",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "ca9d09a9-e64c-4e77-b4db-5f3a74347c2e", "AQAAAAIAAYagAAAAEE5O/c/d64bTFVIMdF4bXbFvJTX6o0Tfz5yMhUEHmWqKGGD+QR5awcQMkOxQrZiPyA==", "2d5b2076-6914-4946-b8d1-58d8b1739a41" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "29852249-ce04-40a3-b735-6aa3ec4d6fae", "AQAAAAIAAYagAAAAEIxZLeIlI9khL2sAGbA9ueokgHFkd1IKX4bYRAm9vCnd0gHCPfo4SAra5ageTh7aOg==", "889bcd81-6fec-42e5-ae31-77f759d3d88a" });
migrationBuilder.CreateIndex(
name: "IX_Departments_CompanyId",
table: "Departments",
column: "CompanyId");
migrationBuilder.CreateIndex(
name: "IX_Items_CompanyId",
table: "Items",
column: "CompanyId");
migrationBuilder.CreateIndex(
name: "IX_Products_CompanyId",
table: "Products",
column: "CompanyId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Departments");
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "Products");
migrationBuilder.DropTable(
name: "Suppliers");
migrationBuilder.DropTable(
name: "Companies");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "f79b6001-14b2-4a38-9053-260da45ada52", "AQAAAAIAAYagAAAAEOYjD3O+nyYU9Fk9q39d6tSeunezi9sWZCz4DbTkHsR6Dc7+FOkgYtFdC/SUbQY6qw==", "7d64818d-d890-4c39-9bf9-f74c69fcfb1b" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "bdf8a940-37e3-4c91-9f3e-c69d9aaea315", "AQAAAAIAAYagAAAAEG8sIA+qY2dDrUrmX4jmFgKojC/X8pT9bv60D+yIy93/8vNy6qmRgLqebYjkZ1CjVw==", "07ca3eae-b820-4219-b52f-7957244e272f" });
}
}
}

View File

@ -1,618 +0,0 @@
// <auto-generated />
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("20241125040942_UpdateInventory2")]
partial class UpdateInventory2
{
/// <inheritdoc />
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<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("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<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
{
b.Property<int>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CompanyId");
b.ToTable("Companies");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
{
b.Property<int>("DepartmentId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("DepartmentId");
b.HasIndex("CompanyId");
b.ToTable("Departments");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
{
b.Property<string>("ItemID")
.HasColumnType("varchar(255)");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<float>("ConvertPrice")
.HasColumnType("float");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("CurrencyRate")
.HasColumnType("float");
b.Property<DateTime>("DODate")
.HasColumnType("datetime(6)");
b.Property<int>("DepartmentId")
.HasColumnType("int");
b.Property<DateTime>("EndWDate")
.HasColumnType("datetime(6)");
b.Property<DateTime>("InvoiceDate")
.HasColumnType("datetime(6)");
b.Property<string>("PONo")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("PriceInRM")
.HasColumnType("float");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<DateTime>("PurchaseDate")
.HasColumnType("datetime(6)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("SerialNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Supplier")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("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.ProductModel", b =>
{
b.Property<int>("ProductId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
b.Property<string>("Category")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Manufacturer")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ModelNo")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("QuantityProduct")
.HasColumnType("int");
b.HasKey("ProductId");
b.HasIndex("CompanyId");
b.ToTable("Products");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
{
b.Property<int>("SupplierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
b.Property<string>("SupplierEmail")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierGender")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierPhoneNo")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SupplierId");
b.ToTable("Suppliers");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
{
b.Property<int>("SettingId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
b.Property<string>("AllowedUserType")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("MethodAllowedUserType")
.HasColumnType("json");
b.Property<string>("ModuleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("ModuleStatus")
.HasColumnType("int");
b.HasKey("SettingId");
b.ToTable("ModuleSettings");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("FullName")
.HasColumnType("longtext");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int?>("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 = "566de32b-8ac7-4fd9-9e16-d239fcf61f33",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEOs61no/950C9+WFQRSQg3Wssko80bGYfLBvlMN7EOcKf4Dj9TUFLjqAiM4jc7JKqg==",
PhoneNumberConfirmed = false,
SecurityStamp = "25fbc2fb-3ac0-4a83-a4f4-4abbcf9d1942",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
new
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "58495e52-8212-49a5-929a-04a759a1eaae",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEHI2wahcf8tCM2SlSfNPiluZtwp9QP2QOlom8Vc5L1FhbuZoex+1WlnhONaWtKHBZQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "be73a773-8c2d-4f23-9a79-cb5d106ac1d2",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", 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<int>", 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()
.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()
.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.CompanyModel", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,175 +0,0 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
/// <inheritdoc />
public partial class UpdateInventory2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Dept",
table: "Items");
migrationBuilder.DropColumn(
name: "ImageProduct",
table: "Items");
migrationBuilder.DropColumn(
name: "ProductCategory",
table: "Items");
migrationBuilder.DropColumn(
name: "ProductName",
table: "Items");
migrationBuilder.AlterColumn<string>(
name: "ItemID",
table: "Items",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AddColumn<int>(
name: "DepartmentId",
table: "Items",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ProductId",
table: "Items",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "566de32b-8ac7-4fd9-9e16-d239fcf61f33", "AQAAAAIAAYagAAAAEOs61no/950C9+WFQRSQg3Wssko80bGYfLBvlMN7EOcKf4Dj9TUFLjqAiM4jc7JKqg==", "25fbc2fb-3ac0-4a83-a4f4-4abbcf9d1942" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "58495e52-8212-49a5-929a-04a759a1eaae", "AQAAAAIAAYagAAAAEHI2wahcf8tCM2SlSfNPiluZtwp9QP2QOlom8Vc5L1FhbuZoex+1WlnhONaWtKHBZQ==", "be73a773-8c2d-4f23-9a79-cb5d106ac1d2" });
migrationBuilder.CreateIndex(
name: "IX_Items_DepartmentId",
table: "Items",
column: "DepartmentId");
migrationBuilder.CreateIndex(
name: "IX_Items_ProductId",
table: "Items",
column: "ProductId");
migrationBuilder.AddForeignKey(
name: "FK_Items_Departments_DepartmentId",
table: "Items",
column: "DepartmentId",
principalTable: "Departments",
principalColumn: "DepartmentId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Items_Products_ProductId",
table: "Items",
column: "ProductId",
principalTable: "Products",
principalColumn: "ProductId",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Items_Departments_DepartmentId",
table: "Items");
migrationBuilder.DropForeignKey(
name: "FK_Items_Products_ProductId",
table: "Items");
migrationBuilder.DropIndex(
name: "IX_Items_DepartmentId",
table: "Items");
migrationBuilder.DropIndex(
name: "IX_Items_ProductId",
table: "Items");
migrationBuilder.DropColumn(
name: "DepartmentId",
table: "Items");
migrationBuilder.DropColumn(
name: "ProductId",
table: "Items");
migrationBuilder.AlterColumn<int>(
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<string>(
name: "Dept",
table: "Items",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ImageProduct",
table: "Items",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ProductCategory",
table: "Items",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ProductName",
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[] { "ca9d09a9-e64c-4e77-b4db-5f3a74347c2e", "AQAAAAIAAYagAAAAEE5O/c/d64bTFVIMdF4bXbFvJTX6o0Tfz5yMhUEHmWqKGGD+QR5awcQMkOxQrZiPyA==", "2d5b2076-6914-4946-b8d1-58d8b1739a41" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "29852249-ce04-40a3-b735-6aa3ec4d6fae", "AQAAAAIAAYagAAAAEIxZLeIlI9khL2sAGbA9ueokgHFkd1IKX4bYRAm9vCnd0gHCPfo4SAra5ageTh7aOg==", "889bcd81-6fec-42e5-ae31-77f759d3d88a" });
}
}
}

View File

@ -1,635 +0,0 @@
// <auto-generated />
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("20241125044629_AddManifacturerModel")]
partial class AddManifacturerModel
{
/// <inheritdoc />
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<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("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<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
{
b.Property<int>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CompanyId");
b.ToTable("Companies");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
{
b.Property<int>("DepartmentId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("DepartmentId");
b.HasIndex("CompanyId");
b.ToTable("Departments");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
{
b.Property<string>("ItemID")
.HasColumnType("varchar(255)");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<float>("ConvertPrice")
.HasColumnType("float");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("CurrencyRate")
.HasColumnType("float");
b.Property<DateTime>("DODate")
.HasColumnType("datetime(6)");
b.Property<int>("DepartmentId")
.HasColumnType("int");
b.Property<DateTime>("EndWDate")
.HasColumnType("datetime(6)");
b.Property<DateTime>("InvoiceDate")
.HasColumnType("datetime(6)");
b.Property<string>("PONo")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("PriceInRM")
.HasColumnType("float");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<DateTime>("PurchaseDate")
.HasColumnType("datetime(6)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("SerialNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Supplier")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("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<int>("ManifacturerId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManifacturerId"));
b.Property<string>("ManifacturerName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("ManifacturerId");
b.ToTable("Manifacturers");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.Property<int>("ProductId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
b.Property<string>("Category")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Manufacturer")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ModelNo")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("QuantityProduct")
.HasColumnType("int");
b.HasKey("ProductId");
b.HasIndex("CompanyId");
b.ToTable("Products");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
{
b.Property<int>("SupplierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
b.Property<string>("SupplierEmail")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierGender")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierPhoneNo")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SupplierId");
b.ToTable("Suppliers");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
{
b.Property<int>("SettingId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
b.Property<string>("AllowedUserType")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("MethodAllowedUserType")
.HasColumnType("json");
b.Property<string>("ModuleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("ModuleStatus")
.HasColumnType("int");
b.HasKey("SettingId");
b.ToTable("ModuleSettings");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("FullName")
.HasColumnType("longtext");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int?>("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 = "23e577cb-b26f-47e6-bd98-aa4e600a69cb",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAELWRmCIfyew1rUthl5tw5zCupjCBpto6hwQFo63NWL69M7cp2d1SCy7yoUll1jQqkQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "e12db90e-efad-4d36-b0f8-af93b665dfb6",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
new
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "ff24ec03-3b72-4b88-aa9a-a37f3141dd9c",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAENmNTZg8skbp+aJcr4tvdrPKnYmI+Hmgi0Ah/t5Jy35zKSHNX0Dhu0BBGXVLyTliSQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "b2365439-64e8-4ba3-a4e5-4043c0c4b0e0",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", 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<int>", 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()
.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()
.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.CompanyModel", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,65 +0,0 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
/// <inheritdoc />
public partial class AddManifacturerModel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Manifacturers",
columns: table => new
{
ManifacturerId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ManifacturerName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Manifacturers", x => x.ManifacturerId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "23e577cb-b26f-47e6-bd98-aa4e600a69cb", "AQAAAAIAAYagAAAAELWRmCIfyew1rUthl5tw5zCupjCBpto6hwQFo63NWL69M7cp2d1SCy7yoUll1jQqkQ==", "e12db90e-efad-4d36-b0f8-af93b665dfb6" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "ff24ec03-3b72-4b88-aa9a-a37f3141dd9c", "AQAAAAIAAYagAAAAENmNTZg8skbp+aJcr4tvdrPKnYmI+Hmgi0Ah/t5Jy35zKSHNX0Dhu0BBGXVLyTliSQ==", "b2365439-64e8-4ba3-a4e5-4043c0c4b0e0" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Manifacturers");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "566de32b-8ac7-4fd9-9e16-d239fcf61f33", "AQAAAAIAAYagAAAAEOs61no/950C9+WFQRSQg3Wssko80bGYfLBvlMN7EOcKf4Dj9TUFLjqAiM4jc7JKqg==", "25fbc2fb-3ac0-4a83-a4f4-4abbcf9d1942" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "58495e52-8212-49a5-929a-04a759a1eaae", "AQAAAAIAAYagAAAAEHI2wahcf8tCM2SlSfNPiluZtwp9QP2QOlom8Vc5L1FhbuZoex+1WlnhONaWtKHBZQ==", "be73a773-8c2d-4f23-9a79-cb5d106ac1d2" });
}
}
}

View File

@ -1,635 +0,0 @@
// <auto-generated />
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("20241125051125_UpdateManifacturerModel")]
partial class UpdateManifacturerModel
{
/// <inheritdoc />
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<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("RoleId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClaimType")
.HasColumnType("longtext");
b.Property<string>("ClaimValue")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderKey")
.HasColumnType("varchar(255)");
b.Property<string>("ProviderDisplayName")
.HasColumnType("longtext");
b.Property<int>("UserId")
.HasColumnType("int");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<int>("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<int>", b =>
{
b.Property<int>("UserId")
.HasColumnType("int");
b.Property<string>("LoginProvider")
.HasColumnType("varchar(255)");
b.Property<string>("Name")
.HasColumnType("varchar(255)");
b.Property<string>("Value")
.HasColumnType("longtext");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", b =>
{
b.Property<int>("CompanyId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("CompanyId"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("CompanyId");
b.ToTable("Companies");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.DepartmentModel", b =>
{
b.Property<int>("DepartmentId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("DepartmentId"));
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("DepartmentId");
b.HasIndex("CompanyId");
b.ToTable("Departments");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ItemModel", b =>
{
b.Property<string>("ItemID")
.HasColumnType("varchar(255)");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<float>("ConvertPrice")
.HasColumnType("float");
b.Property<string>("Currency")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("CurrencyRate")
.HasColumnType("float");
b.Property<DateTime>("DODate")
.HasColumnType("datetime(6)");
b.Property<int>("DepartmentId")
.HasColumnType("int");
b.Property<DateTime>("EndWDate")
.HasColumnType("datetime(6)");
b.Property<DateTime>("InvoiceDate")
.HasColumnType("datetime(6)");
b.Property<string>("PONo")
.IsRequired()
.HasColumnType("longtext");
b.Property<float>("PriceInRM")
.HasColumnType("float");
b.Property<int>("ProductId")
.HasColumnType("int");
b.Property<DateTime>("PurchaseDate")
.HasColumnType("datetime(6)");
b.Property<int>("Quantity")
.HasColumnType("int");
b.Property<string>("SerialNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Supplier")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("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<int>("ManufacturesId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ManufacturesId"));
b.Property<string>("ManufacturesName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("ManufacturesId");
b.ToTable("Manifacturers");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.Property<int>("ProductId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ProductId"));
b.Property<string>("Category")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Manufacturer")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ModelNo")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("ProductName")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("QuantityProduct")
.HasColumnType("int");
b.HasKey("ProductId");
b.HasIndex("CompanyId");
b.ToTable("Products");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.SupplierModel", b =>
{
b.Property<int>("SupplierId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SupplierId"));
b.Property<string>("SupplierEmail")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierGender")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("SupplierPhoneNo")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("SupplierId");
b.ToTable("Suppliers");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.ModuleSettingModel", b =>
{
b.Property<int>("SettingId")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SettingId"));
b.Property<string>("AllowedUserType")
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("MethodAllowedUserType")
.HasColumnType("json");
b.Property<string>("ModuleName")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<int>("ModuleStatus")
.HasColumnType("int");
b.HasKey("SettingId");
b.ToTable("ModuleSettings");
});
modelBuilder.Entity("PSTW_CentralSystem.Models.RoleModel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Description")
.HasColumnType("longtext");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("longtext");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<bool>("EmailConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("FullName")
.HasColumnType("longtext");
b.Property<bool>("LockoutEnabled")
.HasColumnType("tinyint(1)");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetime(6)");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("PasswordHash")
.HasColumnType("longtext");
b.Property<string>("PhoneNumber")
.HasColumnType("longtext");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("tinyint(1)");
b.Property<string>("SecurityStamp")
.HasColumnType("longtext");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<int?>("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 = "0b144c73-eac3-46ed-b04c-0109e958043c",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAECyQRTu2SEHsnq6Qoyo4OEB8hwfTI97hruTOOWK6/DrCrOEH5th2DpYu2Bq7yUUEaQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "6b2ac3ea-069b-4064-a1e5-856e6d183681",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
new
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "4f9d5d52-9123-4715-9453-08607b43fc68",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEHhYutnublAEWEf49O5TXjZpXptCyJdu5sD2wVoqRbEdn0COmIYlc5IKFTfCMuDRtQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "314fdbc4-826d-4ee9-8296-a90bb6fe19f5",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.RoleModel", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
{
b.HasOne("PSTW_CentralSystem.Models.UserModel", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<int>", 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<int>", 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()
.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()
.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.CompanyModel", "Company")
.WithMany()
.HasForeignKey("CompanyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,66 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
/// <inheritdoc />
public partial class UpdateManifacturerModel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ManifacturerName",
table: "Manifacturers",
newName: "ManufacturesName");
migrationBuilder.RenameColumn(
name: "ManifacturerId",
table: "Manifacturers",
newName: "ManufacturesId");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "0b144c73-eac3-46ed-b04c-0109e958043c", "AQAAAAIAAYagAAAAECyQRTu2SEHsnq6Qoyo4OEB8hwfTI97hruTOOWK6/DrCrOEH5th2DpYu2Bq7yUUEaQ==", "6b2ac3ea-069b-4064-a1e5-856e6d183681" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "4f9d5d52-9123-4715-9453-08607b43fc68", "AQAAAAIAAYagAAAAEHhYutnublAEWEf49O5TXjZpXptCyJdu5sD2wVoqRbEdn0COmIYlc5IKFTfCMuDRtQ==", "314fdbc4-826d-4ee9-8296-a90bb6fe19f5" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ManufacturesName",
table: "Manifacturers",
newName: "ManifacturerName");
migrationBuilder.RenameColumn(
name: "ManufacturesId",
table: "Manifacturers",
newName: "ManifacturerId");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "23e577cb-b26f-47e6-bd98-aa4e600a69cb", "AQAAAAIAAYagAAAAELWRmCIfyew1rUthl5tw5zCupjCBpto6hwQFo63NWL69M7cp2d1SCy7yoUll1jQqkQ==", "e12db90e-efad-4d36-b0f8-af93b665dfb6" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "ff24ec03-3b72-4b88-aa9a-a37f3141dd9c", "AQAAAAIAAYagAAAAENmNTZg8skbp+aJcr4tvdrPKnYmI+Hmgi0Ah/t5Jy35zKSHNX0Dhu0BBGXVLyTliSQ==", "b2365439-64e8-4ba3-a4e5-4043c0c4b0e0" });
}
}
}

View File

@ -1,66 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PSTW_CentralSystem.Migrations
{
/// <inheritdoc />
public partial class UpdateManifacturerModel2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ManufacturesName",
table: "Manifacturers",
newName: "ManufacturerName");
migrationBuilder.RenameColumn(
name: "ManufacturesId",
table: "Manifacturers",
newName: "ManufacturerId");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "9ea0a171-7dcc-45a5-81a7-cfcfddbfd6e0", "AQAAAAIAAYagAAAAELSRntWl5rKnYA0TnNAC7qj54A7uRTevStsdc4WkfTXLZaNG1/J55Cl6laIR9kOR2g==", "a906bafd-1a37-41ec-9e08-0e6877a05dbb" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "daf3b4fc-8c91-4dbe-a01a-a7eb9a9200d3", "AQAAAAIAAYagAAAAEGRrzPnCkIDxBFOc9gMn+h/xYIdjN6rQZFMd0eSMfLk8n4u9AX6791Zzw/Q8UR5Xww==", "83dcb965-0f1d-4be3-ac42-e8476daca591" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "ManufacturerName",
table: "Manifacturers",
newName: "ManufacturesName");
migrationBuilder.RenameColumn(
name: "ManufacturerId",
table: "Manifacturers",
newName: "ManufacturesId");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 1,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "0b144c73-eac3-46ed-b04c-0109e958043c", "AQAAAAIAAYagAAAAECyQRTu2SEHsnq6Qoyo4OEB8hwfTI97hruTOOWK6/DrCrOEH5th2DpYu2Bq7yUUEaQ==", "6b2ac3ea-069b-4064-a1e5-856e6d183681" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: 2,
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "4f9d5d52-9123-4715-9453-08607b43fc68", "AQAAAAIAAYagAAAAEHhYutnublAEWEf49O5TXjZpXptCyJdu5sD2wVoqRbEdn0COmIYlc5IKFTfCMuDRtQ==", "314fdbc4-826d-4ee9-8296-a90bb6fe19f5" });
}
}
}

View File

@ -12,8 +12,8 @@ using PSTW_CentralSystem.DBContext;
namespace PSTW_CentralSystem.Migrations
{
[DbContext(typeof(AuthDBContext))]
[Migration("20241125051236_UpdateManifacturerModel2")]
partial class UpdateManifacturerModel2
[Migration("20241126071458_Initiate")]
partial class Initiate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -256,7 +256,7 @@ namespace PSTW_CentralSystem.Migrations
b.HasKey("ManufacturerId");
b.ToTable("Manifacturers");
b.ToTable("Manufacturers");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
@ -271,16 +271,12 @@ namespace PSTW_CentralSystem.Migrations
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Manufacturer")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("ManufacturerId")
.HasColumnType("int");
b.Property<string>("ModelNo")
.IsRequired()
@ -295,7 +291,7 @@ namespace PSTW_CentralSystem.Migrations
b.HasKey("ProductId");
b.HasIndex("CompanyId");
b.HasIndex("ManufacturerId");
b.ToTable("Products");
});
@ -498,16 +494,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 1,
AccessFailedCount = 0,
ConcurrencyStamp = "9ea0a171-7dcc-45a5-81a7-cfcfddbfd6e0",
ConcurrencyStamp = "dde44c98-793e-452c-8123-5252dc03d655",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAELSRntWl5rKnYA0TnNAC7qj54A7uRTevStsdc4WkfTXLZaNG1/J55Cl6laIR9kOR2g==",
PasswordHash = "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "a906bafd-1a37-41ec-9e08-0e6877a05dbb",
SecurityStamp = "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
@ -515,16 +511,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "daf3b4fc-8c91-4dbe-a01a-a7eb9a9200d3",
ConcurrencyStamp = "b529f4f9-3426-4a74-b048-d8995fe3e647",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEGRrzPnCkIDxBFOc9gMn+h/xYIdjN6rQZFMd0eSMfLk8n4u9AX6791Zzw/Q8UR5Xww==",
PasswordHash = "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==",
PhoneNumberConfirmed = false,
SecurityStamp = "83dcb965-0f1d-4be3-ac42-e8476daca591",
SecurityStamp = "065ee938-093c-4816-ad28-f2e0831a7550",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
@ -621,13 +617,13 @@ namespace PSTW_CentralSystem.Migrations
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
.WithMany()
.HasForeignKey("CompanyId")
.HasForeignKey("ManufacturerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
b.Navigation("Manufacturer");
});
#pragma warning restore 612, 618
}

View File

@ -76,6 +76,36 @@ namespace PSTW_CentralSystem.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Companies",
columns: table => new
{
CompanyId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Companies", x => x.CompanyId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Manufacturers",
columns: table => new
{
ManufacturerId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ManufacturerName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Manufacturers", x => x.ManufacturerId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "ModuleSettings",
columns: table => new
@ -98,6 +128,27 @@ namespace PSTW_CentralSystem.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Suppliers",
columns: table => new
{
SupplierId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
SupplierName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplierGender = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplierEmail = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SupplierPhoneNo = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Suppliers", x => x.SupplierId);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "AspNetRoleClaims",
columns: table => new
@ -219,6 +270,108 @@ namespace PSTW_CentralSystem.Migrations
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Departments",
columns: table => new
{
DepartmentId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CompanyId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Departments", x => x.DepartmentId);
table.ForeignKey(
name: "FK_Departments_Companies_CompanyId",
column: x => x.CompanyId,
principalTable: "Companies",
principalColumn: "CompanyId",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Products",
columns: table => new
{
ProductId = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
ProductName = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ManufacturerId = table.Column<int>(type: "int", nullable: false),
Category = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ModelNo = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
QuantityProduct = table.Column<int>(type: "int", nullable: false),
ImageProduct = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Products", x => x.ProductId);
table.ForeignKey(
name: "FK_Products_Manufacturers_ManufacturerId",
column: x => x.ManufacturerId,
principalTable: "Manufacturers",
principalColumn: "ManufacturerId",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Items",
columns: table => new
{
ItemID = table.Column<string>(type: "varchar(255)", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CompanyId = table.Column<int>(type: "int", nullable: false),
DepartmentId = table.Column<int>(type: "int", nullable: false),
ProductId = table.Column<int>(type: "int", nullable: false),
SerialNumber = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Quantity = table.Column<int>(type: "int", nullable: false),
Supplier = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
PurchaseDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
PONo = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Currency = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
PriceInRM = table.Column<float>(type: "float", nullable: false),
CurrencyRate = table.Column<float>(type: "float", nullable: false),
ConvertPrice = table.Column<float>(type: "float", nullable: false),
DODate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
Warranty = table.Column<int>(type: "int", nullable: false),
EndWDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
InvoiceDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Items", x => x.ItemID);
table.ForeignKey(
name: "FK_Items_Companies_CompanyId",
column: x => x.CompanyId,
principalTable: "Companies",
principalColumn: "CompanyId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Items_Departments_DepartmentId",
column: x => x.DepartmentId,
principalTable: "Departments",
principalColumn: "DepartmentId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Items_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "ProductId",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Description", "Name", "NormalizedName" },
@ -235,8 +388,8 @@ namespace PSTW_CentralSystem.Migrations
columns: new[] { "Id", "AccessFailedCount", "ConcurrencyStamp", "Email", "EmailConfirmed", "FullName", "LockoutEnabled", "LockoutEnd", "NormalizedEmail", "NormalizedUserName", "PasswordHash", "PhoneNumber", "PhoneNumberConfirmed", "SecurityStamp", "TwoFactorEnabled", "UserName", "UserStatus" },
values: new object[,]
{
{ 1, 0, "e4431078-c853-410b-8369-eba4c21937f0", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAENdEN8F2O8D9gJofhSQV6UDhcjh2+C7TvjAC+KgJMUbFJbGBNXPvOORKISb0jRhftA==", null, false, "bce6229e-4b74-4324-a89d-5f3210daccfb", false, "admin@pstw.com.my", null },
{ 2, 0, "94504423-6916-4a9e-baf2-271beb3b3f2a", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEApFYVWK3qRpzEM6jFFw5EDohJ+xHCxX2EDABsUg65pa0iA1h54wp9yf/gp2qVxvVg==", null, false, "0d07b058-1d11-40a9-875e-6631d26702cb", false, "sysadmin@pstw.com.my", null }
{ 1, 0, "dde44c98-793e-452c-8123-5252dc03d655", "admin@pstw.com.my", true, "MAAdmin", false, null, "ADMIN@PSTW.COM.MY", "ADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==", null, false, "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf", false, "admin@pstw.com.my", null },
{ 2, 0, "b529f4f9-3426-4a74-b048-d8995fe3e647", "sysadmin@pstw.com.my", true, "SysAdmin", false, null, "SYSADMIN@PSTW.COM.MY", "SYSADMIN@PSTW.COM.MY", "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==", null, false, "065ee938-093c-4816-ad28-f2e0831a7550", false, "sysadmin@pstw.com.my", null }
});
migrationBuilder.InsertData(
@ -280,6 +433,31 @@ namespace PSTW_CentralSystem.Migrations
table: "AspNetUsers",
column: "NormalizedUserName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Departments_CompanyId",
table: "Departments",
column: "CompanyId");
migrationBuilder.CreateIndex(
name: "IX_Items_CompanyId",
table: "Items",
column: "CompanyId");
migrationBuilder.CreateIndex(
name: "IX_Items_DepartmentId",
table: "Items",
column: "DepartmentId");
migrationBuilder.CreateIndex(
name: "IX_Items_ProductId",
table: "Items",
column: "ProductId");
migrationBuilder.CreateIndex(
name: "IX_Products_ManufacturerId",
table: "Products",
column: "ManufacturerId");
}
/// <inheritdoc />
@ -300,14 +478,32 @@ namespace PSTW_CentralSystem.Migrations
migrationBuilder.DropTable(
name: "AspNetUserTokens");
migrationBuilder.DropTable(
name: "Items");
migrationBuilder.DropTable(
name: "ModuleSettings");
migrationBuilder.DropTable(
name: "Suppliers");
migrationBuilder.DropTable(
name: "AspNetRoles");
migrationBuilder.DropTable(
name: "AspNetUsers");
migrationBuilder.DropTable(
name: "Departments");
migrationBuilder.DropTable(
name: "Products");
migrationBuilder.DropTable(
name: "Companies");
migrationBuilder.DropTable(
name: "Manufacturers");
}
}
}

View File

@ -253,7 +253,7 @@ namespace PSTW_CentralSystem.Migrations
b.HasKey("ManufacturerId");
b.ToTable("Manifacturers");
b.ToTable("Manufacturers");
});
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
@ -268,16 +268,12 @@ namespace PSTW_CentralSystem.Migrations
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("CompanyId")
.HasColumnType("int");
b.Property<string>("ImageProduct")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Manufacturer")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("ManufacturerId")
.HasColumnType("int");
b.Property<string>("ModelNo")
.IsRequired()
@ -292,7 +288,7 @@ namespace PSTW_CentralSystem.Migrations
b.HasKey("ProductId");
b.HasIndex("CompanyId");
b.HasIndex("ManufacturerId");
b.ToTable("Products");
});
@ -495,16 +491,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 1,
AccessFailedCount = 0,
ConcurrencyStamp = "9ea0a171-7dcc-45a5-81a7-cfcfddbfd6e0",
ConcurrencyStamp = "dde44c98-793e-452c-8123-5252dc03d655",
Email = "admin@pstw.com.my",
EmailConfirmed = true,
FullName = "MAAdmin",
LockoutEnabled = false,
NormalizedEmail = "ADMIN@PSTW.COM.MY",
NormalizedUserName = "ADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAELSRntWl5rKnYA0TnNAC7qj54A7uRTevStsdc4WkfTXLZaNG1/J55Cl6laIR9kOR2g==",
PasswordHash = "AQAAAAIAAYagAAAAEF/vIsmJIWgsCX1cyJiM/miWN66l6UKVbXIY07eBwo/kOy6xL5olLByKrgW7MdbadQ==",
PhoneNumberConfirmed = false,
SecurityStamp = "a906bafd-1a37-41ec-9e08-0e6877a05dbb",
SecurityStamp = "1e63fa4d-6a8a-4738-9036-7b51d02e1eaf",
TwoFactorEnabled = false,
UserName = "admin@pstw.com.my"
},
@ -512,16 +508,16 @@ namespace PSTW_CentralSystem.Migrations
{
Id = 2,
AccessFailedCount = 0,
ConcurrencyStamp = "daf3b4fc-8c91-4dbe-a01a-a7eb9a9200d3",
ConcurrencyStamp = "b529f4f9-3426-4a74-b048-d8995fe3e647",
Email = "sysadmin@pstw.com.my",
EmailConfirmed = true,
FullName = "SysAdmin",
LockoutEnabled = false,
NormalizedEmail = "SYSADMIN@PSTW.COM.MY",
NormalizedUserName = "SYSADMIN@PSTW.COM.MY",
PasswordHash = "AQAAAAIAAYagAAAAEGRrzPnCkIDxBFOc9gMn+h/xYIdjN6rQZFMd0eSMfLk8n4u9AX6791Zzw/Q8UR5Xww==",
PasswordHash = "AQAAAAIAAYagAAAAEIEYpwwMbS9j2l6V3fpUQONaKxCMJN3pV8rVeN3eo0iva0Bu9Jj1NIdkS4GnzvpDVw==",
PhoneNumberConfirmed = false,
SecurityStamp = "83dcb965-0f1d-4be3-ac42-e8476daca591",
SecurityStamp = "065ee938-093c-4816-ad28-f2e0831a7550",
TwoFactorEnabled = false,
UserName = "sysadmin@pstw.com.my"
});
@ -618,13 +614,13 @@ namespace PSTW_CentralSystem.Migrations
modelBuilder.Entity("PSTW_CentralSystem.Areas.Inventory.Models.ProductModel", b =>
{
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.CompanyModel", "Company")
b.HasOne("PSTW_CentralSystem.Areas.Inventory.Models.ManufacturerModel", "Manufacturer")
.WithMany()
.HasForeignKey("CompanyId")
.HasForeignKey("ManufacturerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Company");
b.Navigation("Manufacturer");
});
#pragma warning restore 612, 618
}

View File

@ -30,6 +30,7 @@
<Folder Include="Controllers\JSA\API\" />
<Folder Include="Logs\" />
<Folder Include="Migrations\" />
<Folder Include="wwwroot\Media\Inventory\Images\" />
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB