feat: Implement getExecutionSteps query

This commit is contained in:
Faruk AYDIN
2022-03-11 14:24:25 +03:00
committed by Ömer Faruk Aydın
parent 44623cc384
commit bf8adb286a
3 changed files with 43 additions and 0 deletions

View 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;