feat: add global search

This commit is contained in:
haritabh-z01 2025-09-17 23:47:59 +05:30
parent f325def068
commit f4ecb62b93
8 changed files with 310 additions and 76 deletions

View file

@ -101,4 +101,25 @@ export const notesRouter = createRouter({
}
return { success: true };
}),
// Search notes (for command palette)
searchNotes: procedure
.input(
z.object({
query: z.string().optional().default(""),
limit: z.number().optional().default(10),
}),
)
.query(async ({ input }) => {
const notes = await notesService.listNotes({
search: input.query || "",
limit: input.limit,
});
return notes.map((note) => ({
id: note.id,
title: note.title,
createdAt: note.createdAt,
icon: note.icon || "file-text",
}));
}),
});