From d75b7ddbbd477afacca79a2a74516ed853183bec Mon Sep 17 00:00:00 2001 From: Morry Date: Fri, 20 Dec 2024 19:29:20 -0600 Subject: [PATCH] add a few more fields --- __snapshots__/index.test.js.snap | 8 +++++++- index.test.js | 6 ++---- package-lock.json | 14 +++++++------- package.json | 2 +- resolvers/itinerary.js | 5 +++++ 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/__snapshots__/index.test.js.snap b/__snapshots__/index.test.js.snap index 8c4bda9..5e9a478 100644 --- a/__snapshots__/index.test.js.snap +++ b/__snapshots__/index.test.js.snap @@ -3299,10 +3299,13 @@ Object { "agentRef": "2356674/1", "bookingId": "316559", "bookingStatus": "Quotation", + "canEdit": true, "enteredDate": "2024-09-12", + "name": "2356674/1 Sean Conta", "ref": "ALFI393706", "serviceLines": Array [ Object { + "linePrice": "187795", "optionId": "LONHOSANLONBFBDLX", "optionName": "Bed and Full Buffet Breakfast", "paxConfigs": Array [ @@ -3320,7 +3323,7 @@ Object { "personId": "628199", }, ], - "roomType": "DB", + "roomType": "Double", }, ], "paxList": Array [ @@ -3333,8 +3336,11 @@ Object { "personId": "628199", }, ], + "quantity": 4, "serviceLineId": "745684", "startDate": "2025-08-13", + "supplierId": null, + "supplierName": "Sanderson", }, ], "totalPrice": "187795", diff --git a/index.test.js b/index.test.js index e3fffc8..dbe15de 100644 --- a/index.test.js +++ b/index.test.js @@ -4,10 +4,8 @@ const axios = require('axios'); const path = require('path'); const xml2js = require('xml2js'); const R = require('ramda'); -// const { typeDefs: itineraryProductTypeDefs, query: itineraryProductQuery } = require('./node_modules/ti2/controllers/graphql-schemas/itinerary-product'); -// const { typeDefs: itineraryBookingTypeDefs, query: itineraryBookingQuery } = require('./node_modules/ti2/controllers/graphql-schemas/itinerary-booking'); -const { typeDefs: itineraryProductTypeDefs, query: itineraryProductQuery } = require('../ti2/controllers/graphql-schemas/itinerary-product'); -const { typeDefs: itineraryBookingTypeDefs, query: itineraryBookingQuery } = require('../ti2/controllers/graphql-schemas/itinerary-booking'); +const { typeDefs: itineraryProductTypeDefs, query: itineraryProductQuery } = require('./node_modules/ti2/controllers/graphql-schemas/itinerary-product'); +const { typeDefs: itineraryBookingTypeDefs, query: itineraryBookingQuery } = require('./node_modules/ti2/controllers/graphql-schemas/itinerary-booking'); const xmlParser = new xml2js.Parser(); const hash = require('object-hash'); diff --git a/package-lock.json b/package-lock.json index ef99cd9..ddbf046 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "jsonwebtoken": "^8.5.1", "moment": "^2.29.1", "ramda": "^0.27.1", - "ti2": "^1.0.80", + "ti2": "^1.0.82", "underscore": "^1.13.4", "xml-js": "^1.6.11", "xml2js": "^0.4.23" @@ -8143,9 +8143,9 @@ } }, "node_modules/ti2": { - "version": "1.0.80", - "resolved": "https://registry.npmjs.org/ti2/-/ti2-1.0.80.tgz", - "integrity": "sha512-BvXDnmc87gFl6JpmX5KQwW0ZZluUnCRabhY9tRPnA++hGn3yRL/dn6edbCR2O7AyhEvLFAamVxOzTMGUkJgFOA==", + "version": "1.0.82", + "resolved": "https://registry.npmjs.org/ti2/-/ti2-1.0.82.tgz", + "integrity": "sha512-15cU7ESMDYIm2qHx69p2Gy6RnwwXz0sgHennAKl3Fa8OJmmBNLqTQI0Fy5IYQqx29c8mEjsLWo773CVXXi0HtA==", "dependencies": { "axios": "^0.27.2", "axios-curlirize": "^1.3.7", @@ -15017,9 +15017,9 @@ } }, "ti2": { - "version": "1.0.80", - "resolved": "https://registry.npmjs.org/ti2/-/ti2-1.0.80.tgz", - "integrity": "sha512-BvXDnmc87gFl6JpmX5KQwW0ZZluUnCRabhY9tRPnA++hGn3yRL/dn6edbCR2O7AyhEvLFAamVxOzTMGUkJgFOA==", + "version": "1.0.82", + "resolved": "https://registry.npmjs.org/ti2/-/ti2-1.0.82.tgz", + "integrity": "sha512-15cU7ESMDYIm2qHx69p2Gy6RnwwXz0sgHennAKl3Fa8OJmmBNLqTQI0Fy5IYQqx29c8mEjsLWo773CVXXi0HtA==", "requires": { "axios": "^0.27.2", "axios-curlirize": "^1.3.7", diff --git a/package.json b/package.json index 0451386..037e5d5 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "jsonwebtoken": "^8.5.1", "moment": "^2.29.1", "ramda": "^0.27.1", - "ti2": "^1.0.80", + "ti2": "^1.0.82", "underscore": "^1.13.4", "xml-js": "^1.6.11", "xml2js": "^0.4.23" diff --git a/resolvers/itinerary.js b/resolvers/itinerary.js index 061b5f5..42454ce 100644 --- a/resolvers/itinerary.js +++ b/resolvers/itinerary.js @@ -14,6 +14,7 @@ const resolvers = { totalPrice: R.path(['TotalPrice']), travelDate: R.path(['TravelDate']), enteredDate: R.path(['EnteredDate']), + canEdit: root => root.ReadOnly === 'N' && root.CanAddServices === 'Y', serviceLines: booking => { let Services = R.pathOr([], ['Services', 'Service'], booking); if (!Array.isArray(Services)) Services = [Services]; @@ -35,11 +36,15 @@ const resolvers = { }, ServiceLine: { serviceLineId: R.path(['ServiceLineId']), + supplierId: R.path(['ProductId']), + supplierName: R.path(['SupplierName']), optionId: R.path(['Opt']), optionName: R.path(['Description']), startDate: R.path(['Date']), paxList: R.path(['paxList']), paxConfigs: R.path(['paxConfigs']), + linePrice: R.path(['LinePrice']), + quantity: R.path(['SCUqty']), }, PaxConfig: { roomType: px => {