inventory working :D

This commit is contained in:
2025-02-05 19:38:25 -03:00
parent 7a2c3d2f67
commit 5289910270
15 changed files with 174 additions and 468 deletions

View File

@@ -11,7 +11,7 @@ using PetCompanion.Data;
namespace PetCompanion.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250202234056_InitialCreate")]
[Migration("20250204213845_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@@ -88,34 +88,13 @@ namespace PetCompanion.Migrations
b.Property<int>("Capacity")
.HasColumnType("INTEGER");
b.HasKey("PetId");
b.ToTable("Inventories");
});
modelBuilder.Entity("PetCompanion.Models.InventoryItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("GameItemId")
.HasColumnType("INTEGER");
b.Property<string>("InventoryId")
b.PrimitiveCollection<string>("Items")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Quantity")
.HasColumnType("INTEGER");
b.HasKey("PetId");
b.HasKey("Id");
b.HasIndex("GameItemId");
b.HasIndex("InventoryId");
b.ToTable("InventoryItems");
b.ToTable("Inventories");
});
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
@@ -579,23 +558,6 @@ namespace PetCompanion.Migrations
b.Navigation("Pet");
});
modelBuilder.Entity("PetCompanion.Models.InventoryItem", b =>
{
b.HasOne("PetCompanion.Models.GameItem", "GameItem")
.WithMany()
.HasForeignKey("GameItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PetCompanion.Models.Inventory", null)
.WithMany("Items")
.HasForeignKey("InventoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GameItem");
});
modelBuilder.Entity("PetCompanion.Models.PetSkill", b =>
{
b.HasOne("PetCompanion.Models.Pet", "Pet")
@@ -644,11 +606,6 @@ namespace PetCompanion.Migrations
b.Navigation("Skill");
});
modelBuilder.Entity("PetCompanion.Models.Inventory", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
{
b.Navigation("EquippedItemsList");

View File

@@ -106,6 +106,7 @@ namespace PetCompanion.Migrations
columns: table => new
{
PetId = table.Column<string>(type: "TEXT", nullable: false),
Items = table.Column<string>(type: "TEXT", nullable: false),
Capacity = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
@@ -215,33 +216,6 @@ namespace PetCompanion.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InventoryItems",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
InventoryId = table.Column<string>(type: "TEXT", nullable: false),
GameItemId = table.Column<int>(type: "INTEGER", nullable: false),
Quantity = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InventoryItems", x => x.Id);
table.ForeignKey(
name: "FK_InventoryItems_GameItems_GameItemId",
column: x => x.GameItemId,
principalTable: "GameItems",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_InventoryItems_Inventories_InventoryId",
column: x => x.InventoryId,
principalTable: "Inventories",
principalColumn: "PetId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Skills",
columns: new[] { "Id", "Description", "Icon", "Name", "PointsCost", "SkillsIdRequired", "Type" },
@@ -294,16 +268,6 @@ namespace PetCompanion.Migrations
table: "EquippedItems",
column: "PetId");
migrationBuilder.CreateIndex(
name: "IX_InventoryItems_GameItemId",
table: "InventoryItems",
column: "GameItemId");
migrationBuilder.CreateIndex(
name: "IX_InventoryItems_InventoryId",
table: "InventoryItems",
column: "InventoryId");
migrationBuilder.CreateIndex(
name: "IX_PetSkills_PetId",
table: "PetSkills",
@@ -327,7 +291,7 @@ namespace PetCompanion.Migrations
name: "EquippedItems");
migrationBuilder.DropTable(
name: "InventoryItems");
name: "Inventories");
migrationBuilder.DropTable(
name: "PetSkills");
@@ -345,13 +309,10 @@ namespace PetCompanion.Migrations
name: "GameItems");
migrationBuilder.DropTable(
name: "Inventories");
name: "Pets");
migrationBuilder.DropTable(
name: "Skills");
migrationBuilder.DropTable(
name: "Pets");
}
}
}

View File

@@ -85,34 +85,13 @@ namespace PetCompanion.Migrations
b.Property<int>("Capacity")
.HasColumnType("INTEGER");
b.HasKey("PetId");
b.ToTable("Inventories");
});
modelBuilder.Entity("PetCompanion.Models.InventoryItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("GameItemId")
.HasColumnType("INTEGER");
b.Property<string>("InventoryId")
b.PrimitiveCollection<string>("Items")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("Quantity")
.HasColumnType("INTEGER");
b.HasKey("PetId");
b.HasKey("Id");
b.HasIndex("GameItemId");
b.HasIndex("InventoryId");
b.ToTable("InventoryItems");
b.ToTable("Inventories");
});
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
@@ -576,23 +555,6 @@ namespace PetCompanion.Migrations
b.Navigation("Pet");
});
modelBuilder.Entity("PetCompanion.Models.InventoryItem", b =>
{
b.HasOne("PetCompanion.Models.GameItem", "GameItem")
.WithMany()
.HasForeignKey("GameItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PetCompanion.Models.Inventory", null)
.WithMany("Items")
.HasForeignKey("InventoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("GameItem");
});
modelBuilder.Entity("PetCompanion.Models.PetSkill", b =>
{
b.HasOne("PetCompanion.Models.Pet", "Pet")
@@ -641,11 +603,6 @@ namespace PetCompanion.Migrations
b.Navigation("Skill");
});
modelBuilder.Entity("PetCompanion.Models.Inventory", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
{
b.Navigation("EquippedItemsList");