feat: Implement pagination logic and use with getExecutions query
This commit is contained in:

committed by
Ömer Faruk Aydın

parent
906a8d0644
commit
44623cc384
@@ -1,16 +1,22 @@
|
||||
import Context from '../../types/express/context';
|
||||
import paginate from '../../helpers/pagination';
|
||||
|
||||
type Params = {
|
||||
limit: number;
|
||||
offset: number;
|
||||
};
|
||||
|
||||
const getExecutions = async (
|
||||
_parent: unknown,
|
||||
_params: unknown,
|
||||
params: Params,
|
||||
context: Context
|
||||
) => {
|
||||
const executions = await context.currentUser
|
||||
const executions = context.currentUser
|
||||
.$relatedQuery('executions')
|
||||
.withGraphFetched('flow')
|
||||
.orderBy('created_at', 'asc');
|
||||
.orderBy('created_at', 'desc');
|
||||
|
||||
return executions;
|
||||
return paginate(executions, params.limit, params.offset);
|
||||
};
|
||||
|
||||
export default getExecutions;
|
||||
|
Reference in New Issue
Block a user