From 20ec04379d5af0a6f871ecd83a9f942f18773323 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 13 Feb 2026 15:20:06 -0600 Subject: [PATCH] fix: update gaiia graphql queries for account status/type schema change Gaiia API changed AccountStatus and AccountType from scalar enums to objects with id/name/type subfields. Updated the accounts query to request nested fields and the sync mapper to extract the name values. --- lib/towerops/gaiia/client.ex | 11 +++++++++-- lib/towerops/gaiia/sync.ex | 4 ++-- test/towerops/gaiia/sync_test.exs | 4 ++-- test/towerops/workers/gaiia_sync_worker_test.exs | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/towerops/gaiia/client.ex b/lib/towerops/gaiia/client.ex index f7539054..2eca59e2 100644 --- a/lib/towerops/gaiia/client.ex +++ b/lib/towerops/gaiia/client.ex @@ -18,8 +18,15 @@ defmodule Towerops.Gaiia.Client do id readableId name - status - type + status { + id + name + type + } + type { + id + name + } physicalAddress { line1 locality diff --git a/lib/towerops/gaiia/sync.ex b/lib/towerops/gaiia/sync.ex index 185c79db..6a9c6993 100644 --- a/lib/towerops/gaiia/sync.ex +++ b/lib/towerops/gaiia/sync.ex @@ -85,8 +85,8 @@ defmodule Towerops.Gaiia.Sync do gaiia_id: node["id"], readable_id: node["readableId"], name: node["name"], - status: node["status"], - account_type: node["type"], + status: get_in(node, ["status", "name"]), + account_type: get_in(node, ["type", "name"]), address: map_address(node["physicalAddress"]), subscription_count: active_count, raw_data: node diff --git a/test/towerops/gaiia/sync_test.exs b/test/towerops/gaiia/sync_test.exs index bc06e2c2..ab60260b 100644 --- a/test/towerops/gaiia/sync_test.exs +++ b/test/towerops/gaiia/sync_test.exs @@ -138,8 +138,8 @@ defmodule Towerops.Gaiia.SyncTest do "id" => "acct-1", "readableId" => "1001", "name" => "Alice Smith", - "status" => "Active", - "type" => "Residential", + "status" => %{"id" => "status-1", "name" => "Active", "type" => "ACTIVE"}, + "type" => %{"id" => "type-1", "name" => "Residential"}, "physicalAddress" => %{ "line1" => "123 Main St", "locality" => "Portland", diff --git a/test/towerops/workers/gaiia_sync_worker_test.exs b/test/towerops/workers/gaiia_sync_worker_test.exs index 66aa0467..96b923d7 100644 --- a/test/towerops/workers/gaiia_sync_worker_test.exs +++ b/test/towerops/workers/gaiia_sync_worker_test.exs @@ -62,7 +62,8 @@ defmodule Towerops.Workers.GaiiaSyncWorkerTest do "node" => %{ "id" => "acct-1", "name" => "Test Account", - "status" => "Active", + "status" => %{"id" => "status-1", "name" => "Active", "type" => "ACTIVE"}, + "type" => %{"id" => "type-1", "name" => "Residential"}, "billingSubscriptions" => %{"edges" => []} } }