mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-21 20:18:11 +02:00
fix(google-docs): search all drives in doc picker, log result count
This commit is contained in:
parent
b35bd8fe2e
commit
112bf461c9
1 changed files with 9 additions and 2 deletions
|
|
@ -190,14 +190,21 @@ export async function listGoogleDocs(query?: string): Promise<{ files: GoogleDoc
|
||||||
if (trimmed) {
|
if (trimmed) {
|
||||||
clauses.push(`name contains '${escapeDriveQueryValue(trimmed)}'`);
|
clauses.push(`name contains '${escapeDriveQueryValue(trimmed)}'`);
|
||||||
}
|
}
|
||||||
|
const q = clauses.join(' and ');
|
||||||
const result = await driveClient.files.list({
|
const result = await driveClient.files.list({
|
||||||
q: clauses.join(' and '),
|
q,
|
||||||
pageSize: 25,
|
pageSize: 25,
|
||||||
orderBy: 'modifiedTime desc',
|
orderBy: 'modifiedTime desc',
|
||||||
fields: 'files(id,name,webViewLink,modifiedTime,owners(displayName,emailAddress))',
|
fields: 'files(id,name,webViewLink,modifiedTime,owners(displayName,emailAddress))',
|
||||||
|
// Also surface docs in shared drives and "Shared with me", not just My Drive.
|
||||||
|
corpora: 'allDrives',
|
||||||
|
includeItemsFromAllDrives: true,
|
||||||
|
supportsAllDrives: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
return { files: (result.data.files ?? []).map(toGoogleDocListItem).filter((file) => file.id) };
|
const files = (result.data.files ?? []).map(toGoogleDocListItem).filter((file) => file.id);
|
||||||
|
console.log(`[GoogleDocs] list q="${q}" → ${files.length} doc(s)`);
|
||||||
|
return { files };
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Import a Google Doc as a local .docx and register the link. */
|
/** Import a Google Doc as a local .docx and register the link. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue