This commit is contained in:
2026-04-18 22:36:21 +04:30
parent 49591985ac
commit c64c3dd9be
20 changed files with 157 additions and 24 deletions
@@ -7,18 +7,18 @@ using Vizhvizh.Shop.Domain.Shops.ValuesObjects;
namespace Vizhvizh.Shop.Application.CommandHandlers.Shops;
public class CreateShopCommandHandler(IShopRepository shopRepository) : ICommandHandler<CreateShopCommand, ShopId>
public class CreateShopCommandHandler(IShopRepository shopRepository) : ICommandHandler<CreateShopCommand>
{
public async Task<ShopId> Handle(CreateShopCommand request, CancellationToken cancellationToken)
public async Task Handle(CreateShopCommand request, CancellationToken cancellationToken)
{
var location = ShopLocation.CreateNew(request.ShopLocation.Latitude, request.ShopLocation.Longitude,
request.ShopLocation.ProvinceId, request.ShopLocation.CityId, request.ShopLocation.Address, request.ShopLocation.PostalCode);
var businessLicense = ShopBusinessLicense.CreateNew(request.ShopBusinessLicenseImage, request.ShopBusinessLicenseCode);
var shop = Domain.Shops.Entities.Shop.CreateNew(request.OwnerId, request.Title,
location,TelephoneVO.CreateNew(request.Telephone), request.Description);
location, TelephoneVO.CreateNew(request.Telephone), businessLicense, request.Description);
await shopRepository.AddAsync(shop, cancellationToken);
return shop.Id;
}
}
@@ -14,4 +14,8 @@
<ProjectReference Include="..\Vichvich.Shop.ApplicationContract\Vizhvizh.Shop.ApplicationContract.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="CommandHandlers\Products\" />
</ItemGroup>
</Project>