From 735e02229409831f459aa415e9df668344c3cd71 Mon Sep 17 00:00:00 2001 From: Suriya Date: Fri, 22 May 2026 12:10:45 +0530 Subject: [PATCH] queryfix --- src/components/EndpointCard.jsx | 3 +- src/data/graphqlMeta.js | 145 ++++++++++++++++++++++++++++++-- 2 files changed, 141 insertions(+), 7 deletions(-) diff --git a/src/components/EndpointCard.jsx b/src/components/EndpointCard.jsx index 0367bea..26503f2 100644 --- a/src/components/EndpointCard.jsx +++ b/src/components/EndpointCard.jsx @@ -71,8 +71,7 @@ export default function EndpointCard({ endpoint, baseUrl, isLegacy, onSend, resu }, [path, paramDefs, values, baseUrl]) const handleSend = () => { - const useGraphql = endpoint.useGraphql || gqlKey === 'getinvoiceinsight' || gqlKey === 'getinvoices' - if (isLegacy && meta && (endpoint.method !== 'GET' || useGraphql)) { + if (isLegacy && meta) { const graphqlUrl = `${baseUrl}/v1/graphql` let parsedVars = {} try { diff --git a/src/data/graphqlMeta.js b/src/data/graphqlMeta.js index a18d705..d3a3258 100644 --- a/src/data/graphqlMeta.js +++ b/src/data/graphqlMeta.js @@ -84,9 +84,9 @@ export const graphqlMeta = { getusers: { query: /* GraphQL */ ` query GetUsers { - app_user { + app_users { userid - username + username: authname email contactno status @@ -839,6 +839,140 @@ export const graphqlMeta = { `, variables: `{}`, }, + getdeliveries: { + query: /* GraphQL */ ` + query GetDeliveries( + $tenantid: bigint! + $status: String + $fromdate: timestamp + $todate: timestamp + $keyword: String + $limit: Int + $offset: Int + ) { + deliveries( + where: { + tenantid: { _eq: $tenantid } + _and: [ + { orderstatus: { _eq: $status } } + { deliverydate: { _gte: $fromdate } } + { deliverydate: { _lte: $todate } } + { + _or: [ + { pickupcustomer: { _ilike: $keyword } } + { deliverycustomer: { _ilike: $keyword } } + { pickupcontactno: { _ilike: $keyword } } + { deliverycontactno: { _ilike: $keyword } } + { orderid: { _ilike: $keyword } } + ] + } + ] + } + limit: $limit + offset: $offset + order_by: { deliveryid: desc } + ) { + deliveryid + orderid + deliverydate + orderstatus + pickupcustomer + pickupcontactno + pickupaddress + deliverycustomer + deliverycontactno + deliveryaddress + kms + customers { + customertoken + } + app_users { + firstname + contactno + } + tenants { + tenantname + primarycontact + } + } + } + `, + variables: `{\n "tenantid": 10,\n "status": "Delivered",\n "fromdate": "2026-05-01T00:00:00",\n "todate": "2026-05-05T23:59:59",\n "keyword": "%john%",\n "limit": 10,\n "offset": 0\n}`, + }, + getpricinglist: { + query: /* GraphQL */ ` + query GetPricingList($tenantid: bigint!) { + tenantpricing(where: { tenantid: { _eq: $tenantid } }) { + tenantpricingid + pricingid + tenantid + pricingtypeid + baseprice + priceperkm + } + } + `, + variables: `{\n "tenantid": 1087\n}`, + }, + getallpricing: { + query: /* GraphQL */ ` + query GetAllPricing($applocationid: bigint!) { + app_pricing(where: { applocationid: { _eq: $applocationid } }) { + pricingid + applocationid + pricingtypeid + baseprice + priceperkm + status + configid + minkm + maxkm + minorder + othercharges + slab + } + } + `, + variables: `{\n "applocationid": 1\n}`, + }, + getriderdetail: { + query: /* GraphQL */ ` + query GetRiderDetail($userid: bigint!) { + app_users(where: { userid: { _eq: $userid } }) { + userid + authname + firstname + lastname + email + contactno + status + roleid + partnerid + applocationid + } + } + `, + variables: `{\n "userid": 1\n}`, + }, + getallriders: { + query: /* GraphQL */ ` + query GetAllRiders($partnerid: bigint!, $limit: Int) { + app_users(where: { partnerid: { _eq: $partnerid } }, limit: $limit) { + userid + authname + firstname + lastname + email + contactno + status + roleid + partnerid + applocationid + } + } + `, + variables: `{\n "partnerid": 44,\n "limit": 10\n}`, + }, }; export function getGraphQLKey(endpointName) { @@ -855,13 +989,14 @@ export function getGraphQLKey(endpointName) { 'getalltenants': 'gettenantinfo', 'gettenants': 'gettenantinfo', 'gettenantsummary': 'getordersummary', - 'getpricinglist': 'getallpricing', 'tenantsearch': 'searchcustomers', - 'getallriders': 'getriderdetail', 'getallridersummary': 'getridershifts', 'getorderdetails': 'getorders', 'getlocationsummary': 'gettenantlocations', - 'getpaymentrequest': 'getinvoices' + 'getpaymentrequest': 'getinvoices', + 'getapppricing': 'getallpricing', + 'getriderpricing': 'getallpricing', + 'getapplocationconfig': 'getlocationsconfig' }; return map[name] || name;