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

@@ -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);