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;
|
Reference in New Issue
Block a user