Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GraphQL world index details type #3040

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions app/graphql/types/world_index_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ class WorldLocation < Types::BaseObject
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
end

field :body, String
field :international_delegations, [WorldLocation], null: false
field :world_locations, [WorldLocation], null: false

def international_delegations
object.details[:international_delegations]
class WorldIndexDetails < BaseObject
field :body, String
field :international_delegations, [WorldLocation], null: false
field :world_locations, [WorldLocation], null: false
end

def world_locations
object.details[:world_locations]
end
field :details, WorldIndexDetails
end
end
54 changes: 29 additions & 25 deletions spec/integration/graphql/world_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@
... on WorldIndex {
title

worldLocations {
...worldLocationInfo
}
details {
worldLocations {
...worldLocationInfo
}

internationalDelegations {
...worldLocationInfo
internationalDelegations {
...worldLocationInfo
}
}
}
}
Expand All @@ -67,26 +69,28 @@
data: {
edition: {
title: "Help and services around the world",
worldLocations: [
{
active: true,
analyticsIdentifier: "WL1",
contentId: "d3b7ba48-5027-4a98-a594-1108d205dc66",
name: "Test World Location",
slug: "test-world-location",
updatedAt: "2024-10-18T14:22:38+01:00",
},
],
internationalDelegations: [
{
active: false,
analyticsIdentifier: "WL2",
contentId: "f0313f16-e25c-4bfe-a0fc-e561833f705f",
name: "Test International Delegation",
slug: "test-international-delegation",
updatedAt: "2024-10-19T15:07:44+01:00",
},
],
details: {
worldLocations: [
{
active: true,
analyticsIdentifier: "WL1",
contentId: "d3b7ba48-5027-4a98-a594-1108d205dc66",
name: "Test World Location",
slug: "test-world-location",
updatedAt: "2024-10-18T14:22:38+01:00",
},
],
internationalDelegations: [
{
active: false,
analyticsIdentifier: "WL2",
contentId: "f0313f16-e25c-4bfe-a0fc-e561833f705f",
name: "Test International Delegation",
slug: "test-international-delegation",
updatedAt: "2024-10-19T15:07:44+01:00",
},
],
},
},
},
}
Expand Down
Loading