Implement base controller for shared functionality; update existing controllers to inherit from BaseController and adjust user ID handling. Add JWT authentication support and modify item retrieval methods in GameDataController.

This commit is contained in:
2025-02-15 21:57:59 -03:00
parent 6d81ff1564
commit b84599b370
10 changed files with 72 additions and 31 deletions
+4 -4
View File
@@ -29,18 +29,18 @@ namespace PetCompanion.Services
this.petActionService = petActionService;
}
public IEnumerable<Pet> GetAllPets(Guid userId)
public IEnumerable<Pet> GetAllPets(string userId)
{
return petRepository.GetPetsByUserId(userId.ToString());
return petRepository.GetPetsByUserId(userId);
}
public Pet CreatePet(Guid userId, PetCreationRequest petRequest)
public Pet CreatePet(string userId, PetCreationRequest petRequest)
{
var petId = Guid.NewGuid().ToString();
var pet = new Pet
{
Id = petId,
UserId = userId.ToString(),
UserId = userId,
Name = petRequest.Name,
Class = petRequest.Class,
Health = 100,