Add action gathering functionality: implement ActionGathered model and repository, update Pet model and services, and enhance GameItemsRepository with item retrieval methods.
This commit is contained in:
@@ -11,7 +11,7 @@ using PetCompanion.Data;
|
||||
namespace PetCompanion.Migrations
|
||||
{
|
||||
[DbContext(typeof(ApplicationDbContext))]
|
||||
[Migration("20250209011029_InitialCreate")]
|
||||
[Migration("20250209234852_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -20,6 +20,34 @@ namespace PetCompanion.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.ActionGathered", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Amount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ItemId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("PetId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Resource")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ItemId");
|
||||
|
||||
b.HasIndex("PetId");
|
||||
|
||||
b.ToTable("ActionGathered");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.EquippedItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -668,6 +696,23 @@ namespace PetCompanion.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.ActionGathered", b =>
|
||||
{
|
||||
b.HasOne("PetCompanion.Models.GameItem", "GameItem")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemId");
|
||||
|
||||
b.HasOne("PetCompanion.Models.Pet", "Pet")
|
||||
.WithMany("ActionGathered")
|
||||
.HasForeignKey("PetId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("GameItem");
|
||||
|
||||
b.Navigation("Pet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.EquippedItem", b =>
|
||||
{
|
||||
b.HasOne("PetCompanion.Models.GameItem", "GameItem")
|
||||
@@ -759,6 +804,8 @@ namespace PetCompanion.Migrations
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
|
||||
{
|
||||
b.Navigation("ActionGathered");
|
||||
|
||||
b.Navigation("EquippedItemsList");
|
||||
|
||||
b.Navigation("Inventory")
|
@@ -71,6 +71,33 @@ namespace PetCompanion.Migrations
|
||||
table.PrimaryKey("PK_Skills", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ActionGathered",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
PetId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Resource = table.Column<string>(type: "TEXT", nullable: true),
|
||||
ItemId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Amount = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ActionGathered", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ActionGathered_GameItems_ItemId",
|
||||
column: x => x.ItemId,
|
||||
principalTable: "GameItems",
|
||||
principalColumn: "Id");
|
||||
table.ForeignKey(
|
||||
name: "FK_ActionGathered_Pets_PetId",
|
||||
column: x => x.PetId,
|
||||
principalTable: "Pets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EquippedItems",
|
||||
columns: table => new
|
||||
@@ -301,6 +328,16 @@ namespace PetCompanion.Migrations
|
||||
{ 14, 300, "Food", 8 }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ActionGathered_ItemId",
|
||||
table: "ActionGathered",
|
||||
column: "ItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ActionGathered_PetId",
|
||||
table: "ActionGathered",
|
||||
column: "PetId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EquippedItems_GameItemId",
|
||||
table: "EquippedItems",
|
||||
@@ -335,6 +372,9 @@ namespace PetCompanion.Migrations
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ActionGathered");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "EquippedItems");
|
||||
|
@@ -17,6 +17,34 @@ namespace PetCompanion.Migrations
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.ActionGathered", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Amount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ItemId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("PetId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Resource")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ItemId");
|
||||
|
||||
b.HasIndex("PetId");
|
||||
|
||||
b.ToTable("ActionGathered");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.EquippedItem", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
@@ -665,6 +693,23 @@ namespace PetCompanion.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.ActionGathered", b =>
|
||||
{
|
||||
b.HasOne("PetCompanion.Models.GameItem", "GameItem")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemId");
|
||||
|
||||
b.HasOne("PetCompanion.Models.Pet", "Pet")
|
||||
.WithMany("ActionGathered")
|
||||
.HasForeignKey("PetId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("GameItem");
|
||||
|
||||
b.Navigation("Pet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.EquippedItem", b =>
|
||||
{
|
||||
b.HasOne("PetCompanion.Models.GameItem", "GameItem")
|
||||
@@ -756,6 +801,8 @@ namespace PetCompanion.Migrations
|
||||
|
||||
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
|
||||
{
|
||||
b.Navigation("ActionGathered");
|
||||
|
||||
b.Navigation("EquippedItemsList");
|
||||
|
||||
b.Navigation("Inventory")
|
||||
|
Reference in New Issue
Block a user