feat: Implement getExecutionSteps query
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
44623cc384
commit
bf8adb286a
27
packages/backend/src/graphql/queries/get-execution-steps.ts
Normal file
27
packages/backend/src/graphql/queries/get-execution-steps.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import Context from '../../types/express/context';
|
||||
import paginate from '../../helpers/pagination';
|
||||
|
||||
type Params = {
|
||||
executionId: string;
|
||||
limit: number;
|
||||
offset: number;
|
||||
};
|
||||
|
||||
const getExecutionSteps = async (
|
||||
_parent: unknown,
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
const execution = await context.currentUser
|
||||
.$relatedQuery('executions')
|
||||
.findById(params.executionId)
|
||||
.throwIfNotFound();
|
||||
|
||||
const executionSteps = execution
|
||||
.$relatedQuery('executionSteps')
|
||||
.orderBy('created_at', 'desc');
|
||||
|
||||
return paginate(executionSteps, params.limit, params.offset);
|
||||
};
|
||||
|
||||
export default getExecutionSteps;
|
@@ -7,6 +7,7 @@ import getFlow from './queries/get-flow';
|
||||
import getFlows from './queries/get-flows';
|
||||
import getStepWithTestExecutions from './queries/get-step-with-test-executions';
|
||||
import getExecutions from './queries/get-executions';
|
||||
import getExecutionSteps from './queries/get-execution-steps';
|
||||
|
||||
const queryResolvers = {
|
||||
getApps,
|
||||
@@ -18,6 +19,7 @@ const queryResolvers = {
|
||||
getFlows,
|
||||
getStepWithTestExecutions,
|
||||
getExecutions,
|
||||
getExecutionSteps,
|
||||
};
|
||||
|
||||
export default queryResolvers;
|
||||
|
@@ -8,6 +8,11 @@ type Query {
|
||||
getFlows: [Flow]
|
||||
getStepWithTestExecutions(stepId: String!): [Step]
|
||||
getExecutions(limit: Int!, offset: Int!): ExecutionConnection
|
||||
getExecutionSteps(
|
||||
executionId: String!
|
||||
limit: Int!
|
||||
offset: Int!
|
||||
): ExecutionStepConnection
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
@@ -363,11 +368,20 @@ type ExecutionEdge {
|
||||
node: Execution
|
||||
}
|
||||
|
||||
type ExecutionStepEdge {
|
||||
node: ExecutionStep
|
||||
}
|
||||
|
||||
type ExecutionConnection {
|
||||
edges: [ExecutionEdge]
|
||||
pageInfo: PageInfo
|
||||
}
|
||||
|
||||
type ExecutionStepConnection {
|
||||
edges: [ExecutionStepEdge]
|
||||
pageInfo: PageInfo
|
||||
}
|
||||
|
||||
schema {
|
||||
query: Query
|
||||
mutation: Mutation
|
||||
|
Reference in New Issue
Block a user