Automation and Shopify library updates

This commit is contained in:
2022-10-30 22:12:25 -04:00
parent 48844127d7
commit b259b77967
21 changed files with 172 additions and 200 deletions

View File

@@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace PartSource.Automation.Jobs.POC
@@ -19,7 +20,7 @@ namespace PartSource.Automation.Jobs.POC
_shopifyClient = shopifyClient;
}
public async Task Run()
public async Task Run(CancellationToken token, params string[] arguments)
{
IEnumerable<Product> products = await _shopifyClient.Products.Get(new Dictionary<string, object> { { "limit", 250 }, { "product_type", "CA112-SC137-FL13750_Intake Manifolds" } });

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
@@ -29,7 +30,7 @@ namespace PartSource.Automation.Jobs.POC
_shopifyClient = shopifyClient;
}
public async Task Run()
public async Task Run(CancellationToken token, params string[] arguments)
{
await BuildDatabase();
await UpdateShopify();
@@ -177,7 +178,7 @@ namespace PartSource.Automation.Jobs.POC
Namespace = "position",
Key = key,
Value = json,
ValueType = "json_string",
Type = "json",
OwnerResource = "product",
OwnerId = product.Id
};

View File

@@ -16,6 +16,7 @@ using System.Data;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace PartSource.Automation.Jobs
@@ -37,7 +38,7 @@ namespace PartSource.Automation.Jobs
_vehicleService = vehicleService;
}
public async Task Run()
public async Task Run(CancellationToken token, params string[] arguments)
{
IEnumerable<Product> products = null;

View File

@@ -18,6 +18,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace PartSource.Automation.Jobs.POC
@@ -39,7 +40,7 @@ namespace PartSource.Automation.Jobs.POC
_vehicleService = vehicleService;
}
public async Task Run()
public async Task Run(CancellationToken token, params string[] arguments)
{
IList<string> productTypes = new List<string>
{

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
@@ -29,9 +30,9 @@ namespace PartSource.Automation.Jobs.POC
_shopifyClient = shopifyClient;
}
public async Task Run()
public async Task Run(CancellationToken token, params string[] arguments)
{
// await BuildDatabase();
await BuildDatabase();
await UpdateShopify();
}
@@ -143,7 +144,6 @@ namespace PartSource.Automation.Jobs.POC
}
}
//[SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "It's a Shopify metafield key")]
private async Task SavePositionMetafield(Product product, IList<int> vehicleIds, string position)
{
if (vehicleIds.Count == 0)
@@ -169,7 +169,7 @@ namespace PartSource.Automation.Jobs.POC
Namespace = "position",
Key = key,
Value = json,
ValueType = "json_string",
Type = "json",
OwnerResource = "product",
OwnerId = product.Id
};