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.
This commit is contained in:
Graham McIntire 2026-02-13 15:20:06 -06:00
parent 872bef3512
commit 20ec04379d
No known key found for this signature in database
4 changed files with 15 additions and 7 deletions

View file

@ -18,8 +18,15 @@ defmodule Towerops.Gaiia.Client do
id
readableId
name
status
type
status {
id
name
type
}
type {
id
name
}
physicalAddress {
line1
locality

View file

@ -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

View file

@ -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",

View file

@ -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" => []}
}
}