feat(queries/get-executions): add flowId filter support
This commit is contained in:
@@ -3,9 +3,14 @@ import Context from '../../types/express/context';
|
||||
import Execution from '../../models/execution';
|
||||
import paginate from '../../helpers/pagination';
|
||||
|
||||
type Filters = {
|
||||
flowId?: string;
|
||||
}
|
||||
|
||||
type Params = {
|
||||
limit: number;
|
||||
offset: number;
|
||||
filters?: Filters;
|
||||
};
|
||||
|
||||
const getExecutions = async (
|
||||
@@ -41,6 +46,10 @@ const getExecutions = async (
|
||||
.groupBy('executions.id')
|
||||
.orderBy('updated_at', 'desc');
|
||||
|
||||
if (params.filters?.flowId) {
|
||||
executions.where('flow_id', params.filters.flowId);
|
||||
}
|
||||
|
||||
return paginate(executions, params.limit, params.offset);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user