Sync products with old e5 CRM

This commit is contained in:
Michał Zieliński
2025-06-23 21:52:09 +02:00
parent 8cb3b50fe7
commit 63b7ed51d1
17 changed files with 339 additions and 80 deletions

View File

@@ -5,8 +5,8 @@ using Microsoft.EntityFrameworkCore;
namespace Bimix.API.Controllers;
[Route("api/[controller]")]
[ApiController]
[Route("api/[controller]")]
public class ProductsController(BimixDbContext context) : ControllerBase
{
private readonly BimixDbContext _context = context;

View File

@@ -0,0 +1,16 @@
using Bimix.Infrastructure.Sync;
using Microsoft.AspNetCore.Mvc;
namespace Bimix.API.Controllers;
[ApiController]
[Route("api/[controller]")]
public class SyncController(ProductSyncService productSyncService) : ControllerBase
{
[HttpPost("run-product-sync")]
public async Task<IActionResult> RunProductSync()
{
await productSyncService.RunAsync();
return Ok();
}
}

View File

@@ -1,11 +1,14 @@
using Bimix.Infrastructure.Data;
using Bimix.Infrastructure.Sync;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<BimixDbContext>(options => options.UseSqlServer(connectionString));
builder.Services.AddScoped<ProductSyncService>();
builder.Services.AddHttpClient();
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

View File

@@ -1,41 +1,14 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54415",
"sslPort": 44366
}
},
"profiles": {
"http": {
"dev": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5090",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7139;http://localhost:5090",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7142;http://localhost:5142",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
}