Skip to content

Commit 3d106ff

Browse files
committed
Reorder some parts in NamespaceProjectType
1 parent 124f7f6 commit 3d106ff

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

app/graphql/types/namespace_project_type.rb

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ module Types
44
class NamespaceProjectType < Types::BaseObject
55
description 'Represents a namespace project'
66

7-
field :flow, Types::FlowType, null: true, description: 'Fetches an flow given by its ID' do
8-
argument :id, Types::GlobalIdType[::Flow], required: true, description: 'Id of the flow'
9-
end
7+
authorize :read_namespace_project
108

119
field :description, String, null: false, description: 'Description of the project'
1210

@@ -19,21 +17,17 @@ class NamespaceProjectType < Types::BaseObject
1917

2018
field :primary_runtime, Types::RuntimeType, null: true, description: 'The primary runtime for the project'
2119

22-
field :flows, Types::FlowType.connection_type, null: true, description: 'Fetches all flows in this project'
23-
24-
def flows
25-
project = context.schema.object_from_id(id, context)
26-
27-
project.flows
28-
end
29-
30-
def flow(id:)
31-
context.schema.object_from_id(id, context).flows.find(id: id)
20+
field :flow, Types::FlowType, null: true, description: 'Fetches an flow given by its ID' do
21+
argument :id, Types::GlobalIdType[::Flow], required: true, description: 'Id of the flow'
3222
end
3323

34-
authorize :read_namespace_project
24+
field :flows, Types::FlowType.connection_type, null: true, description: 'Fetches all flows in this project'
3525

3626
id_field NamespaceProject
3727
timestamps
28+
29+
def flow(id:)
30+
object.flows.find(id: id)
31+
end
3832
end
3933
end

0 commit comments

Comments
 (0)