Skip to content

Commit 1b2d948

Browse files
authored
Merge pull request #561 from code0-tech/query-for-flow
Add query for a specific flow and for all flows in a project
2 parents e516182 + 3d106ff commit 1b2d948

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-0
lines changed

app/graphql/types/namespace_project_type.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,27 @@ class NamespaceProjectType < Types::BaseObject
77
authorize :read_namespace_project
88

99
field :description, String, null: false, description: 'Description of the project'
10+
1011
field :name, String, null: false, description: 'Name of the project'
12+
1113
field :runtimes, Types::RuntimeType.connection_type, null: false, description: 'Runtimes assigned to this project'
1214

1315
field :namespace, Types::NamespaceType, null: false,
1416
description: 'The namespace where this project belongs to'
17+
1518
field :primary_runtime, Types::RuntimeType, null: true, description: 'The primary runtime for the project'
1619

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'
22+
end
23+
24+
field :flows, Types::FlowType.connection_type, null: true, description: 'Fetches all flows in this project'
25+
1726
id_field NamespaceProject
1827
timestamps
28+
29+
def flow(id:)
30+
object.flows.find(id: id)
31+
end
1932
end
2033
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: FlowConnection
3+
---
4+
5+
The connection type for Flow.
6+
7+
## Fields without arguments
8+
9+
| Name | Type | Description |
10+
|------|------|-------------|
11+
| `count` | [`Int!`](../scalar/int.md) | Total count of collection. |
12+
| `edges` | [`[FlowEdge]`](../object/flowedge.md) | A list of edges. |
13+
| `nodes` | [`[Flow]`](../object/flow.md) | A list of nodes. |
14+
| `pageInfo` | [`PageInfo!`](../object/pageinfo.md) | Information to aid in pagination. |
15+

docs/graphql/object/flowedge.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: FlowEdge
3+
---
4+
5+
An edge in a connection.
6+
7+
## Fields without arguments
8+
9+
| Name | Type | Description |
10+
|------|------|-------------|
11+
| `cursor` | [`String!`](../scalar/string.md) | A cursor for use in pagination. |
12+
| `node` | [`Flow`](../object/flow.md) | The item at the end of the edge. |
13+

docs/graphql/object/namespaceproject.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,22 @@ Represents a namespace project
1010
|------|------|-------------|
1111
| `createdAt` | [`Time!`](../scalar/time.md) | Time when this NamespaceProject was created |
1212
| `description` | [`String!`](../scalar/string.md) | Description of the project |
13+
| `flows` | [`FlowConnection`](../object/flowconnection.md) | Fetches all flows in this project |
1314
| `id` | [`NamespaceProjectID!`](../scalar/namespaceprojectid.md) | Global ID of this NamespaceProject |
1415
| `name` | [`String!`](../scalar/string.md) | Name of the project |
1516
| `namespace` | [`Namespace!`](../object/namespace.md) | The namespace where this project belongs to |
1617
| `primaryRuntime` | [`Runtime`](../object/runtime.md) | The primary runtime for the project |
1718
| `runtimes` | [`RuntimeConnection!`](../object/runtimeconnection.md) | Runtimes assigned to this project |
1819
| `updatedAt` | [`Time!`](../scalar/time.md) | Time when this NamespaceProject was last updated |
1920

21+
## Fields with arguments
22+
23+
### flow
24+
25+
Fetches an flow given by its ID
26+
27+
Returns [`Flow`](../object/flow.md).
28+
29+
| Name | Type | Description |
30+
|------|------|-------------|
31+
| `id` | [`FlowID!`](../scalar/flowid.md) | Id of the flow |

spec/graphql/types/namespace_project_type_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
namespace
1212
primary_runtime
1313
runtimes
14+
flows
15+
flow
1416
created_at
1517
updated_at
1618
]

0 commit comments

Comments
 (0)