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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user