fix: all 7 GraphQL queries — correct field names and LINKS/PHONES subfields

Leads: landingPage → { primaryLinkUrl }, remove duplicateOfLeadId
Ads: adFormat → format, destinationUrl/previewUrl → { primaryLinkUrl }
FollowUps: remove non-existent callId field
LeadActivities: durationSeconds → durationSec
All transforms updated to match query changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-19 16:53:40 +05:30
parent 941b51731f
commit f341433c8f
2 changed files with 15 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
// GraphQL queries for platform entities
// Platform remaps some SDK field names — queries use platform names
// Platform remaps SDK field names — all LINKS/PHONES fields need subfield selection
export const LEADS_QUERY = `{ leads(first: 100, orderBy: [{ createdAt: DescNullsLast }]) { edges { node {
id name createdAt updatedAt
@@ -7,8 +7,8 @@ export const LEADS_QUERY = `{ leads(first: 100, orderBy: [{ createdAt: DescNulls
contactPhone { primaryPhoneNumber primaryPhoneCallingCode }
contactEmail { primaryEmail }
source status priority interestedService assignedAgent
utmSource utmMedium utmCampaign utmContent utmTerm landingPage referrerUrl
leadScore spamScore isSpam isDuplicate duplicateOfLeadId
utmSource utmMedium utmCampaign utmContent utmTerm landingPage { primaryLinkUrl } referrerUrl
leadScore spamScore isSpam isDuplicate
firstContacted lastContacted contactAttempts convertedAt
patientId campaignId
aiSummary aiSuggestedAction
@@ -26,8 +26,8 @@ export const CAMPAIGNS_QUERY = `{ campaigns(first: 50, orderBy: [{ createdAt: De
export const ADS_QUERY = `{ ads(first: 100, orderBy: [{ createdAt: DescNullsLast }]) { edges { node {
id name createdAt updatedAt
adName externalAdId status adFormat
headline adDescription destinationUrl previewUrl
adName externalAdId status format
headline adDescription destinationUrl { primaryLinkUrl } previewUrl { primaryLinkUrl }
impressions clicks conversions
spend { amountMicros currencyCode }
campaignId
@@ -37,14 +37,14 @@ export const FOLLOW_UPS_QUERY = `{ followUps(first: 50, orderBy: [{ scheduledAt:
id name createdAt
typeCustom status scheduledAt completedAt
priority assignedAgent
patientId callId
patientId
} } } }`;
export const LEAD_ACTIVITIES_QUERY = `{ leadActivities(first: 200, orderBy: [{ occurredAt: DescNullsLast }]) { edges { node {
id name createdAt
activityType summary occurredAt performedBy
previousValue newValue
channel durationSeconds outcome
channel durationSec outcome
leadId
} } } }`;