From a3e4add213840810696dca100a60dc61020b9082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 20 Feb 2026 15:01:38 +0100 Subject: [PATCH] remove some unnecessary noise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../applyPredicateEntityFilterToQuery.ts | 45 +------------------ 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/plugins/catalog-backend/src/service/request/applyPredicateEntityFilterToQuery.ts b/plugins/catalog-backend/src/service/request/applyPredicateEntityFilterToQuery.ts index b42252369d..d376b132ff 100644 --- a/plugins/catalog-backend/src/service/request/applyPredicateEntityFilterToQuery.ts +++ b/plugins/catalog-backend/src/service/request/applyPredicateEntityFilterToQuery.ts @@ -35,45 +35,6 @@ function isObject(value: unknown): value is Record { return typeof value === 'object' && value !== null && !Array.isArray(value); } -/** - * example generated query - * Selects all non-null final entities that: - * - * - Are of kind "component" - * - Have spec.type = "service" - * - Are owned by either: - * - backend-team - * - platform-team - * - Are NOT in experimental lifecycle - * - * Results are ordered by entity_ref in ascending order. - * - * SQL Reference: - * ``` - * SELECT final_entities.* - * FROM final_entities - * WHERE final_entities.final_entity IS NOT NULL - * AND final_entities.entity_id IN ( - * SELECT entity_id FROM search WHERE key = 'kind' AND value = 'component' - * ) - * AND final_entities.entity_id IN ( - * SELECT entity_id FROM search WHERE key = 'spec.type' AND value = 'service' - * ) - * AND ( - * final_entities.entity_id IN ( - * SELECT entity_id FROM search WHERE key = 'spec.owner' AND value = 'backend-team' - * ) - * OR - * final_entities.entity_id IN ( - * SELECT entity_id FROM search WHERE key = 'spec.owner' AND value = 'platform-team' - * ) - * ) - * AND final_entities.entity_id NOT IN ( - * SELECT entity_id FROM search WHERE key = 'spec.lifecycle' AND value = 'experimental' - * ) - * ORDER BY final_entities.entity_ref ASC; - * ``` - */ export function applyPredicateEntityFilterToQuery(options: { filter: FilterPredicate; targetQuery: Knex.QueryBuilder; @@ -190,9 +151,7 @@ function applyFieldCondition(options: { } if ('$in' in value) { - const values = (value.$in as FilterPredicatePrimitive[]).map(v => - String(v).toLocaleLowerCase('en-US'), - ); + const values = value.$in.map(v => String(v).toLocaleLowerCase('en-US')); const matchQuery = knex('search') .select('search.entity_id') .where({ key }) @@ -201,7 +160,7 @@ function applyFieldCondition(options: { } if ('$hasPrefix' in value) { - const prefix = (value.$hasPrefix as string).toLocaleLowerCase('en-US'); + const prefix = value.$hasPrefix.toLocaleLowerCase('en-US'); const escaped = prefix.replace(/[%_\\]/g, c => `\\${c}`); const matchQuery = knex('search') .select('search.entity_id')