fix(icons): picker does not allow multiple words (#1827)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { count, like } from "@homarr/db";
|
import { and, count, like } from "@homarr/db";
|
||||||
import { icons } from "@homarr/db/schema";
|
import { icons } from "@homarr/db/schema";
|
||||||
import { validation } from "@homarr/validation";
|
import { validation } from "@homarr/validation";
|
||||||
|
|
||||||
@@ -15,7 +15,11 @@ export const iconsRouter = createTRPCRouter({
|
|||||||
name: true,
|
name: true,
|
||||||
url: 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,
|
limit: input.limitPerGroup,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user