Add frontend creation game (#13)

Reviewed-on: #13
This commit was merged in pull request #13.
This commit is contained in:
2025-04-13 17:21:15 +02:00
parent 3ea96186e7
commit 225e8ba140
60 changed files with 913 additions and 231 deletions

View File

@@ -0,0 +1,26 @@
using GameIdeas.Shared.Dto;
using GameIdeas.WebAPI.Services.Interfaces;
using Microsoft.AspNetCore.Mvc;
namespace GameIdeas.WebAPI.Controllers;
[ApiController]
[Route("api/[controller]")]
public class CategoryController(ICategoryService categoryService, ILoggerFactory loggerFactory) : Controller
{
private readonly ILogger<CategoryController> logger = loggerFactory.CreateLogger<CategoryController>();
[HttpGet("All")]
public async Task<ActionResult<CategoriesDto>> FetchAllCategories()
{
try
{
return Ok(await categoryService.GetCategories());
}
catch (Exception e)
{
logger.LogError(e, "Internal error while fetching categories");
return StatusCode(500, e.Message);
}
}
}