diff options
author | Phil Hughes <me@iamphill.com> | 2019-06-04 14:38:18 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2019-06-05 08:46:32 +0100 |
commit | 4644a2daf5ec5e86e2b2989f04e99e4f081f6fef (patch) | |
tree | 40c9376ce43f2c2b9d964fb67b1c35cfb0077773 /app/graphql | |
parent | df549eb28c83b27500619ccb14c201a4ff87daa3 (diff) | |
download | gitlab-ce-4644a2daf5ec5e86e2b2989f04e99e4f081f6fef.tar.gz |
Add web_url to tree entry in GraphQL API
Diffstat (limited to 'app/graphql')
-rw-r--r-- | app/graphql/types/tree/blob_type.rb | 4 | ||||
-rw-r--r-- | app/graphql/types/tree/tree_entry_type.rb | 4 | ||||
-rw-r--r-- | app/graphql/types/tree/tree_type.rb | 10 |
3 files changed, 16 insertions, 2 deletions
diff --git a/app/graphql/types/tree/blob_type.rb b/app/graphql/types/tree/blob_type.rb index 230624201b0..f2b7d5df2b2 100644 --- a/app/graphql/types/tree/blob_type.rb +++ b/app/graphql/types/tree/blob_type.rb @@ -4,7 +4,11 @@ module Types class BlobType < BaseObject implements Types::Tree::EntryType + present_using BlobPresenter + graphql_name 'Blob' + + field :web_url, GraphQL::STRING_TYPE, null: true end end end diff --git a/app/graphql/types/tree/tree_entry_type.rb b/app/graphql/types/tree/tree_entry_type.rb index d5cfb898aea..23ec2ef0ec2 100644 --- a/app/graphql/types/tree/tree_entry_type.rb +++ b/app/graphql/types/tree/tree_entry_type.rb @@ -4,8 +4,12 @@ module Types class TreeEntryType < BaseObject implements Types::Tree::EntryType + present_using TreeEntryPresenter + graphql_name 'TreeEntry' description 'Represents a directory' + + field :web_url, GraphQL::STRING_TYPE, null: true end end end diff --git a/app/graphql/types/tree/tree_type.rb b/app/graphql/types/tree/tree_type.rb index 1eb6c43972e..1ee93ed9542 100644 --- a/app/graphql/types/tree/tree_type.rb +++ b/app/graphql/types/tree/tree_type.rb @@ -4,9 +4,15 @@ module Types class TreeType < BaseObject graphql_name 'Tree' - field :trees, Types::Tree::TreeEntryType.connection_type, null: false + field :trees, Types::Tree::TreeEntryType.connection_type, null: false, resolve: -> (obj, args, ctx) do + Gitlab::Graphql::Representation::TreeEntry.decorate(obj.trees, obj.repository) + end + field :submodules, Types::Tree::SubmoduleType.connection_type, null: false - field :blobs, Types::Tree::BlobType.connection_type, null: false + + field :blobs, Types::Tree::BlobType.connection_type, null: false, resolve: -> (obj, args, ctx) do + Gitlab::Graphql::Representation::TreeEntry.decorate(obj.blobs, obj.repository) + end end end end |