Add pet action management and update requests

This commit is contained in:
2025-02-01 00:29:33 -03:00
parent 4c4036a266
commit e1c5eed02d
12 changed files with 337 additions and 36 deletions

View File

@@ -0,0 +1,126 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using pet_companion_api.Data;
#nullable disable
namespace pet_companion_api.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250201025206_AddActions")]
partial class AddActions
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
modelBuilder.Entity("pet_companion_api.Models.Pet", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<DateTime>("ActionSince")
.HasColumnType("TEXT");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<bool>("IsDead")
.HasColumnType("INTEGER");
b.Property<int>("Level")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PetAction")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Pets");
});
modelBuilder.Entity("pet_companion_api.Models.PetStats", b =>
{
b.Property<string>("PetId")
.HasColumnType("TEXT");
b.Property<int>("Charisma")
.HasColumnType("INTEGER");
b.Property<int>("Intelligence")
.HasColumnType("INTEGER");
b.Property<int>("Strength")
.HasColumnType("INTEGER");
b.HasKey("PetId");
b.ToTable("PetStats");
});
modelBuilder.Entity("pet_companion_api.Models.Resources", b =>
{
b.Property<string>("PetId")
.HasColumnType("TEXT");
b.Property<int>("Food")
.HasColumnType("INTEGER");
b.Property<int>("Gold")
.HasColumnType("INTEGER");
b.Property<int>("Junk")
.HasColumnType("INTEGER");
b.Property<int>("Wisdom")
.HasColumnType("INTEGER");
b.HasKey("PetId");
b.ToTable("Resources");
});
modelBuilder.Entity("pet_companion_api.Models.PetStats", b =>
{
b.HasOne("pet_companion_api.Models.Pet", null)
.WithOne("Stats")
.HasForeignKey("pet_companion_api.Models.PetStats", "PetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("pet_companion_api.Models.Resources", b =>
{
b.HasOne("pet_companion_api.Models.Pet", null)
.WithOne("Resources")
.HasForeignKey("pet_companion_api.Models.Resources", "PetId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("pet_companion_api.Models.Pet", b =>
{
b.Navigation("Resources")
.IsRequired();
b.Navigation("Stats")
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,52 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace pet_companion_api.Migrations
{
/// <inheritdoc />
public partial class AddActions : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "ActionSince",
table: "Pets",
type: "TEXT",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<bool>(
name: "IsDead",
table: "Pets",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "PetAction",
table: "Pets",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ActionSince",
table: "Pets");
migrationBuilder.DropColumn(
name: "IsDead",
table: "Pets");
migrationBuilder.DropColumn(
name: "PetAction",
table: "Pets");
}
}
}

View File

@@ -1,4 +1,5 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@@ -21,9 +22,15 @@ namespace pet_companion_api.Migrations
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<DateTime>("ActionSince")
.HasColumnType("TEXT");
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<bool>("IsDead")
.HasColumnType("INTEGER");
b.Property<int>("Level")
.HasColumnType("INTEGER");
@@ -31,6 +38,9 @@ namespace pet_companion_api.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PetAction")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");