From 6e21863d04f7d0598e7e7ca3fb707f9beb09d7ef Mon Sep 17 00:00:00 2001 From: Meier Lukas Date: Thu, 2 Jan 2025 14:52:38 +0100 Subject: [PATCH] fix(icons): picker does not allow multiple words (#1827) --- packages/api/src/router/icons.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/api/src/router/icons.ts b/packages/api/src/router/icons.ts index 2128e25ad..9a273336d 100644 --- a/packages/api/src/router/icons.ts +++ b/packages/api/src/router/icons.ts @@ -1,4 +1,4 @@ -import { count, like } from "@homarr/db"; +import { and, count, like } from "@homarr/db"; import { icons } from "@homarr/db/schema"; import { validation } from "@homarr/validation"; @@ -15,7 +15,11 @@ export const iconsRouter = createTRPCRouter({ name: true, url: true, }, - where: (input.searchText?.length ?? 0) > 0 ? like(icons.name, `%${input.searchText}%`) : undefined, + where: + (input.searchText?.length ?? 0) > 0 + ? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + and(...input.searchText!.split(" ").map((keyword) => like(icons.name, `%${keyword}%`))) + : undefined, limit: input.limitPerGroup, }, },