Files
automatisch/packages/backend/src/graphql/queries/get-executions.ts
2022-08-07 14:50:16 +02:00

27 lines
528 B
TypeScript

import Context from '../../types/express/context';
import paginate from '../../helpers/pagination';
type Params = {
limit: number;
offset: number;
};
const getExecutions = async (
_parent: unknown,
params: Params,
context: Context
) => {
const executions = context.currentUser
.$relatedQuery('executions')
.withGraphFetched({
flow: {
steps: true
}
})
.orderBy('created_at', 'desc');
return paginate(executions, params.limit, params.offset);
};
export default getExecutions;