feat: add global search
This commit is contained in:
parent
f325def068
commit
f4ecb62b93
8 changed files with 310 additions and 76 deletions
|
|
@ -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",
|
||||
}));
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue