Refactor namespaces to remove "Companion" and standardize to "PetCompanion"
This commit is contained in:
parent
c433095eb8
commit
06455db598
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Pet.Companion.Models;
|
using PetCompanion.Models;
|
||||||
using Pet.Companion.Services;
|
using PetCompanion.Services;
|
||||||
|
|
||||||
namespace Pet.Companion.Controllers
|
namespace PetCompanion.Controllers
|
||||||
{
|
{
|
||||||
[ApiController]
|
[ApiController]
|
||||||
[Route("api/v1/[controller]")]
|
[Route("api/v1/[controller]")]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pet.Companion.Models;
|
using PetCompanion.Models;
|
||||||
|
|
||||||
namespace Pet.Companion.Data
|
namespace PetCompanion.Data
|
||||||
{
|
{
|
||||||
public class ApplicationDbContext : DbContext
|
public class ApplicationDbContext : DbContext
|
||||||
{
|
{
|
||||||
|
24
Migrations/20250201173643_Initial.Designer.cs
generated
24
Migrations/20250201173643_Initial.Designer.cs
generated
@ -4,11 +4,11 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Pet.Companion.Data;
|
using PetCompanion.Data;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Pet.Companion.Migrations
|
namespace PetCompanion.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
[Migration("20250201173643_Initial")]
|
[Migration("20250201173643_Initial")]
|
||||||
@ -20,7 +20,7 @@ namespace Pet.Companion.Migrations
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
|
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Pet", b =>
|
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Id")
|
b.Property<string>("Id")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -59,7 +59,7 @@ namespace Pet.Companion.Migrations
|
|||||||
b.ToTable("Pets");
|
b.ToTable("Pets");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.PetStats", b =>
|
modelBuilder.Entity("PetCompanion.Models.PetStats", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("PetId")
|
b.Property<string>("PetId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -87,7 +87,7 @@ namespace Pet.Companion.Migrations
|
|||||||
b.ToTable("PetStats");
|
b.ToTable("PetStats");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Resources", b =>
|
modelBuilder.Entity("PetCompanion.Models.Resources", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("PetId")
|
b.Property<string>("PetId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -109,25 +109,25 @@ namespace Pet.Companion.Migrations
|
|||||||
b.ToTable("Resources");
|
b.ToTable("Resources");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.PetStats", b =>
|
modelBuilder.Entity("PetCompanion.Models.PetStats", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pet.Companion.Models.Pet", null)
|
b.HasOne("PetCompanion.Models.Pet", null)
|
||||||
.WithOne("Stats")
|
.WithOne("Stats")
|
||||||
.HasForeignKey("Pet.Companion.Models.PetStats", "PetId")
|
.HasForeignKey("PetCompanion.Models.PetStats", "PetId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Resources", b =>
|
modelBuilder.Entity("PetCompanion.Models.Resources", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pet.Companion.Models.Pet", null)
|
b.HasOne("PetCompanion.Models.Pet", null)
|
||||||
.WithOne("Resources")
|
.WithOne("Resources")
|
||||||
.HasForeignKey("Pet.Companion.Models.Resources", "PetId")
|
.HasForeignKey("PetCompanion.Models.Resources", "PetId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Pet", b =>
|
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Resources")
|
b.Navigation("Resources")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Pet.Companion.Migrations
|
namespace PetCompanion.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class Initial : Migration
|
public partial class Initial : Migration
|
||||||
|
@ -3,11 +3,11 @@ using System;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
using Pet.Companion.Data;
|
using PetCompanion.Data;
|
||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
namespace Pet.Companion.Migrations
|
namespace PetCompanion.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ApplicationDbContext))]
|
[DbContext(typeof(ApplicationDbContext))]
|
||||||
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
|
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
|
||||||
@ -17,7 +17,7 @@ namespace Pet.Companion.Migrations
|
|||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
|
modelBuilder.HasAnnotation("ProductVersion", "9.0.1");
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Pet", b =>
|
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("Id")
|
b.Property<string>("Id")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -56,7 +56,7 @@ namespace Pet.Companion.Migrations
|
|||||||
b.ToTable("Pets");
|
b.ToTable("Pets");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.PetStats", b =>
|
modelBuilder.Entity("PetCompanion.Models.PetStats", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("PetId")
|
b.Property<string>("PetId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -84,7 +84,7 @@ namespace Pet.Companion.Migrations
|
|||||||
b.ToTable("PetStats");
|
b.ToTable("PetStats");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Resources", b =>
|
modelBuilder.Entity("PetCompanion.Models.Resources", b =>
|
||||||
{
|
{
|
||||||
b.Property<string>("PetId")
|
b.Property<string>("PetId")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -106,25 +106,25 @@ namespace Pet.Companion.Migrations
|
|||||||
b.ToTable("Resources");
|
b.ToTable("Resources");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.PetStats", b =>
|
modelBuilder.Entity("PetCompanion.Models.PetStats", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pet.Companion.Models.Pet", null)
|
b.HasOne("PetCompanion.Models.Pet", null)
|
||||||
.WithOne("Stats")
|
.WithOne("Stats")
|
||||||
.HasForeignKey("Pet.Companion.Models.PetStats", "PetId")
|
.HasForeignKey("PetCompanion.Models.PetStats", "PetId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Resources", b =>
|
modelBuilder.Entity("PetCompanion.Models.Resources", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Pet.Companion.Models.Pet", null)
|
b.HasOne("PetCompanion.Models.Pet", null)
|
||||||
.WithOne("Resources")
|
.WithOne("Resources")
|
||||||
.HasForeignKey("Pet.Companion.Models.Resources", "PetId")
|
.HasForeignKey("PetCompanion.Models.Resources", "PetId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Pet.Companion.Models.Pet", b =>
|
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Resources")
|
b.Navigation("Resources")
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Pet.Companion.Models.Enums
|
namespace PetCompanion.Models.Enums
|
||||||
{
|
{
|
||||||
public enum ItemType
|
public enum ItemType
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using Pet.Companion.Models.Enums;
|
using PetCompanion.Models.Enums;
|
||||||
|
|
||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class MaterialItem : Item
|
public class MaterialItem : Item
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class Inventory
|
public class Inventory
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using Pet.Companion.Models.Enums;
|
using PetCompanion.Models.Enums;
|
||||||
|
|
||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public abstract class Item
|
public abstract class Item
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Pet.Companion.Models.Enums;
|
using PetCompanion.Models.Enums;
|
||||||
|
|
||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class Pet
|
public class Pet
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public enum PetBasicAction
|
public enum PetBasicAction
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public enum PetClass
|
public enum PetClass
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class PetClassInfo
|
public class PetClassInfo
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class PetCreationRequest
|
public class PetCreationRequest
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class PetStats
|
public class PetStats
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class PetUpdateActionRequest
|
public class PetUpdateActionRequest
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Pet.Companion.Models
|
namespace PetCompanion.Models
|
||||||
{
|
{
|
||||||
public class Resources
|
public class Resources
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pet.Companion.Data;
|
using PetCompanion.Data;
|
||||||
using Pet.Companion.Repositories;
|
using PetCompanion.Repositories;
|
||||||
using Pet.Companion.Services;
|
using PetCompanion.Services;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace Pet.Companion
|
namespace PetCompanion
|
||||||
{
|
{
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Pet.Companion.Models;
|
using PetCompanion.Models;
|
||||||
using Pet.Companion.Models.Enums;
|
using PetCompanion.Models.Enums;
|
||||||
|
|
||||||
namespace Pet.Companion.Repositories
|
namespace PetCompanion.Repositories
|
||||||
{
|
{
|
||||||
public class ItemRepository
|
public class ItemRepository
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pet.Companion.Data;
|
using PetCompanion.Data;
|
||||||
using Pet.Companion.Models;
|
using PetCompanion.Models;
|
||||||
|
|
||||||
namespace Pet.Companion.Repositories
|
namespace PetCompanion.Repositories
|
||||||
{
|
{
|
||||||
public class PetClassRepository
|
public class PetClassRepository
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pet.Companion.Data;
|
using PetCompanion.Data;
|
||||||
using Pet.Companion.Models;
|
using PetCompanion.Models;
|
||||||
|
|
||||||
namespace Pet.Companion.Repositories
|
namespace PetCompanion.Repositories
|
||||||
{
|
{
|
||||||
public class PetRepository
|
public class PetRepository
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Pet.Companion.Models;
|
using PetCompanion.Models;
|
||||||
using Pet.Companion.Repositories;
|
using PetCompanion.Repositories;
|
||||||
|
|
||||||
namespace Pet.Companion.Services
|
namespace PetCompanion.Services
|
||||||
{
|
{
|
||||||
public class PetClassService
|
public class PetClassService
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using Pet.Companion.Models;
|
using PetCompanion.Models;
|
||||||
using Pet.Companion.Repositories;
|
using PetCompanion.Repositories;
|
||||||
|
|
||||||
namespace Pet.Companion.Services
|
namespace PetCompanion.Services
|
||||||
{
|
{
|
||||||
public class PetService
|
public class PetService
|
||||||
{
|
{
|
||||||
@ -28,7 +28,10 @@ namespace Pet.Companion.Services
|
|||||||
UserId = userId.ToString(),
|
UserId = userId.ToString(),
|
||||||
Name = petRequest.Name,
|
Name = petRequest.Name,
|
||||||
Class = petRequest.Class,
|
Class = petRequest.Class,
|
||||||
|
Health = 100,
|
||||||
|
MaxHealth = 100,
|
||||||
Level = 1,
|
Level = 1,
|
||||||
|
Experience = 0,
|
||||||
Stats = PetStats.BuildFromClass(petRequest.Class),
|
Stats = PetStats.BuildFromClass(petRequest.Class),
|
||||||
Resources = new Resources(),
|
Resources = new Resources(),
|
||||||
GatherActionSince = DateTime.UtcNow,
|
GatherActionSince = DateTime.UtcNow,
|
||||||
@ -64,12 +67,12 @@ namespace Pet.Companion.Services
|
|||||||
case PetBasicAction.FEED:
|
case PetBasicAction.FEED:
|
||||||
pet.Resources.Food -= 1;
|
pet.Resources.Food -= 1;
|
||||||
pet.IncrementStrength(1);
|
pet.IncrementStrength(1);
|
||||||
pet.Health = Math.Min(pet.Health + 5, 100);
|
pet.Health = Math.Min(pet.Health + 5, pet.MaxHealth);
|
||||||
break;
|
break;
|
||||||
case PetBasicAction.SLEEP:
|
case PetBasicAction.SLEEP:
|
||||||
pet.IncrementIntelligence(1);
|
pet.IncrementIntelligence(1);
|
||||||
pet.IncrementStrength(1);
|
pet.IncrementStrength(1);
|
||||||
pet.Health = Math.Min(pet.Health + 15, Pet.MaxHealth);
|
pet.Health = Math.Min(pet.Health + 15, pet.MaxHealth);
|
||||||
break;
|
break;
|
||||||
case PetBasicAction.PLAY:
|
case PetBasicAction.PLAY:
|
||||||
pet.Resources.Junk -= 1;
|
pet.Resources.Junk -= 1;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<RootNamespace>Pet.Companion</RootNamespace>
|
<RootNamespace>PetCompanion</RootNamespace>
|
||||||
<UserSecretsId>fb7dfb2a-4bb7-4cd0-bc10-293410089f4b</UserSecretsId>
|
<UserSecretsId>fb7dfb2a-4bb7-4cd0-bc10-293410089f4b</UserSecretsId>
|
||||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
<DockerfileContext>.</DockerfileContext>
|
<DockerfileContext>.</DockerfileContext>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user