Merge pull request #1766 from automatisch/AUT-705
refactor: rewrite useStepWithTestExecutions with RQ
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
import { ref } from 'objection';
|
||||
import ExecutionStep from '../../models/execution-step.js';
|
||||
import Step from '../../models/step.js';
|
||||
|
||||
const getStepWithTestExecutions = async (_parent, params, context) => {
|
||||
const conditions = context.currentUser.can('update', 'Flow');
|
||||
const userSteps = context.currentUser.$relatedQuery('steps');
|
||||
const allSteps = Step.query();
|
||||
const stepBaseQuery = conditions.isCreator ? userSteps : allSteps;
|
||||
|
||||
const step = await stepBaseQuery
|
||||
.clone()
|
||||
.findOne({ 'steps.id': params.stepId })
|
||||
.throwIfNotFound();
|
||||
|
||||
const previousStepsWithCurrentStep = await stepBaseQuery
|
||||
.clone()
|
||||
.withGraphJoined('executionSteps')
|
||||
.where('flow_id', '=', step.flowId)
|
||||
.andWhere('position', '<', step.position)
|
||||
.andWhere(
|
||||
'executionSteps.created_at',
|
||||
'=',
|
||||
ExecutionStep.query()
|
||||
.max('created_at')
|
||||
.where('step_id', '=', ref('steps.id'))
|
||||
.andWhere('status', 'success')
|
||||
)
|
||||
.orderBy('steps.position', 'asc');
|
||||
|
||||
return previousStepsWithCurrentStep;
|
||||
};
|
||||
|
||||
export default getStepWithTestExecutions;
|
@@ -1,14 +1,12 @@
|
||||
import getAppAuthClient from './queries/get-app-auth-client.ee.js';
|
||||
import getConnectedApps from './queries/get-connected-apps.js';
|
||||
import getDynamicData from './queries/get-dynamic-data.js';
|
||||
import getStepWithTestExecutions from './queries/get-step-with-test-executions.js';
|
||||
import testConnection from './queries/test-connection.js';
|
||||
|
||||
const queryResolvers = {
|
||||
getAppAuthClient,
|
||||
getConnectedApps,
|
||||
getDynamicData,
|
||||
getStepWithTestExecutions,
|
||||
testConnection,
|
||||
};
|
||||
|
||||
|
@@ -2,7 +2,6 @@ type Query {
|
||||
getAppAuthClient(id: String!): AppAuthClient
|
||||
getConnectedApps(name: String): [App]
|
||||
testConnection(id: String!): Connection
|
||||
getStepWithTestExecutions(stepId: String!): [Step]
|
||||
getDynamicData(
|
||||
stepId: String!
|
||||
key: String!
|
||||
|
Reference in New Issue
Block a user