Updated graphql package and changed insert job query to upsert BOD-198.

This commit is contained in:
Patrick Fic
2020-08-20 14:35:31 -07:00
parent 32ec745c77
commit 8766026263
7 changed files with 66 additions and 31 deletions

View File

@@ -93,11 +93,20 @@
<Reference Include="Firebase.Auth, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\FirebaseAuthentication.net.3.4.0\lib\netstandard1.1\Firebase.Auth.dll</HintPath>
</Reference>
<Reference Include="GraphQL.Client, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GraphQL.Client.1.0.3\lib\netstandard2.0\GraphQL.Client.dll</HintPath>
<Reference Include="GraphQL.Client, Version=3.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GraphQL.Client.3.1.4\lib\net461\GraphQL.Client.dll</HintPath>
</Reference>
<Reference Include="GraphQL.Common, Version=1.0.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GraphQL.Common.1.0.3\lib\netstandard2.0\GraphQL.Common.dll</HintPath>
<Reference Include="GraphQL.Client.Abstractions, Version=3.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GraphQL.Client.Abstractions.3.1.4\lib\netstandard2.0\GraphQL.Client.Abstractions.dll</HintPath>
</Reference>
<Reference Include="GraphQL.Client.Abstractions.Websocket, Version=3.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GraphQL.Client.Abstractions.Websocket.3.1.4\lib\netstandard2.0\GraphQL.Client.Abstractions.Websocket.dll</HintPath>
</Reference>
<Reference Include="GraphQL.Client.Serializer.Newtonsoft, Version=3.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GraphQL.Client.Serializer.Newtonsoft.3.1.4\lib\netstandard2.0\GraphQL.Client.Serializer.Newtonsoft.dll</HintPath>
</Reference>
<Reference Include="GraphQL.Primitives, Version=3.1.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GraphQL.Primitives.3.1.4\lib\netstandard2.0\GraphQL.Primitives.dll</HintPath>
</Reference>
<Reference Include="Hardcodet.Wpf.TaskbarNotification, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
@@ -241,10 +250,16 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.WebSockets.Client.Managed, Version=1.0.22.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.WebSockets.Client.Managed.1.0.22\lib\net45\System.Net.WebSockets.Client.Managed.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Reactive, Version=4.3.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reactive.4.3.2\lib\net46\System.Reactive.dll</HintPath>
</Reference>
<Reference Include="System.Reflection, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll</HintPath>
<Private>True</Private>
@@ -300,7 +315,15 @@
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />

View File

@@ -1,22 +1,24 @@
using GraphQL.Client;
using GraphQL.Common.Request;
using GraphQL.Common.Response;
using GraphQL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GraphQL.Client.Http;
using GraphQL.Client.Serializer.Newtonsoft;
namespace BodyshopPartner.Utils
{
public static class GraphQL
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public static GraphQLClient CreateGQLClient()
public static GraphQLHttpClient CreateGQLClient()
{
var graphQLClient = new GraphQLClient("https://bodyshop-dev-db.herokuapp.com/v1/graphql");
graphQLClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + Utils.Auth.authlink.FirebaseToken);
var graphQLClient = new GraphQLHttpClient("https://bodyshop-dev-db.herokuapp.com/v1/graphql", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + Utils.Auth.authlink.FirebaseToken);
return graphQLClient;
}
@@ -25,9 +27,10 @@ namespace BodyshopPartner.Utils
using (var g = Utils.GraphQL.CreateGQLClient())
{
logger.Trace("Firing GQL Query: {0} {1}", r.Query.ToString(), r.Variables);
var graphQLResponse = await g.PostAsync(r);
var graphQLResponse = await g.SendQueryAsync<dynamic>(r);
if (graphQLResponse.Errors == null)
{
//logger.Trace("GQL Response: {0}", graphQLResponse.Data);
return graphQLResponse.Data;
}

View File

@@ -8,7 +8,7 @@ using System.Threading.Tasks;
using BodyshopPartner.Utils;
using BodyshopPartner.Models;
using BodyshopPartner.Utils.Growls;
using GraphQL.Common.Request;
using GraphQL;
using Newtonsoft.Json.Linq;
using ToastNotifications.Messages;
@@ -132,7 +132,7 @@ namespace BodyshopPartner.Utils
newJob.est_data.vehicleid = vehuuid;
}
if (await Utils.Queries.JobsQueries.GetJobUuidByClmNo(item.Job.clm_no?.Value ?? ""))
if (await Utils.Queries.JobsQueries.CheckSupplementByClaimNo(item.Job.clm_no?.Value ?? ""))
{
newJob.issupplement = true;
};
@@ -141,19 +141,21 @@ namespace BodyshopPartner.Utils
var r = new GraphQLRequest
{
Query = @"
mutation INSERT_AVAILABLE_JOB($jobInput: [available_jobs_insert_input!]!) {
insert_available_jobs(objects: $jobInput) {
returning {
id
}
}
}",
mutation INSERT_AVAILABLE_JOB($jobInput: [available_jobs_insert_input!]!) {
insert_available_jobs(objects: $jobInput, on_conflict: {constraint: available_jobs_clm_no_bodyshopid_key, update_columns: [clm_amt, cieca_id, est_data, issupplement, ownr_name, source_system, supplement_number, vehicle_info]}) {
returning {
id
}
}
}
",
Variables = new
{
jobInput = newJob
jobInput = newJob,
}
};
//cieca_id, est_data, issupplement, jobid, ownr_name, source_system, supplement_number, vehicle_info
try
{
var d = await Utils.GraphQL.ExecuteQuery(r);

View File

@@ -1,4 +1,4 @@
using GraphQL.Common.Request;
using GraphQL;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,7 +11,7 @@ namespace BodyshopPartner.Utils.Queries
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public static async Task<bool> GetJobUuidByClmNo(string ClmNo)
public static async Task<bool> CheckSupplementByClaimNo(string ClmNo)
{
if (string.IsNullOrEmpty(ClmNo))
return false;
@@ -19,9 +19,9 @@ namespace BodyshopPartner.Utils.Queries
var r = new GraphQLRequest
{
Query = @"query QUERY_JOB_BY_CLM_NO($clm_no: String!) {
jobs(where: {clm_no: {_eq: $clm_no}}) {
id
}
jobs(where: {clm_no: {_eq: $clm_no}}) {
id
}
}",
Variables = new
{

View File

@@ -1,4 +1,4 @@
using GraphQL.Common.Request;
using GraphQL;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -1,7 +1,7 @@
using BodyshopPartner.Models;
using BodyshopPartner.Utils.Growls;
using GraphQL.Client;
using GraphQL.Common.Request;
using GraphQL;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;

View File

@@ -3,8 +3,11 @@
<package id="DeltaCompressionDotNet" version="1.1.0" targetFramework="net472" />
<package id="DotNetDBF" version="6.0.0.3" targetFramework="net472" />
<package id="FirebaseAuthentication.net" version="3.4.0" targetFramework="net472" />
<package id="GraphQL.Client" version="1.0.3" targetFramework="net472" />
<package id="GraphQL.Common" version="1.0.3" targetFramework="net472" />
<package id="GraphQL.Client" version="3.1.4" targetFramework="net472" />
<package id="GraphQL.Client.Abstractions" version="3.1.4" targetFramework="net472" />
<package id="GraphQL.Client.Abstractions.Websocket" version="3.1.4" targetFramework="net472" />
<package id="GraphQL.Client.Serializer.Newtonsoft" version="3.1.4" targetFramework="net472" />
<package id="GraphQL.Primitives" version="3.1.4" targetFramework="net472" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net472" />
<package id="MaterialDesignColors" version="1.2.6" targetFramework="net472" />
<package id="MaterialDesignThemes" version="3.1.3" targetFramework="net472" />
@@ -45,8 +48,10 @@
<package id="System.Net.Http" version="4.3.4" targetFramework="net472" />
<package id="System.Net.Primitives" version="4.3.1" targetFramework="net472" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net472" />
<package id="System.Net.WebSockets.Client.Managed" version="1.0.22" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net472" />
<package id="System.Reactive" version="4.3.2" targetFramework="net472" />
<package id="System.Reflection" version="4.3.0" targetFramework="net472" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net472" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net472" />
@@ -67,7 +72,9 @@
<package id="System.Text.RegularExpressions" version="4.3.1" targetFramework="net472" />
<package id="System.Threading" version="4.3.0" targetFramework="net472" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net472" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net472" />
<package id="ToastNotifications" version="2.5.1" targetFramework="net472" />