Added core pricing metafield and status check job
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using PartSource.Data.Shopify;
|
||||
//using PartSource.Data.Shopify;
|
||||
using Ratermania.Shopify;
|
||||
using Ratermania.Shopify.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
73
PartSource.Services/MetafieldService.cs
Normal file
73
PartSource.Services/MetafieldService.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
//using Newtonsoft.Json;
|
||||
//using PartSource.Data.Shopify;
|
||||
//using PartSource.Services.Integrations;
|
||||
//using Ratermania.Shopify;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Diagnostics.CodeAnalysis;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
|
||||
//namespace PartSource.Services
|
||||
//{
|
||||
// public class MetafieldService
|
||||
// {
|
||||
// private readonly ShopifyClient _shopifyClient;
|
||||
|
||||
// public MetafieldService(ShopifyClient shopifyClient)
|
||||
// {
|
||||
// _shopifyClient = shopifyClient;
|
||||
// }
|
||||
|
||||
// [SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Lowercase is expected by Shopify")]
|
||||
// public async Task SaveMetafield<T>(T shopifyEntity, IList<int> vehicleIds, string @namespace) where T : ShopifyEntity
|
||||
// {
|
||||
// if (vehicleIds.Count == 0)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// string json = JsonConvert.SerializeObject(vehicleIds);
|
||||
// if (json.Length >= 100000)
|
||||
// {
|
||||
// // TODO: Logging
|
||||
// return;
|
||||
// }
|
||||
|
||||
// string key = @namespace.ToLowerInvariant().Replace(" ", "_");
|
||||
// if (key.Length > 20)
|
||||
// {
|
||||
// key = key.Substring(0, 20);
|
||||
// }
|
||||
|
||||
// Metafield metafield = new Metafield
|
||||
// {
|
||||
// Namespace = "position",
|
||||
// Key = key,
|
||||
// Value = json,
|
||||
// ValueType = "json_string",
|
||||
// OwnerResource = "product",
|
||||
// OwnerId = shopifyEntity.Id
|
||||
// };
|
||||
|
||||
// await _shopifyClient.Metafields.Add(metafield);
|
||||
// }
|
||||
|
||||
// public async Task DeleteMetafields<T>(long shopifyId) where T : ShopifyEntity
|
||||
// {
|
||||
// IDictionary<string, object> parameters = new Dictionary<string, object>
|
||||
// {
|
||||
// { "metafield[owner_id]", shopifyId},
|
||||
// { "metafield[owner_resource]", "product" },
|
||||
// { "namespace", "position" },
|
||||
// };
|
||||
|
||||
// IEnumerable<Metafield> metafields = await _shopifyClient.Metafields.Get(parameters);
|
||||
|
||||
// foreach (Metafield metafield in metafields)
|
||||
// {
|
||||
// await _shopifyClient.Metafields.Delete(metafield);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Ratermania.Shopify" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\shopify\Shopify\Shopify.csproj" />
|
||||
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace PartSource.Services
|
||||
|
||||
string tag = $"{string.Join('-', years)} {make.Trim()} {model.Trim()}";
|
||||
|
||||
Console.WriteLine(tag);
|
||||
System.Diagnostics.Debug.WriteLine(tag);
|
||||
|
||||
fitmentTags.Add(tag);
|
||||
}
|
||||
@@ -116,6 +116,11 @@ namespace PartSource.Services
|
||||
|
||||
public IList<VehicleData> GetVehiclesForPart(string partNumber, string lineCode)
|
||||
{
|
||||
if (string.IsNullOrEmpty(partNumber) || string.IsNullOrEmpty(lineCode))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
partNumber = Regex.Replace(partNumber, "[^a-zA-Z0-9]", string.Empty);
|
||||
|
||||
IQueryable<string> whiCodes = _partSourceContext.DcfMappings
|
||||
|
||||
Reference in New Issue
Block a user