Changes made in automation environment
This commit is contained in:
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PartSource.Automation.Services;
|
||||
|
||||
namespace PartSource.Automation.Jobs
|
||||
{
|
||||
@@ -20,12 +21,14 @@ namespace PartSource.Automation.Jobs
|
||||
private readonly ILogger<UpdatePricing> _logger;
|
||||
private readonly PartSourceContext _partSourceContext;
|
||||
private readonly ShopifyClient _shopifyClient;
|
||||
private readonly EmailService _emailService;
|
||||
|
||||
public UpdatePricing(ILogger<UpdatePricing> logger, PartSourceContext partSourceContext, ShopifyClient shopifyClient)
|
||||
public UpdatePricing(ILogger<UpdatePricing> logger, PartSourceContext partSourceContext, ShopifyClient shopifyClient, EmailService emailService)
|
||||
{
|
||||
_logger = logger;
|
||||
_partSourceContext = partSourceContext;
|
||||
_shopifyClient = shopifyClient;
|
||||
_emailService = emailService;
|
||||
}
|
||||
|
||||
public async Task Run()
|
||||
@@ -97,7 +100,7 @@ namespace PartSource.Automation.Jobs
|
||||
|
||||
try
|
||||
{
|
||||
products = await _shopifyClient.Products.GetNext();
|
||||
products = await _shopifyClient.Products.GetNext();
|
||||
|
||||
_logger.LogInformation($"Total updated: {updateCount}");
|
||||
}
|
||||
@@ -108,6 +111,8 @@ namespace PartSource.Automation.Jobs
|
||||
products = await _shopifyClient.Products.GetPrevious();
|
||||
}
|
||||
}
|
||||
|
||||
_emailService.Send("Update Pricing Completed", $"{updateCount} prices were updated");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user