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 getFlows from './queries/get-flows';
|
||||||
import getStepWithTestExecutions from './queries/get-step-with-test-executions';
|
import getStepWithTestExecutions from './queries/get-step-with-test-executions';
|
||||||
import getExecutions from './queries/get-executions';
|
import getExecutions from './queries/get-executions';
|
||||||
|
import getExecutionSteps from './queries/get-execution-steps';
|
||||||
|
|
||||||
const queryResolvers = {
|
const queryResolvers = {
|
||||||
getApps,
|
getApps,
|
||||||
@@ -18,6 +19,7 @@ const queryResolvers = {
|
|||||||
getFlows,
|
getFlows,
|
||||||
getStepWithTestExecutions,
|
getStepWithTestExecutions,
|
||||||
getExecutions,
|
getExecutions,
|
||||||
|
getExecutionSteps,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default queryResolvers;
|
export default queryResolvers;
|
||||||
|
@@ -8,6 +8,11 @@ type Query {
|
|||||||
getFlows: [Flow]
|
getFlows: [Flow]
|
||||||
getStepWithTestExecutions(stepId: String!): [Step]
|
getStepWithTestExecutions(stepId: String!): [Step]
|
||||||
getExecutions(limit: Int!, offset: Int!): ExecutionConnection
|
getExecutions(limit: Int!, offset: Int!): ExecutionConnection
|
||||||
|
getExecutionSteps(
|
||||||
|
executionId: String!
|
||||||
|
limit: Int!
|
||||||
|
offset: Int!
|
||||||
|
): ExecutionStepConnection
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
@@ -363,11 +368,20 @@ type ExecutionEdge {
|
|||||||
node: Execution
|
node: Execution
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExecutionStepEdge {
|
||||||
|
node: ExecutionStep
|
||||||
|
}
|
||||||
|
|
||||||
type ExecutionConnection {
|
type ExecutionConnection {
|
||||||
edges: [ExecutionEdge]
|
edges: [ExecutionEdge]
|
||||||
pageInfo: PageInfo
|
pageInfo: PageInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ExecutionStepConnection {
|
||||||
|
edges: [ExecutionStepEdge]
|
||||||
|
pageInfo: PageInfo
|
||||||
|
}
|
||||||
|
|
||||||
schema {
|
schema {
|
||||||
query: Query
|
query: Query
|
||||||
mutation: Mutation
|
mutation: Mutation
|
||||||
|
Reference in New Issue
Block a user