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

View File

@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace PetCompanion.Controllers
{
[Authorize]
[ApiController]
[Route("api/v1/[controller]")]
public class BaseController : Controller
{
protected string userId => User.Claims.FirstOrDefault(c => c.Type == "user_id").Value;
}
}