12 lines
549 B
TypeScript
12 lines
549 B
TypeScript
// ?q= searches title and text with Baserow's search. Baserow only searches (and filters) the fields a request
|
|
// includes, so a search has to include `content` even though the list only needs the summary.
|
|
export default defineEventHandler(async (event) => {
|
|
const q = String(getQuery(event).q ?? '').trim()
|
|
const query = q
|
|
? { include: `${NOTES_SUMMARY_FIELDS},content`, search: q }
|
|
: { include: NOTES_SUMMARY_FIELDS }
|
|
|
|
const rows = await listRows<NotesDocRow>(event, notesTable(event), query)
|
|
return rows.map(toNotesDocSummary)
|
|
})
|