refactor: rewrite get execution steps using useExecutionSteps with RQ
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import paginate from '../../helpers/pagination.js';
|
||||
import Execution from '../../models/execution.js';
|
||||
|
||||
const getExecutionSteps = async (_parent, params, context) => {
|
||||
const conditions = context.currentUser.can('read', 'Execution');
|
||||
const userExecutions = context.currentUser.$relatedQuery('executions');
|
||||
const allExecutions = Execution.query();
|
||||
const executionBaseQuery = conditions.isCreator
|
||||
? userExecutions
|
||||
: allExecutions;
|
||||
|
||||
const execution = await executionBaseQuery
|
||||
.clone()
|
||||
.withSoftDeleted()
|
||||
.findById(params.executionId)
|
||||
.throwIfNotFound();
|
||||
|
||||
const executionSteps = execution
|
||||
.$relatedQuery('executionSteps')
|
||||
.withSoftDeleted()
|
||||
.withGraphFetched('step')
|
||||
.orderBy('created_at', 'asc');
|
||||
|
||||
return paginate(executionSteps, params.limit, params.offset);
|
||||
};
|
||||
|
||||
export default getExecutionSteps;
|
@@ -8,7 +8,6 @@ import getCurrentUser from './queries/get-current-user.js';
|
||||
import getDynamicData from './queries/get-dynamic-data.js';
|
||||
import getDynamicFields from './queries/get-dynamic-fields.js';
|
||||
import getExecution from './queries/get-execution.js';
|
||||
import getExecutionSteps from './queries/get-execution-steps.js';
|
||||
import getExecutions from './queries/get-executions.js';
|
||||
import getFlow from './queries/get-flow.js';
|
||||
import getFlows from './queries/get-flows.js';
|
||||
@@ -42,7 +41,6 @@ const queryResolvers = {
|
||||
getDynamicFields,
|
||||
getExecution,
|
||||
getExecutions,
|
||||
getExecutionSteps,
|
||||
getFlow,
|
||||
getFlows,
|
||||
getInvoices,
|
||||
|
@@ -19,11 +19,6 @@ type Query {
|
||||
offset: Int!
|
||||
filters: ExecutionFiltersInput
|
||||
): ExecutionConnection
|
||||
getExecutionSteps(
|
||||
executionId: String!
|
||||
limit: Int!
|
||||
offset: Int!
|
||||
): ExecutionStepConnection
|
||||
getDynamicData(
|
||||
stepId: String!
|
||||
key: String!
|
||||
|
Reference in New Issue
Block a user