backdoor
haus-konto geld abheben (30% steuern) alten hausmanager entfernt interiormanager in core verschoben
This commit is contained in:
@@ -6,7 +6,7 @@ using ReallifeGamemode.Server.Core.API;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class House
|
||||
public partial class House : BankAccountHolder<HouseBankAccount>
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -34,5 +34,7 @@ namespace ReallifeGamemode.Database.Entities
|
||||
public User Owner { get; set; }
|
||||
|
||||
public ICollection<HouseRental> Rentals { get; set; }
|
||||
|
||||
public override string BankAccountName => "Haus-Konto";
|
||||
}
|
||||
}
|
||||
|
||||
17
ReallifeGamemode.Database/Entities/HouseBankAccount.cs
Normal file
17
ReallifeGamemode.Database/Entities/HouseBankAccount.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public class HouseBankAccount : IBankAccount
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Balance { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,16 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using GTANetworkAPI;
|
||||
using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Server.Core.API;
|
||||
|
||||
namespace ReallifeGamemode.Database.Entities
|
||||
{
|
||||
public partial class Interior
|
||||
{
|
||||
[NotMapped]
|
||||
private Vector3 _enterPosition;
|
||||
private Position _enterPosition;
|
||||
[NotMapped]
|
||||
private Vector3 _exitPosition;
|
||||
private Position _exitPosition;
|
||||
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -26,7 +27,7 @@ namespace ReallifeGamemode.Database.Entities
|
||||
}
|
||||
set
|
||||
{
|
||||
this._enterPosition = JsonConvert.DeserializeObject<Vector3>(value);
|
||||
this._enterPosition = JsonConvert.DeserializeObject<Position>(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,12 +40,12 @@ namespace ReallifeGamemode.Database.Entities
|
||||
}
|
||||
set
|
||||
{
|
||||
this._exitPosition = JsonConvert.DeserializeObject<Vector3>(value);
|
||||
this._exitPosition = JsonConvert.DeserializeObject<Position>(value);
|
||||
}
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public Vector3 EnterPosition
|
||||
public Position EnterPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -57,7 +58,7 @@ namespace ReallifeGamemode.Database.Entities
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public Vector3 ExitPosition
|
||||
public Position ExitPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
1439
ReallifeGamemode.Database/Migrations/20200330201122_HouseBankAccounts.Designer.cs
generated
Normal file
1439
ReallifeGamemode.Database/Migrations/20200330201122_HouseBankAccounts.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,60 @@
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace ReallifeGamemode.Database.Migrations
|
||||
{
|
||||
public partial class HouseBankAccounts : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BankAccountId",
|
||||
table: "Houses",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HouseBankAccounts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
Balance = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HouseBankAccounts", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Houses_BankAccountId",
|
||||
table: "Houses",
|
||||
column: "BankAccountId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Houses_HouseBankAccounts_BankAccountId",
|
||||
table: "Houses",
|
||||
column: "BankAccountId",
|
||||
principalTable: "HouseBankAccounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Houses_HouseBankAccounts_BankAccountId",
|
||||
table: "Houses");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HouseBankAccounts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Houses_BankAccountId",
|
||||
table: "Houses");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BankAccountId",
|
||||
table: "Houses");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,6 +481,8 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int?>("BankAccountId");
|
||||
|
||||
b.Property<bool>("CanRentIn");
|
||||
|
||||
b.Property<DateTime>("LastRentSetTime");
|
||||
@@ -501,11 +503,25 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BankAccountId");
|
||||
|
||||
b.HasIndex("OwnerId");
|
||||
|
||||
b.ToTable("Houses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseBankAccount", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd();
|
||||
|
||||
b.Property<int>("Balance");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("HouseBankAccounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseRental", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -1307,6 +1323,10 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.House", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.HouseBankAccount", "BankAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("BankAccountId");
|
||||
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "Owner")
|
||||
.WithMany()
|
||||
.HasForeignKey("OwnerId");
|
||||
@@ -1315,7 +1335,7 @@ namespace ReallifeGamemode.Database.Migrations
|
||||
modelBuilder.Entity("ReallifeGamemode.Database.Entities.HouseRental", b =>
|
||||
{
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.House", "House")
|
||||
.WithMany()
|
||||
.WithMany("Rentals")
|
||||
.HasForeignKey("HouseId");
|
||||
|
||||
b.HasOne("ReallifeGamemode.Database.Entities.User", "User")
|
||||
|
||||
@@ -51,25 +51,6 @@ namespace ReallifeGamemode.Database.Models
|
||||
|
||||
modelBuilder.Entity<Entities.VehicleMod>()
|
||||
.HasIndex(vM => new { vM.ServerVehicleId, vM.Slot }).IsUnique();
|
||||
|
||||
modelBuilder.Entity<Entities.HouseRental>()
|
||||
.HasIndex(hR => new
|
||||
{
|
||||
hR.HouseId,
|
||||
hR.UserId
|
||||
}).IsUnique();
|
||||
|
||||
modelBuilder.Entity<Entities.House>()
|
||||
.HasMany(h => h.Rentals)
|
||||
.WithOne(hR => hR.House);
|
||||
|
||||
modelBuilder.Entity<Entities.User>()
|
||||
.HasOne(u => u.House)
|
||||
.WithOne(h => h.Owner);
|
||||
|
||||
modelBuilder.Entity<Entities.House>()
|
||||
.HasOne(h => h.Owner)
|
||||
.WithOne(u => u.House);
|
||||
}
|
||||
|
||||
//User
|
||||
@@ -146,6 +127,7 @@ namespace ReallifeGamemode.Database.Models
|
||||
// Houses
|
||||
public DbSet<Entities.House> Houses { get; set; }
|
||||
public DbSet<Entities.HouseRental> HouseRentals { get; set; }
|
||||
public DbSet<Entities.HouseBankAccount> HouseBankAccounts { get; set; }
|
||||
|
||||
// Bus Routes
|
||||
public DbSet<Entities.BusRoute> BusRoutes { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user