// src/Webshop.Api/Controllers/Public/ShopInfoController.cs
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Webshop.Application.DTOs.Shop;
using Webshop.Application.Services.Public;
namespace Webshop.Api.Controllers.Public
{
///
/// API-Endpunkte zum Abrufen öffentlicher Shop-Informationen.
///
[ApiController]
[Route("api/v1/public/[controller]")]
[AllowAnonymous]
public class ShopInfoController : ControllerBase
{
private readonly IShopInfoService _shopInfoService;
public ShopInfoController(IShopInfoService shopInfoService)
{
_shopInfoService = shopInfoService;
}
///
/// Ruft die öffentlichen Stammdaten des Shops ab.
///
///
/// Diese Informationen sind für jeden Besucher sichtbar und werden typischerweise im Footer, auf der Kontaktseite oder im Impressum verwendet.
///
[HttpGet]
[ProducesResponseType(typeof(PublicShopInfoDto), StatusCodes.Status200OK)]
public async Task GetPublicShopInfo()
{
var result = await _shopInfoService.GetPublicShopInfoAsync();
// Dieser Service-Aufruf ist so konzipiert, dass er immer ein erfolgreiches Ergebnis liefert.
return Ok(result.Value);
}
}
}