Skip to content

Commit

Permalink
fix: filtering query params
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnigir1 committed Dec 17, 2024
1 parent eb7e1c3 commit 6aab1ba
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ export class KyselyStrategyRegistryRepository implements IStrategyRegistryReposi

/** @inheritdoc */
async getStrategies(filters?: { handled?: boolean; chainId?: ChainId }): Promise<Strategy[]> {
const query = this.db.withSchema(this.schemaName).selectFrom("strategies");
let query = this.db.withSchema(this.schemaName).selectFrom("strategies").selectAll();

if (filters?.chainId) {
query.where("chainId", "=", filters.chainId);
query = query.where("chainId", "=", filters.chainId);
}

if (filters?.handled) {
query.where("handled", "=", filters.handled);
if (filters?.handled !== undefined && filters?.handled !== null) {
query = query.where("handled", "=", filters.handled);
}

return query.selectAll().execute();
return query.execute();
}
}

0 comments on commit 6aab1ba

Please sign in to comment.