Skip to content

Commit 8bf0714

Browse files
committed
Make graphql types more like their real types
1 parent f151471 commit 8bf0714

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

app/graphql/types/application_type.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22

33
module Types
44
class ApplicationType < Types::BaseObject
5-
description 'Represents the application with different fields '
5+
description 'Represents the application instance'
66

77
field :metadata, Types::MetadataType, null: false,
88
description: 'Metadata about the application'
99

1010
field :settings, Types::ApplicationSettingsType, null: true,
1111
description: 'Global application settings'
12+
13+
def metadata
14+
{}
15+
end
16+
17+
def settings
18+
ApplicationSetting.current
19+
end
1220
end
1321
end

app/graphql/types/metadata_type.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,13 @@ class MetadataType < Types::BaseObject
66

77
field :extensions, [GraphQL::Types::String], null: false, description: 'List of loaded extensions'
88
field :version, GraphQL::Types::String, null: false, description: 'Application version'
9+
10+
def extensions
11+
Sagittarius::Extensions.active
12+
end
13+
14+
def version
15+
Sagittarius::Version
16+
end
917
end
1018
end

app/graphql/types/query_type.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ def nodes(ids:)
6666
end
6767

6868
def application
69-
{
70-
settings: ApplicationSetting.current,
71-
metadata: {
72-
version: Sagittarius::Version,
73-
extensions: Sagittarius::Extensions.active.map(&:to_s),
74-
},
75-
}
69+
{}
7670
end
7771

7872
def echo(message:)

docs/graphql/object/application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Application
33
---
44

5-
Represents the application with different fields
5+
Represents the application instance
66

77
## Fields without arguments
88

0 commit comments

Comments
 (0)