First successful GQL insert. AD1 fields created and mapped.
This commit is contained in:
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
|
||||
using BodyshopUploader.Utils;
|
||||
using BodyshopUploader.Models;
|
||||
using BodyshopUploader.Utils.Growls;
|
||||
using GraphQL.Common.Request;
|
||||
|
||||
namespace BodyshopUploader.Utils
|
||||
{
|
||||
@@ -83,13 +84,39 @@ namespace BodyshopUploader.Utils
|
||||
item.Job = Utils.Decoder.EstimateDecoder.CIECAEstimateImport.DecodeEstimate(item.FilePath);
|
||||
}
|
||||
|
||||
private static void UpsertQueueItem(DTO_QueueItem item)
|
||||
private static async Task UpsertQueueItem(DTO_QueueItem item)
|
||||
{
|
||||
//Save the job to the DB.
|
||||
logger.Info("Should upsert the job graphqlly here. {0}", item.Job);
|
||||
|
||||
item.Job.shopid = "52b7357c-0edd-4c95-85c3-dfdbcdfad9ac";
|
||||
item.Job.est_number = "lul?";
|
||||
|
||||
var r = new GraphQLRequest
|
||||
{
|
||||
Query = @"
|
||||
mutation INSERT_JOB($jobInput: [jobs_insert_input!]!) {
|
||||
insert_jobs(objects: $jobInput) {
|
||||
returning {
|
||||
id
|
||||
}
|
||||
}
|
||||
}",
|
||||
Variables = new
|
||||
{
|
||||
|
||||
jobInput = item.Job
|
||||
}
|
||||
};
|
||||
|
||||
using (var g = Utils.GraphQL.CreateGQLClient())
|
||||
{
|
||||
var graphQLResponse = await g.PostAsync(r);
|
||||
logger.Info(graphQLResponse.Data.jobs);
|
||||
}
|
||||
|
||||
App.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
|
||||
Growler.AddNotification(new Notification()
|
||||
{
|
||||
Title = Properties.Resources.Msg_NewJobUploaded,
|
||||
|
||||
Reference in New Issue
Block a user