* chore(deps): update dependency eslint to v9 * chore: migrate eslint to v9 * fix: dependency issues * fix: unit tests not working * chore: disable lint check for Image component that does not work in ci * fix: lint issue --------- Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
27 lines
841 B
TypeScript
27 lines
841 B
TypeScript
import { count, like } from "@homarr/db";
|
|
import { icons } from "@homarr/db/schema/sqlite";
|
|
import { validation } from "@homarr/validation";
|
|
|
|
import { createTRPCRouter, publicProcedure } from "../trpc";
|
|
|
|
export const iconsRouter = createTRPCRouter({
|
|
findIcons: publicProcedure.input(validation.icons.findIcons).query(async ({ ctx, input }) => {
|
|
return {
|
|
icons: await ctx.db.query.iconRepositories.findMany({
|
|
with: {
|
|
icons: {
|
|
columns: {
|
|
id: true,
|
|
name: true,
|
|
url: true,
|
|
},
|
|
where: (input.searchText?.length ?? 0) > 0 ? like(icons.name, `%${input.searchText}%`) : undefined,
|
|
limit: 5,
|
|
},
|
|
},
|
|
}),
|
|
countIcons: (await ctx.db.select({ count: count() }).from(icons))[0]?.count ?? 0,
|
|
};
|
|
}),
|
|
});
|