Import products

This commit is contained in:
Michał Zieliński
2025-06-28 18:54:08 +01:00
parent eb4b2efbff
commit 518eff0ec7
9 changed files with 167 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
using System.Reflection.Metadata.Ecma335;
using System.Text.Json;
using Bimix.Domain.Entities;
using Bimix.Infrastructure.Data;
@@ -28,6 +29,9 @@ public class ProductSyncService(HttpClient httpClient, BimixDbContext db, IConfi
{
var idStr = p.GetProperty("id").GetString() ?? "";
var name = p.GetProperty("name").GetString() ?? "";
var code = p.GetProperty("code").GetString() ?? "";
var stockAddresses = p.GetProperty("stock_addresses").GetString() ?? "";
var ean = p.GetProperty("ean").GetString() ?? "";
if (!Guid.TryParse(idStr, out Guid id))
{
@@ -43,6 +47,9 @@ public class ProductSyncService(HttpClient httpClient, BimixDbContext db, IConfi
{
Id = id,
Name = name,
Ean = ean,
Code = code,
StockAddresses = stockAddresses,
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow
};