diff --git a/KfChatDotNetBot/ApplicationDbContext.cs b/KfChatDotNetBot/ApplicationDbContext.cs index 10464e5..f4f5db1 100644 --- a/KfChatDotNetBot/ApplicationDbContext.cs +++ b/KfChatDotNetBot/ApplicationDbContext.cs @@ -9,7 +9,13 @@ public class ApplicationDbContext : DbContext { builder.UseSqlite("Data Source=db.sqlite"); } - + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + } + public DbSet Users { get; set; } public DbSet Juicers { get; set; } public DbSet Settings { get; set; } diff --git a/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs b/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs index 40532d5..fdced86 100644 --- a/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs +++ b/KfChatDotNetBot/Models/DbModels/MoneyDbModels.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; +using KfChatDotNetBot.Services; namespace KfChatDotNetBot.Models.DbModels; @@ -201,6 +202,113 @@ public class GamblerPerkDbModel public decimal? Payout { get; set; } } +public class KasinoShopProfileDbModel +{ + /// + /// ID for the database row + /// + public int Id { get; set; } + /// + /// Shop profiles belong to a user, not their gambler ID + /// they persist even if the user abandons their profile + /// + public required UserDbModel User { get; set; } + public required List Assets { get; set; } + public required List Loans { get; set; } +} + +public class KasinoShopProfileLoanDbModel +{ + /// + /// ID for the database row + /// + public int Id { get; set; } + // Foreign key that the powers that be told me I need for the fancy navigation property + public int ProfileId { get; set; } + /// + /// Profile of the user who owns this loan + /// + public required KasinoShopProfileDbModel Profile { get; set; } + // Foreign key that the powers that be told me I need for the fancy navigation property + public int PayableToId { get; set; } + /// + /// Profile of the user to whom this loan is owed/payable to + /// + public required KasinoShopProfileDbModel PayableTo { get; set; } + /// + /// Amount loaned + /// + public required decimal Amount { get; set; } + /// + /// Amount to be paid out to the loaner + /// + public required decimal PayoutAmount { get; set; } + /// + /// Date and time loan entry was created + /// + public required DateTimeOffset Created { get; set; } +} + +public class KasinoShopProfileAssetDbModel +{ + /// + /// ID for the database row + /// + public int Id { get; set; } + /// + /// Profile of the user who owns this asset + /// + public required KasinoShopProfileDbModel Profile { get; set; } + /// + /// Value of the item at the time of acquisition in Krypto + /// + public required decimal OriginalValue { get; set; } + /// + /// Asset name + /// + public required string Name { get; set; } + /// + /// Asset type + /// + public required AssetType AssetType { get; set; } + /// + /// Date and time the asset was acquired + /// + public required DateTimeOffset Acquired { get; set; } + /// + /// History of value changes (e.g. interest events) + /// + public required List ValueChangeReports { get; set; } + /// + /// Serialized JSON for extra information useful for certain assets (e.g. car model) + /// + public string? Extra { get; set; } = null; +} + +public class KasinoShopProfileAssetValueChangeDbModel +{ + /// + /// ID for the database row + /// + public int Id { get; set; } + /// + /// Related asset + /// + public required KasinoShopProfileAssetDbModel Asset { get; set; } + /// + /// Effect of the change + /// + public required decimal ValueChangeEffect { get; set; } + /// + /// Change percent as a decimal fraction? + /// + public required decimal ValueChangePercent { get; set; } + /// + /// Descriptive text for the value change (like the source of it) + /// + public required string Description { get; set; } +} + public enum GamblerPerkType { /// @@ -338,4 +446,4 @@ public enum GamblerState /// was erased by this event /// EndOfYear2025Liquidated -} +} \ No newline at end of file diff --git a/KfChatDotNetBot/Services/BotServices.cs b/KfChatDotNetBot/Services/BotServices.cs index f9b7dab..87af245 100644 --- a/KfChatDotNetBot/Services/BotServices.cs +++ b/KfChatDotNetBot/Services/BotServices.cs @@ -121,7 +121,8 @@ public class BotServices private async Task BuildKasinoShop() { _logger.Debug("Building the kasino shop"); - KasinoShop = new KasinoShop(_chatBot); + //KasinoShop = new KasinoShop(_chatBot); + KasinoShop = null; } private async Task BuildShuffle()