shop info

This commit is contained in:
Tizian.Breuch
2025-09-25 16:38:11 +02:00
parent 654acddf42
commit eb1f58d81f
3 changed files with 15 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
// src/Webshop.Application/Services/Public/ShopInfoService.cs
using System.Threading.Tasks;
using Webshop.Application;
using Webshop.Application.DTOs.Shop;
using Webshop.Domain.Interfaces;
@@ -14,17 +15,18 @@ namespace Webshop.Application.Services.Public
_shopInfoRepository = shopInfoRepository;
}
public async Task<PublicShopInfoDto> GetPublicShopInfoAsync()
public async Task<ServiceResult<PublicShopInfoDto>> GetPublicShopInfoAsync()
{
var shopInfo = await _shopInfoRepository.GetAsync();
if (shopInfo == null)
{
// Gib Standardwerte zurück, wenn nichts konfiguriert ist
return new PublicShopInfoDto { ShopName = "Webshop" };
var defaultDto = new PublicShopInfoDto { ShopName = "Webshop" };
return ServiceResult.Ok(defaultDto);
}
return new PublicShopInfoDto
var dto = new PublicShopInfoDto
{
ShopName = shopInfo.ShopName,
Slogan = shopInfo.Slogan,
@@ -38,6 +40,8 @@ namespace Webshop.Application.Services.Public
InstagramUrl = shopInfo.InstagramUrl,
TwitterUrl = shopInfo.TwitterUrl
};
return ServiceResult.Ok(dto);
}
}
}