From 6aab1baa2b785f0f85bc2a3e3a5007a6bebfd80a Mon Sep 17 00:00:00 2001 From: nigiri <168690269+0xnigir1@users.noreply.github.com> Date: Tue, 17 Dec 2024 19:09:01 -0300 Subject: [PATCH] fix: filtering query params --- .../repositories/kysely/strategyRegistry.repository.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/repository/src/repositories/kysely/strategyRegistry.repository.ts b/packages/repository/src/repositories/kysely/strategyRegistry.repository.ts index a251f42..2b1b011 100644 --- a/packages/repository/src/repositories/kysely/strategyRegistry.repository.ts +++ b/packages/repository/src/repositories/kysely/strategyRegistry.repository.ts @@ -37,16 +37,16 @@ export class KyselyStrategyRegistryRepository implements IStrategyRegistryReposi /** @inheritdoc */ async getStrategies(filters?: { handled?: boolean; chainId?: ChainId }): Promise { - 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(); } }