diff --git a/maERP.Server/Migrations/20230725194616_initDatabase.Designer.cs b/maERP.Server/Migrations/20230725194616_initDatabase.Designer.cs
new file mode 100644
index 00000000..4c92249f
--- /dev/null
+++ b/maERP.Server/Migrations/20230725194616_initDatabase.Designer.cs
@@ -0,0 +1,1013 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using maERP.Server.Models;
+
+#nullable disable
+
+namespace maERP.Server.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ [Migration("20230725194616_initDatabase")]
+ partial class initDatabase
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("NormalizedName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedName")
+ .IsUnique()
+ .HasDatabaseName("RoleNameIndex");
+
+ b.ToTable("AspNetRoles", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = "02174cf0–9412–4cfe-afbf-59f706d72cf6",
+ Name = "Admin",
+ NormalizedName = "ADMIN"
+ },
+ new
+ {
+ Id = "341743f0-asd2–42de-afbf-59kmkkmk21ab1",
+ Name = "User",
+ NormalizedName = "USER"
+ });
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("RoleId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("ProviderKey")
+ .HasColumnType("text");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("text");
+
+ b.Property("RoleId")
+ .HasColumnType("text");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+
+ b.HasData(
+ new
+ {
+ UserId = "05474ea3–7543-8aef-bcae-33e812c35fc3",
+ RoleId = "02174cf0–9412–4cfe-afbf-59f706d72cf6"
+ });
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("text");
+
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("Value")
+ .HasColumnType("text");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ApplicationUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("integer");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("text");
+
+ b.Property("Email")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("boolean");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("boolean");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("PasswordHash")
+ .HasColumnType("text");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("text");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("boolean");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("text");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("boolean");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+
+ b.HasData(
+ new
+ {
+ Id = "05474ea3–7543-8aef-bcae-33e812c35fc3",
+ AccessFailedCount = 0,
+ ConcurrencyStamp = "d04102f6-ba0d-45f3-acc5-a50a25709e4a",
+ Email = "admin@localhost.com",
+ EmailConfirmed = false,
+ FirstName = "Admin",
+ LastName = "Admin",
+ LockoutEnabled = false,
+ NormalizedEmail = "ADMIN@LOCALHOST.COM",
+ NormalizedUserName = "ADMIN@LOCALHOST.COM",
+ PasswordHash = "AQAAAAIAAYagAAAAEO+hprJZuHzYVc2E/tGhDzQhzrGD4fS7i2htPWsCGyWMNu/I6YOd02aO1WAtEwRIQA==",
+ PhoneNumberConfirmed = false,
+ SecurityStamp = "bbd2a186-408f-42a2-b6bd-6d427ee83176",
+ TwoFactorEnabled = false,
+ UserName = "admin@localhost.com"
+ });
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Country", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CountryCode")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Country");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ CountryCode = "de",
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(10),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(10),
+ Name = "Deutschland"
+ },
+ new
+ {
+ Id = 2,
+ CountryCode = "at",
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(10),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(10),
+ Name = "Österreich"
+ },
+ new
+ {
+ Id = 3,
+ CountryCode = "ch",
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(10),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(10),
+ Name = "Schweiz"
+ });
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Customer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CustomerStatus")
+ .HasColumnType("integer");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Customer");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.CustomerAddress", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("City")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CountryId")
+ .HasColumnType("integer");
+
+ b.Property("CustomerId")
+ .HasColumnType("integer");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("HouseNr")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Street")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Zip")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CountryId");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("CustomerAddress");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CustomerId")
+ .HasColumnType("integer");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CustomerId");
+
+ b.ToTable("Order");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Product", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Asin")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Ean")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Msrp")
+ .HasColumnType("numeric");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Price")
+ .HasColumnType("numeric");
+
+ b.Property("Sku")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("TaxClassId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Sku")
+ .IsUnique();
+
+ b.HasIndex("TaxClassId");
+
+ b.ToTable("Product");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ProductSalesChannel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Price")
+ .HasColumnType("numeric");
+
+ b.Property("ProductId")
+ .HasColumnType("integer");
+
+ b.Property("RemoteProductId")
+ .HasColumnType("integer");
+
+ b.Property("SalesChannelId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProductId");
+
+ b.HasIndex("SalesChannelId");
+
+ b.ToTable("ProductSalesChannel");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ProductStock", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ProductId")
+ .HasColumnType("integer");
+
+ b.Property("Quantity")
+ .HasColumnType("integer");
+
+ b.Property("WarehouseId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProductId");
+
+ b.HasIndex("WarehouseId");
+
+ b.ToTable("ProductStock");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.SalesChannel", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ExportCustomers")
+ .HasColumnType("boolean");
+
+ b.Property("ExportOrders")
+ .HasColumnType("boolean");
+
+ b.Property("ExportProducts")
+ .HasColumnType("boolean");
+
+ b.Property("ImportCustomers")
+ .HasColumnType("boolean");
+
+ b.Property("ImportOrders")
+ .HasColumnType("boolean");
+
+ b.Property("ImportProducts")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.Property("URL")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("WarehouseId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("WarehouseId");
+
+ b.ToTable("SalesChannel");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Setting", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Section")
+ .HasColumnType("integer");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Setting");
+
+ b.HasData(
+ new
+ {
+ Id = 1,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "JwtSettings:Key",
+ Section = 0,
+ Value = "CHANGE_TO_YOUR_VERY_SECRET_JWT_SIGNING_KEY"
+ },
+ new
+ {
+ Id = 2,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "JwtSettings:Issuer",
+ Section = 0,
+ Value = "maERP.Server"
+ },
+ new
+ {
+ Id = 3,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "JwtSettings:Audience",
+ Section = 0,
+ Value = "maERP.Client"
+ },
+ new
+ {
+ Id = 4,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "JwtSettings:DurationInMinutes",
+ Section = 0,
+ Value = "60"
+ },
+ new
+ {
+ Id = 5,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "RemoteLog:Enabled",
+ Section = 0,
+ Value = "false"
+ },
+ new
+ {
+ Id = 6,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "RemoteLog:Host",
+ Section = 0,
+ Value = "graylog.martin-andrich.de"
+ },
+ new
+ {
+ Id = 7,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "RemoteLog:Port",
+ Section = 0,
+ Value = "12301"
+ },
+ new
+ {
+ Id = 8,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "RemoteLog:TransportType",
+ Section = 0,
+ Value = "Tcp"
+ },
+ new
+ {
+ Id = 9,
+ DateCreated = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ DateModified = new DateTime(2023, 7, 25, 19, 46, 16, 323, DateTimeKind.Utc).AddTicks(2930),
+ Key = "RemoteLog:Facility",
+ Section = 0,
+ Value = "maERP.Server"
+ });
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ShippingProvider", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("ShippingProvider");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ShippingProviderRate", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("MaxHeight")
+ .HasColumnType("numeric");
+
+ b.Property("MaxLength")
+ .HasColumnType("numeric");
+
+ b.Property("MaxWeight")
+ .HasColumnType("numeric");
+
+ b.Property("MaxWidth")
+ .HasColumnType("numeric");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ShippingProviderId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ShippingProviderId");
+
+ b.ToTable("ShippingProviderRate");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.TaxClass", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("TaxRate")
+ .HasColumnType("double precision");
+
+ b.HasKey("Id");
+
+ b.ToTable("TaxClass");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Warehouse", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("DateCreated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DateModified")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Warehouse");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.HasOne("maERP.Server.Models.ApplicationUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.HasOne("maERP.Server.Models.ApplicationUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
+ .WithMany()
+ .HasForeignKey("RoleId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("maERP.Server.Models.ApplicationUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.HasOne("maERP.Server.Models.ApplicationUser", null)
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.CustomerAddress", b =>
+ {
+ b.HasOne("maERP.Server.Models.Country", "Country")
+ .WithMany()
+ .HasForeignKey("CountryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("maERP.Server.Models.Customer", "Customer")
+ .WithMany("CustomerAddresses")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Country");
+
+ b.Navigation("Customer");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Order", b =>
+ {
+ b.HasOne("maERP.Server.Models.Customer", null)
+ .WithMany("Orders")
+ .HasForeignKey("CustomerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Product", b =>
+ {
+ b.HasOne("maERP.Server.Models.TaxClass", "TaxClass")
+ .WithMany("Products")
+ .HasForeignKey("TaxClassId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("TaxClass");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ProductSalesChannel", b =>
+ {
+ b.HasOne("maERP.Server.Models.Product", "Product")
+ .WithMany("ProductSalesChannel")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("maERP.Server.Models.SalesChannel", "SalesChannel")
+ .WithMany()
+ .HasForeignKey("SalesChannelId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Product");
+
+ b.Navigation("SalesChannel");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ProductStock", b =>
+ {
+ b.HasOne("maERP.Server.Models.Product", "Product")
+ .WithMany("ProductStock")
+ .HasForeignKey("ProductId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("maERP.Server.Models.Warehouse", "Warehouse")
+ .WithMany()
+ .HasForeignKey("WarehouseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Product");
+
+ b.Navigation("Warehouse");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.SalesChannel", b =>
+ {
+ b.HasOne("maERP.Server.Models.Warehouse", "Warehouse")
+ .WithMany("SalesChannels")
+ .HasForeignKey("WarehouseId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Warehouse");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ShippingProviderRate", b =>
+ {
+ b.HasOne("maERP.Server.Models.ShippingProvider", null)
+ .WithMany("ShippingRates")
+ .HasForeignKey("ShippingProviderId");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Customer", b =>
+ {
+ b.Navigation("CustomerAddresses");
+
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Product", b =>
+ {
+ b.Navigation("ProductSalesChannel");
+
+ b.Navigation("ProductStock");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.ShippingProvider", b =>
+ {
+ b.Navigation("ShippingRates");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.TaxClass", b =>
+ {
+ b.Navigation("Products");
+ });
+
+ modelBuilder.Entity("maERP.Server.Models.Warehouse", b =>
+ {
+ b.Navigation("SalesChannels");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/maERP.Server/Migrations/20230725194616_initDatabase.cs b/maERP.Server/Migrations/20230725194616_initDatabase.cs
new file mode 100644
index 00000000..3c6d4c9f
--- /dev/null
+++ b/maERP.Server/Migrations/20230725194616_initDatabase.cs
@@ -0,0 +1,661 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
+
+namespace maERP.Server.Migrations
+{
+ ///
+ public partial class initDatabase : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "AspNetRoles",
+ columns: table => new
+ {
+ Id = table.Column(type: "text", nullable: false),
+ Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
+ NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
+ ConcurrencyStamp = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoles", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUsers",
+ columns: table => new
+ {
+ Id = table.Column(type: "text", nullable: false),
+ FirstName = table.Column(type: "text", nullable: false),
+ LastName = table.Column(type: "text", nullable: false),
+ UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
+ NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
+ Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
+ NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true),
+ EmailConfirmed = table.Column(type: "boolean", nullable: false),
+ PasswordHash = table.Column(type: "text", nullable: true),
+ SecurityStamp = table.Column(type: "text", nullable: true),
+ ConcurrencyStamp = table.Column(type: "text", nullable: true),
+ PhoneNumber = table.Column(type: "text", nullable: true),
+ PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false),
+ TwoFactorEnabled = table.Column(type: "boolean", nullable: false),
+ LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true),
+ LockoutEnabled = table.Column(type: "boolean", nullable: false),
+ AccessFailedCount = table.Column(type: "integer", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUsers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Country",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ CountryCode = table.Column(type: "text", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Country", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Customer",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ FirstName = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
+ LastName = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
+ Email = table.Column(type: "text", nullable: false),
+ CustomerStatus = table.Column(type: "integer", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Customer", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Setting",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Section = table.Column(type: "integer", nullable: false),
+ Key = table.Column(type: "text", nullable: false),
+ Value = table.Column(type: "text", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Setting", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ShippingProvider",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ShippingProvider", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "TaxClass",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ TaxRate = table.Column(type: "double precision", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_TaxClass", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Warehouse",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Warehouse", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetRoleClaims",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ RoleId = table.Column(type: "text", nullable: false),
+ ClaimType = table.Column(type: "text", nullable: true),
+ ClaimValue = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserClaims",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ UserId = table.Column(type: "text", nullable: false),
+ ClaimType = table.Column(type: "text", nullable: true),
+ ClaimValue = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
+ table.ForeignKey(
+ name: "FK_AspNetUserClaims_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserLogins",
+ columns: table => new
+ {
+ LoginProvider = table.Column(type: "text", nullable: false),
+ ProviderKey = table.Column(type: "text", nullable: false),
+ ProviderDisplayName = table.Column(type: "text", nullable: true),
+ UserId = table.Column(type: "text", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
+ table.ForeignKey(
+ name: "FK_AspNetUserLogins_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserRoles",
+ columns: table => new
+ {
+ UserId = table.Column(type: "text", nullable: false),
+ RoleId = table.Column(type: "text", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
+ column: x => x.RoleId,
+ principalTable: "AspNetRoles",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_AspNetUserRoles_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "AspNetUserTokens",
+ columns: table => new
+ {
+ UserId = table.Column(type: "text", nullable: false),
+ LoginProvider = table.Column(type: "text", nullable: false),
+ Name = table.Column(type: "text", nullable: false),
+ Value = table.Column(type: "text", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
+ table.ForeignKey(
+ name: "FK_AspNetUserTokens_AspNetUsers_UserId",
+ column: x => x.UserId,
+ principalTable: "AspNetUsers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "CustomerAddress",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Street = table.Column(type: "text", nullable: false),
+ HouseNr = table.Column(type: "text", nullable: false),
+ Zip = table.Column(type: "text", nullable: false),
+ City = table.Column(type: "text", nullable: false),
+ CountryId = table.Column(type: "integer", nullable: false),
+ CustomerId = table.Column(type: "integer", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_CustomerAddress", x => x.Id);
+ table.ForeignKey(
+ name: "FK_CustomerAddress_Country_CountryId",
+ column: x => x.CountryId,
+ principalTable: "Country",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_CustomerAddress_Customer_CustomerId",
+ column: x => x.CustomerId,
+ principalTable: "Customer",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Order",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ CustomerId = table.Column(type: "integer", nullable: false),
+ Status = table.Column(type: "integer", nullable: false),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Order", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Order_Customer_CustomerId",
+ column: x => x.CustomerId,
+ principalTable: "Customer",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ShippingProviderRate",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Name = table.Column(type: "text", nullable: false),
+ MaxLength = table.Column(type: "numeric", nullable: false),
+ MaxWidth = table.Column(type: "numeric", nullable: false),
+ MaxHeight = table.Column(type: "numeric", nullable: false),
+ MaxWeight = table.Column(type: "numeric", nullable: false),
+ ShippingProviderId = table.Column(type: "integer", nullable: true),
+ DateCreated = table.Column(type: "timestamp with time zone", nullable: false),
+ DateModified = table.Column(type: "timestamp with time zone", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ShippingProviderRate", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ShippingProviderRate_ShippingProvider_ShippingProviderId",
+ column: x => x.ShippingProviderId,
+ principalTable: "ShippingProvider",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Product",
+ columns: table => new
+ {
+ Id = table.Column(type: "integer", nullable: false)
+ .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
+ Sku = table.Column(type: "text", nullable: false),
+ Name = table.Column(type: "text", nullable: false),
+ Ean = table.Column(type: "text", nullable: false),
+ Asin = table.Column(type: "text", nullable: false),
+ Description = table.Column(type: "text", nullable: false),
+ Price = table.Column