export const graphqlMeta = { getsubcategory: { query: /* GraphQL */ /* GraphQL */ ` query GetSubCategory($moduleid: bigint!, $categoryid: bigint!) { app_subcategory( where: { categoryid: { _eq: $categoryid } category: { modules: { moduleid: { _eq: $moduleid } } } } ) { subcategoryid categoryid categorytypeid subcategoryname categoryname sortorder status statuscode } } `, variables: `{\n "moduleid": 6,\n "categoryid": 1\n}`, }, getorders: { query: /* GraphQL */ /* GraphQL */ ` query GetOrders( $start: timestamptz! $end: timestamptz! $status: String! $limit: Int! $offset: Int! ) { orders( where: { deliverytime: { _gte: $start, _lte: $end } orderstatus: { _eq: $status } } limit: $limit offset: $offset ) { orderheaderid orderid orderstatus deliverytime orderamount tenant { tenantname } } } `, variables: `{\n "start": "2026-01-01T00:00:00",\n "end": "2026-01-31T23:59:59",\n "status": "delivered",\n "limit": 10,\n "offset": 0\n}`, }, gettenantlocations: { query: /* GraphQL */ /* GraphQL */ ` query GetTenantLocations($tenantid: bigint!) { tenant_locations(where: { tenantid: { _eq: $tenantid } }) { locationid locationname tenantid } } `, variables: `{\n "tenantid": 1\n}`, }, getapplocations: { query: /* GraphQL */ /* GraphQL */ ` query GetAppLocations($userid: bigint!) { details: app_location( where: { app_locationconfigs: { status: { _eq: "Active" } userid: { _eq: $userid } } } ) { applocationid locationname } } `, variables: `{\n "userid": 1\n}`, }, getusers: { query: /* GraphQL */ /* GraphQL */ ` query GetUsers { app_user { userid username email contactno status } } `, variables: `{}`, }, gettenantinfo: { query: /* GraphQL */ /* GraphQL */ ` query GetTenantInfo($tenantid: bigint!) { tenants(where: { tenantid: { _eq: $tenantid } }) { tenantid tenantname email contactno status } } `, variables: `{\n "tenantid": 1079,\n "configid": 1,\n "fromdate": "2025-07-24T00:00:00",\n "todate": "2025-07-24T23:59:59"\n}`, }, getordersummary: { query: /* GraphQL */ /* GraphQL */ ` query GetOrderSummary( $tenantid: bigint! $configid: bigint! $fromdate: timestamp! $todate: timestamp! ) { orders_aggregate( where: { tenantid: { _eq: $tenantid } deliverytime: { _gte: $fromdate, _lte: $todate } } ) { aggregate { count } } orders( where: { tenantid: { _eq: $tenantid } deliverytime: { _gte: $fromdate, _lte: $todate } } limit: 10 order_by: { deliverytime: desc } ) { orderid orderstatus orderamount deliverytime } } `, variables: `{\n "tenantid": 1079,\n "fromdate": "2025-07-24T00:00:00",\n "todate": "2025-07-24T23:59:59"\n}`, }, getcustomersbytenant: { query: /* GraphQL */ /* GraphQL */ ` query GetCustomersByTenant( $tenantid: bigint! $limit: Int! $offset: Int! ) { tenantcustomers( where: { tenantid: { _eq: $tenantid } } limit: $limit offset: $offset order_by: { customer: { customerid: desc } } ) { tenantlocationid: locationid customer { customerid firstname lastname contactno email address suburb city state landmark doorno postcode latitude longitude applocationid status } } } `, variables: `{\n "tenantid": 1079,\n "limit": 10,\n "offset": 0\n}`, }, getapproles: { query: /* GraphQL */ /* GraphQL */ ` query GetAppRoles($configid: bigint!) { app_roles(where: { configid: { _eq: $configid } }) { roleid rolename configid } } `, variables: `{\n "configid": 1\n}`, }, getactivelocationbyid: { query: /* GraphQL */ /* GraphQL */ ` query GetActiveLocationById { app_locations(where: { status: { _eq: "Active" } }) { locationid locationname } } `, variables: `{}`, }, getlocationsconfig: { query: /* GraphQL */ /* GraphQL */ ` query GetLocations { details: app_location(where: {status: {_eq: "Active"}}) { applocationid locationname image city state postcode latitude longitude opentime closetime radius applocationadmins: app_locationconfigs(where: {notify: {_eq: "true"}}) { applocationid userid notify app_user { userfcmtokem: userfcmtoken } } } } `, variables: `{}`, }, getpartners: { query: /* GraphQL */ /* GraphQL */ ` query GetPartners( $applocationid: bigint! $partnerid: bigint! $limit: Int! $offset: Int! ) { details: partnerinfo( where: { status: { _eq: "Active" } _and: [ { _or: [ { applocationid: { _eq: $applocationid } } { applocationid: { _eq: 0 } } ] } { _or: [ { partnerid: { _eq: $partnerid } } { partnerid: { _eq: 0 } } ] } ] } limit: $limit offset: $offset ) { partnerid applocationid partnertypeid partnername primarycontact primaryemail contactno address suburb state city partnerimage } } `, variables: `{\n "applocationid": 1,\n "partnerid": 0,\n "limit": 10,\n "offset": 0\n}`, }, getridershifts: { query: /* GraphQL */ /* GraphQL */ ` query GetRiderShifts($applocationid: bigint!) { details: ridershifts( where: { applocationid: { _eq: $applocationid } } order_by: { shiftid: desc } ) { shiftid shiftdate starttime endtime shifthours basefare additionalkm additionalcharges orders fuelcharge shiftname } } `, variables: `{\n "applocationid": 1\n}`, }, getapptypes: { query: /* GraphQL */ /* GraphQL */ ` query GetTypes($tag: String!) { app_types(where: { status: { _eq: "Active" }, tag: { _eq: $tag } }) { apptypeid typename tag status description mapid created updated } } `, variables: `{\n "tag": "partner"\n}`, }, gettenantcustomers: { query: /* GraphQL */ /* GraphQL */ ` query GetTenantCustomers( $tenantid: bigint! $locationid: bigint! $limit: Int! $offset: Int! ) { details: tenantcustomers( where: { tenantid: { _eq: $tenantid } locationid: { _eq: $locationid } customer: { customerid: { _is_null: false } } } limit: $limit offset: $offset order_by: { customer: { customerid: desc } } ) { tenantlocationid: locationid customer { customerid firstname lastname contactno email address suburb city state landmark doorno postcode latitude longitude applocationid status } } } `, variables: `{\n "tenantid": 1079,\n "locationid": 1,\n "limit": 10,\n "offset": 0\n}`, }, getproductcategories: { query: /* GraphQL */ /* GraphQL */ ` query GetProductCategories($moduleid: bigint!) { productcategories( where: { moduleid: { _eq: $moduleid }, status: { _eq: "Active" } } order_by: { sortorder: asc } ) { categoryid moduleid categorytypeid categoryname status created updated } } `, variables: `{\n "moduleid": 6\n}`, }, getproductsubcategories: { query: /* GraphQL */ /* GraphQL */ ` query GetProductSubCategories($categoryid: bigint!) { product_subcategories(where: { categoryid: { _eq: $categoryid } }) { subcategoryid categoryid subcategoryname status } } `, variables: `{\n "categoryid": 1\n}`, }, getproductvariants: { query: /* GraphQL */ /* GraphQL */ ` query GetProductVariants($tenantid: bigint!, $subcategoryid: bigint!) { productvariants( where: { tenantid: { _eq: $tenantid } subcategoryid: { _eq: $subcategoryid } } ) { variantid productid tenantid categoryid subcategoryid variantname price status created updated category { categoryname } } } `, variables: `{\n "tenantid": 1079,\n "subcategoryid": 1\n}`, }, getstockstatement: { query: /* GraphQL */ /* GraphQL */ ` query GetStockStatement( $tenantid: bigint! $locationid: bigint! $subcategoryid: bigint $keyword: String $limit: Int $offset: Int ) { product_stock_statement( where: { tenantid: { _eq: $tenantid } locationid: { _eq: $locationid } subcategoryid: { _eq: $subcategoryid } productname: { _ilike: $keyword } } limit: $limit offset: $offset order_by: { productid: desc } ) { productid productname productimage categoryid subcategoryid productunit unitvalue productcost taxpercent taxamount retailprice tenantid locationid opening credit debit closing } } `, variables: `{\n "tenantid": 1079,\n "locationid": 1,\n "subcategoryid": null,\n "keyword": "%",\n "limit": 10,\n "offset": 0\n}`, }, gettenantdeliveries: { query: /* GraphQL */ /* GraphQL */ ` query GetTenantDeliveriesFull( $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": 1079,\n "status": "delivered",\n "fromdate": "2026-01-01T00:00:00",\n "todate": "2026-01-31T23:59:59",\n "keyword": "%",\n "limit": 10,\n "offset": 0\n}`, }, getinvoiceinsight: { query: /* GraphQL */ /* GraphQL */ ` query GetInvoiceInsight($tenantid: bigint!) { invoice_insight(where: { tenantid: { _eq: $tenantid } }) { totalcount total pendingcount pending pendingpercent confirmedcount confirmed confirmedpercent paidcount paid paidpercent overduecount overdue overduepercent } } `, variables: `{\n "tenantid": 1079\n}`, }, getproductscount: { query: /* GraphQL */ /* GraphQL */ ` query GetProductsCount( $tenantid: bigint! $categoryid: bigint! $subcategoryid: bigint! ) { total: products_aggregate( where: { tenantid: { _eq: $tenantid } categoryid: { _eq: $categoryid } subcategoryid: { _eq: $subcategoryid } } ) { aggregate { count } } available: products_aggregate( where: { tenantid: { _eq: $tenantid } categoryid: { _eq: $categoryid } subcategoryid: { _eq: $subcategoryid } productstatus: { _eq: "available" } } ) { aggregate { count } } outofstock: products_aggregate( where: { tenantid: { _eq: $tenantid } categoryid: { _eq: $categoryid } subcategoryid: { _eq: $subcategoryid } productstatus: { _eq: "outofstock" } } ) { aggregate { count } } } `, variables: `{\n "tenantid": 1079,\n "categoryid": 1,\n "subcategoryid": 1\n}`, }, createproduct: { query: /* GraphQL */ /* GraphQL */ ` mutation CreateProduct($object: products_insert_input!) { insert_products_one(object: $object) { productid applocationid tenantid categoryid subcategoryid productname productimage productdesc productsku productbrand productunit unitvalue toppicks productcost taxamount taxpercent producttax productstock productcombo variants quantity retailprice diffprice diffpercent othercost approve productstatus } } `, variables: `{ "object": { "applocationid": 1, "tenantid": 1079, "categoryid": 1, "subcategoryid": 1, "productname": "Sample Product", "productimage": "", "productdesc": "Sample description", "productsku": "SKU123", "productbrand": "BrandX", "productunit": "kg", "unitvalue": 1, "toppicks": false, "productcost": 50, "taxamount": 5, "taxpercent": 10, "producttax": true, "productstock": 100, "productcombo": false, "variants": false, "quantity": 100, "retailprice": 60, "diffprice": 10, "diffpercent": 20, "othercost": 0, "approve": true, "productstatus": "available" } }`, }, getinvoices: { query: /* GraphQL */ /* GraphQL */ ` query GetInvoices($tenantid: bigint!, $billstatus: bigint!) { tenantsales( where: { tenantid: { _eq: $tenantid } billstatus: { _eq: $billstatus } } order_by: { salesid: desc } ) { salesid tenantid totalamount billstatus duedate status } } `, variables: `{ "tenantid": 1079, "billstatus": 1 }`, }, getcustomerlocations: { query: /* GraphQL */ ` query GetCustomerLocations($customerid: bigint!) { customer_locations(where: { customerid: { _eq: $customerid } }) { locationid latitude longitude address } } `, variables: `{\n "customerid": 6060\n}`, }, getcustomerordersv3: { query: /* GraphQL */ ` query GetCustomerOrders($customerid: bigint!, $tenantid: bigint!, $moduleid: bigint!, $fromdate: timestamptz!, $todate: timestamptz!, $orderstatus: String!, $keyword: String, $limit: Int!, $offset: Int!) { orders( where: { customerid: { _eq: $customerid } tenantid: { _eq: $tenantid } moduleid: { _eq: $moduleid } orderstatus: { _eq: $orderstatus } orderdate: { _gte: $fromdate, _lte: $todate } _or: [{ orderid: { _ilike: $keyword } }] } limit: $limit offset: $offset ) { orderid orderstatus orderamount } } `, variables: `{\n "customerid": 6060,\n "tenantid": 1087,\n "moduleid": 2,\n "fromdate": "2026-01-01T00:00:00",\n "todate": "2026-12-31T23:59:59",\n "orderstatus": "delivered",\n "keyword": "%pizza%",\n "limit": 10,\n "offset": 0\n}`, }, getcustomer: { query: /* GraphQL */ ` query GetCustomer($customerid: bigint!) { customers(where: { customerid: { _eq: $customerid } }) { customerid name contactno } } `, variables: `{\n "customerid": 6060\n}`, }, getcustomerrequests: { query: /* GraphQL */ ` query GetCustomerRequests($customerid: bigint!, $limit: Int!, $offset: Int!) { customer_requests(where: { customerid: { _eq: $customerid } }, limit: $limit, offset: $offset) { requestid status } } `, variables: `{\n "customerid": 6060,\n "limit": 10,\n "offset": 0\n}`, }, getmobileproductsubcategories: { query: /* GraphQL */ ` query GetProductSubcategories($categoryid: bigint!) { app_subcategory(where: { categoryid: { _eq: $categoryid } }) { subcategoryid subcategoryname } } `, variables: `{\n "categoryid": 1001\n}`, }, getmobileappcategories: { query: /* GraphQL */ ` query GetAppCategories { app_category { categoryid categoryname } } `, variables: `{}`, }, getmobileproductvariants: { query: /* GraphQL */ ` query GetProductVariants($tenantid: bigint!, $subcategoryid: bigint!) { product_variants(where: { tenantid: { _eq: $tenantid }, subcategoryid: { _eq: $subcategoryid } }) { variantid productname price } } `, variables: `{\n "tenantid": 1087,\n "subcategoryid": 14\n}`, }, gettenantpromotions: { query: /* GraphQL */ ` query GetTenantPromotions($tenantid: bigint!, $locationid: bigint!) { promotions(where: { tenantid: { _eq: $tenantid }, locationid: { _eq: $locationid } }) { promotionid title } } `, variables: `{\n "tenantid": 1087,\n "locationid": 1\n}`, }, getappconfig: { query: /* GraphQL */ ` query GetAppConfig($configid: bigint!) { app_config(where: { configid: { _eq: $configid } }) { configkey configvalue } } `, variables: `{\n "configid": 15\n}`, }, searchcustomers: { query: /* GraphQL */ ` query SearchCustomers($tenantid: bigint!, $keyword: String!) { customers(where: { tenantid: { _eq: $tenantid }, name: { _ilike: $keyword } }) { customerid name } } `, variables: `{\n "tenantid": 1087,\n "keyword": "%john%"\n}`, }, gettenantorders: { query: /* GraphQL */ ` query GetTenantOrders { orders { orderid tenantid } } `, variables: `{}`, }, getstaff: { query: /* GraphQL */ ` query GetStaff($tenantid: bigint!) { staff(where: { tenantid: { _eq: $tenantid } }) { staffid name } } `, variables: `{\n "tenantid": 1087\n}`, }, getmobileapplocations: { query: /* GraphQL */ ` query GetAppLocations { app_location { applocationid locationname } } `, variables: `{}`, }, }; export const GRAPHQL_BASE_URL = 'https://api.workolik.com'; export const graphqlTopics = [ { id: "users", name: "Users", description: "Manage users and roles within the NearleDaily ecosystem.", endpoints: [ { name: "getusers", method: "GET", url: "/api/rest/getusers?roleid=1&tenantid=1079&limit=10&offset=0", description: "Retrieve a list of all users in the system.", }, { name: "getapproles", method: "GET", url: "/api/rest/getapproles?configid=1", description: "Get all application roles based on a specific configuration.", }, ], }, { id: "orders", name: "Orders", description: "Endpoints related to creating, updating, and querying customer orders.", endpoints: [ { name: "getorders", method: "GET", url: "/api/rest/getorders?start=2026-01-01T00:00:00&end=2026-01-31T23:59:59&status=delivered&limit=10&offset=0", description: "Get detailed order information within a time frame.", }, { name: "getordersummary", method: "GET", url: "/api/rest/getordersummary?tenantid=1079&configid=1&fromdate=2025-07-24T00:00:00&todate=2025-07-24T23:59:59", description: "Retrieve high-level summary and aggregated counts for orders.", }, ], }, { id: "tenants", name: "Tenants", description: "Manage tenant details, their customers, and their specific delivery statistics.", endpoints: [ { name: "gettenantinfo", method: "GET", url: "/api/rest/gettenantinfo?tenantid=1079", description: "Get specific information about a tenant by their ID.", }, { name: "gettenantlocations", method: "GET", url: "/api/rest/gettenantlocations?tenantid=1", description: "Get all physical locations linked to a tenant.", }, { name: "getcustomersbytenant", method: "GET", url: "/api/rest/getcustomersbytenant?tenantid=1079&limit=10&offset=0", description: "Retrieve customers associated with a specific tenant.", }, { name: "gettenantcustomers", method: "GET", url: "/api/rest/gettenantcustomers?tenantid=1079&locationid=1&limit=10&offset=0", description: "Get customers under a specific tenant and location combination.", }, { name: "gettenantdeliveries", method: "GET", url: "/api/rest/gettenantdeliveries?tenantid=1079&status=delivered&fromdate=2026-01-01T00:00:00&todate=2026-01-31T23:59:59&keyword=%25&limit=10&offset=0", description: "Query extensive delivery data for a tenant including pickup/delivery info.", }, { name: "getinvoiceinsight", method: "GET", url: "/api/rest/getinvoiceinsight?tenantid=1079", useGraphql: true, description: "Retrieve detailed insights and statistics regarding tenant invoices.", }, { name: "getinvoices", method: "GET", url: "/api/rest/getinvoices?tenantid=1079&billstatus=1", useGraphql: true, description: "Retrieve all invoices for a tenant based on their billing status.", }, ], }, { id: "products", name: "Products", description: "Operations for managing product catalogs, categories, variants, and stock tracking.", endpoints: [ { name: "getproductcategories", method: "GET", url: "/api/rest/getproductcategories?moduleid=6", description: "Get all root product categories for a specific module.", }, { name: "getsubcategory", method: "GET", url: "/api/rest/getsubcategory?moduleid=6&categoryid=1", description: "Get a specific subcategory belonging to a root category.", }, { name: "getproductsubcategories", method: "GET", url: "/api/rest/getproductsubcategories?categoryid=1", description: "List all subcategories under a specific root category.", }, { name: "getproductvariants", method: "GET", url: "/api/rest/getproductvariants?tenantid=1079&subcategoryid=1", description: "Get different variants of products (e.g. sizes, colors) for a tenant.", }, { name: "getstockstatement", method: "GET", url: "/api/rest/getstockstatement?tenantid=1079&locationid=1&subcategoryid=&keyword=%25&limit=10&offset=0", description: "Generate a comprehensive statement of stock including opening, credit, debit, closing balances.", }, { name: "getproductscount", method: "GET", url: "/api/rest/getproductscount?tenantid=1079&categoryid=1&subcategoryid=1", description: "Get aggregated counts of products available and out of stock.", }, { name: "createproduct", method: "POST", url: "/api/rest/createproduct", useGraphql: true, description: "Create a new product within the catalog.", }, ], }, { id: "locations", name: "Apps & Locations", description: "Query configuration endpoints for application locations and active statuses.", endpoints: [ { name: "getapplocations", method: "GET", url: "/api/rest/getapplocations?userid=1", useGraphql: true, description: "Retrieve application location settings for a specific user.", }, { name: "getactivelocationbyid", method: "GET", url: "/api/rest/getapplocations", description: "List all currently active locations globally.", }, { name: "getlocationsconfig", method: "GET", url: "/api/rest/getapplocationconfig", description: "Retrieve the global configuration properties for application locations.", }, { name: "getapptypes", method: "GET", url: "/api/rest/getapptypes?tag=partner", description: "Get specific application types grouped by a tag name.", }, ], }, { id: "partners", name: "Partners", description: "Manage partners, drivers/riders, and their shifts and earnings.", endpoints: [ { name: "getpartners", method: "GET", url: "/api/rest/getpartners?applocationid=1&partnerid=0&limit=10&offset=0", description: "Retrieve a list of active partners associated with locations.", }, { name: "getridershifts", method: "GET", url: "/api/rest/getridershifts?applocationid=1", description: "Get historic and active shift records for riders in a specific location.", }, ], }, { id: "mobile", name: "Mobile", description: "Specific endpoints and GraphQL queries optimized for mobile application integration.", endpoints: [ { name: "getcustomerlocations", method: "GET", url: "/api/rest/getcustomerlocations?customerid=6060", description: "Retrieve physical locations associated with a specific customer.", }, { name: "getcustomerordersv3", method: "GET", url: "/api/rest/getcustomerordersv3?customerid=6060&tenantid=1087&moduleid=2&fromdate=2026-01-01T00:00:00&todate=2026-12-31T23:59:59&orderstatus=delivered&keyword=%25pizza%25&limit=10&offset=0", description: "Fetch comprehensive order history for a customer with advanced filtering.", }, { name: "getcustomer", method: "GET", url: "/api/rest/getcustomer?customerid=6060", description: "Get profile details for a specific customer.", }, { name: "getcustomerrequests", method: "GET", url: "/api/rest/getcustomerrequests?customerid=6060&limit=10&offset=0", description: "List all service requests made by a customer.", }, { name: "getmobileproductsubcategories", method: "GET", url: "/api/rest/getmobileproductsubcategories?categoryid=1001", description: "Retrieve subcategories under a specific product category for mobile display.", }, { name: "getmobileappcategories", method: "GET", url: "/api/rest/getmobileappcategories", description: "Fetch all available application categories.", }, { name: "getmobileproductvariants", method: "GET", url: "/api/rest/getmobileproductvariants?tenantid=1087&subcategoryid=14", description: "Get product variants filtered by tenant and subcategory.", }, { name: "gettenantpromotions", method: "GET", url: "/api/rest/gettenantpromotions?tenantid=1087&locationid=1", description: "Retrieve active promotions for a specific tenant location.", }, { name: "getappconfig", method: "GET", url: "/api/rest/getappconfig?configid=15", description: "Retrieve specific application configuration settings.", }, { name: "searchcustomers", method: "GET", url: "/api/rest/searchcustomers?tenantid=1087&keyword=%25john%25", description: "Search for customers by name within a tenant's scope.", }, { name: "gettenantorders", method: "GET", url: "/api/rest/gettenantorders", description: "List orders across tenants (Admin level).", }, { name: "getstaff", method: "GET", url: "/api/rest/getstaff?tenantid=1087", description: "Retrieve staff members associated with a specific tenant.", }, { name: "gettenantinfo", method: "GET", url: "/api/rest/gettenantinfo?tenantid=1079", description: "Get basic information about a tenant.", }, { name: "gettenantlocations", method: "GET", url: "/api/rest/gettenantlocations?tenantid=1", description: "Fetch all locations for a given tenant.", }, { name: "getmobileapplocations", method: "GET", url: "/api/rest/getmobileapplocations", description: "Retrieve all application-wide locations.", }, { name: "getsubcategory", method: "GET", url: "/api/rest/getsubcategory?moduleid=6&categoryid=1", description: "Get detailed subcategory info.", }, { name: "getpartners", method: "GET", url: "/api/rest/getpartners?applocationid=1&partnerid=44&limit=10&offset=0", description: "Retrieve partner details for mobile integration.", }, { name: "getlocationsconfig", method: "GET", url: "/api/rest/getlocationsconfig", useGraphql: true, description: "Get location configuration settings.", }, ], }, ];