Add project files.

This commit is contained in:
2022-05-26 15:19:31 +02:00
parent 44afa68e45
commit a57dcfe03b
57 changed files with 1907 additions and 0 deletions

View File

@ -0,0 +1,155 @@
// <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 OemanTrader.EntityFramework;
#nullable disable
namespace OemanTrader.EntityFramework.Migrations
{
[DbContext(typeof(OemanTraderDbContext))]
[Migration("20220508202548_initial")]
partial class initial
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("AccountHolderId")
.HasColumnType("int");
b.Property<double>("Balance")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("AccountHolderId");
b.ToTable("Accounts");
});
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("AccountId")
.HasColumnType("int");
b.Property<DateTime>("DateProcessed")
.HasColumnType("datetime2");
b.Property<bool>("IsPurchase")
.HasColumnType("bit");
b.Property<int>("ShareAmount")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AccountId");
b.ToTable("AssetTransactions");
});
modelBuilder.Entity("OemanTrader.Domain.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<DateTime>("DateJoined")
.HasColumnType("datetime2");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.HasOne("OemanTrader.Domain.Models.User", "AccountHolder")
.WithMany()
.HasForeignKey("AccountHolderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AccountHolder");
});
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
{
b.HasOne("OemanTrader.Domain.Models.Account", "Account")
.WithMany("AssetTransactions")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OemanTrader.Domain.Models.Stock", "Stock", b1 =>
{
b1.Property<int>("AssetTransactionId")
.HasColumnType("int");
b1.Property<double>("PricePerShare")
.HasColumnType("float");
b1.Property<string>("Symbol")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.HasKey("AssetTransactionId");
b1.ToTable("AssetTransactions");
b1.WithOwner()
.HasForeignKey("AssetTransactionId");
});
b.Navigation("Account");
b.Navigation("Stock")
.IsRequired();
});
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.Navigation("AssetTransactions");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,95 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OemanTrader.EntityFramework.Migrations
{
public partial class initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
UserName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
DateJoined = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Accounts",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AccountHolderId = table.Column<int>(type: "int", nullable: false),
Balance = table.Column<double>(type: "float", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Accounts", x => x.Id);
table.ForeignKey(
name: "FK_Accounts_Users_AccountHolderId",
column: x => x.AccountHolderId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AssetTransactions",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AccountId = table.Column<int>(type: "int", nullable: false),
IsPurchase = table.Column<bool>(type: "bit", nullable: false),
Stock_Symbol = table.Column<string>(type: "nvarchar(max)", nullable: false),
Stock_PricePerShare = table.Column<double>(type: "float", nullable: false),
ShareAmount = table.Column<int>(type: "int", nullable: false),
DateProcessed = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AssetTransactions", x => x.Id);
table.ForeignKey(
name: "FK_AssetTransactions_Accounts_AccountId",
column: x => x.AccountId,
principalTable: "Accounts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Accounts_AccountHolderId",
table: "Accounts",
column: "AccountHolderId");
migrationBuilder.CreateIndex(
name: "IX_AssetTransactions_AccountId",
table: "AssetTransactions",
column: "AccountId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AssetTransactions");
migrationBuilder.DropTable(
name: "Accounts");
migrationBuilder.DropTable(
name: "Users");
}
}
}

View File

@ -0,0 +1,155 @@
// <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 OemanTrader.EntityFramework;
#nullable disable
namespace OemanTrader.EntityFramework.Migrations
{
[DbContext(typeof(OemanTraderDbContext))]
[Migration("20220519211347_stock-to-asset")]
partial class stocktoasset
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("AccountHolderId")
.HasColumnType("int");
b.Property<double>("Balance")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("AccountHolderId");
b.ToTable("Accounts");
});
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("AccountId")
.HasColumnType("int");
b.Property<DateTime>("DateProcessed")
.HasColumnType("datetime2");
b.Property<bool>("IsPurchase")
.HasColumnType("bit");
b.Property<int>("ShareAmount")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AccountId");
b.ToTable("AssetTransactions");
});
modelBuilder.Entity("OemanTrader.Domain.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<DateTime>("DateJoined")
.HasColumnType("datetime2");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.HasOne("OemanTrader.Domain.Models.User", "AccountHolder")
.WithMany()
.HasForeignKey("AccountHolderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AccountHolder");
});
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
{
b.HasOne("OemanTrader.Domain.Models.Account", "Account")
.WithMany("AssetTransactions")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OemanTrader.Domain.Models.Asset", "Asset", b1 =>
{
b1.Property<int>("AssetTransactionId")
.HasColumnType("int");
b1.Property<double>("PricePerShare")
.HasColumnType("float");
b1.Property<string>("Symbol")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.HasKey("AssetTransactionId");
b1.ToTable("AssetTransactions");
b1.WithOwner()
.HasForeignKey("AssetTransactionId");
});
b.Navigation("Account");
b.Navigation("Asset")
.IsRequired();
});
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.Navigation("AssetTransactions");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace OemanTrader.EntityFramework.Migrations
{
public partial class stocktoasset : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Stock_Symbol",
table: "AssetTransactions",
newName: "Asset_Symbol");
migrationBuilder.RenameColumn(
name: "Stock_PricePerShare",
table: "AssetTransactions",
newName: "Asset_PricePerShare");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Asset_Symbol",
table: "AssetTransactions",
newName: "Stock_Symbol");
migrationBuilder.RenameColumn(
name: "Asset_PricePerShare",
table: "AssetTransactions",
newName: "Stock_PricePerShare");
}
}
}

View File

@ -0,0 +1,153 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using OemanTrader.EntityFramework;
#nullable disable
namespace OemanTrader.EntityFramework.Migrations
{
[DbContext(typeof(OemanTraderDbContext))]
partial class OemanTraderDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("AccountHolderId")
.HasColumnType("int");
b.Property<double>("Balance")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("AccountHolderId");
b.ToTable("Accounts");
});
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<int>("AccountId")
.HasColumnType("int");
b.Property<DateTime>("DateProcessed")
.HasColumnType("datetime2");
b.Property<bool>("IsPurchase")
.HasColumnType("bit");
b.Property<int>("ShareAmount")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AccountId");
b.ToTable("AssetTransactions");
});
modelBuilder.Entity("OemanTrader.Domain.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<DateTime>("DateJoined")
.HasColumnType("datetime2");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.HasOne("OemanTrader.Domain.Models.User", "AccountHolder")
.WithMany()
.HasForeignKey("AccountHolderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AccountHolder");
});
modelBuilder.Entity("OemanTrader.Domain.Models.AssetTransaction", b =>
{
b.HasOne("OemanTrader.Domain.Models.Account", "Account")
.WithMany("AssetTransactions")
.HasForeignKey("AccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.OwnsOne("OemanTrader.Domain.Models.Asset", "Asset", b1 =>
{
b1.Property<int>("AssetTransactionId")
.HasColumnType("int");
b1.Property<double>("PricePerShare")
.HasColumnType("float");
b1.Property<string>("Symbol")
.IsRequired()
.HasColumnType("nvarchar(max)");
b1.HasKey("AssetTransactionId");
b1.ToTable("AssetTransactions");
b1.WithOwner()
.HasForeignKey("AssetTransactionId");
});
b.Navigation("Account");
b.Navigation("Asset")
.IsRequired();
});
modelBuilder.Entity("OemanTrader.Domain.Models.Account", b =>
{
b.Navigation("AssetTransactions");
});
#pragma warning restore 612, 618
}
}
}