Skip to content

Commit

Permalink
Fix validation for 'offset' and 'limit'
Browse files Browse the repository at this point in the history
  • Loading branch information
manelcecs committed Mar 13, 2024
1 parent bfc0124 commit 41fb83b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/domain-services/flows/flow-search-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,9 @@ export class FlowSearchService {
}
}

args.flowObjectFilters = flowObjectFilters;
// default limit to increase performance
args.limit = 5000;
// Do the first search
const flowSearchResponse = await this.search(
models,
Expand All @@ -870,7 +873,6 @@ export class FlowSearchService {
databaseConnection,
nextArgs
);

flows.push(...nextFlowSearchResponse.flows);

hasNextPage = nextFlowSearchResponse.hasNextPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export class SearchFlowByFiltersStrategy implements FlowSearchStrategy {

// Then we are going to slice the flows using the limit and offset
let reducedFlows: UniqueFlowEntity[];
if (offset && limit) {
if (offset !== undefined && limit !== undefined) {
reducedFlows = sortedFlows.slice(offset, offset + limit);
} else {
reducedFlows = sortedFlows;
Expand Down

0 comments on commit 41fb83b

Please sign in to comment.