update hasDocs to use new pattern

This commit is contained in:
Jason Jacobs 2024-03-14 13:39:38 -07:00
parent e8d126c6ee
commit ed602f06f6

View file

@ -142,11 +142,7 @@ export async function listDocs(): Promise<
}
export async function hasDoc(baseUrl: string) {
const db = await open({
filename: getDocsSqlitePath(),
driver: sqlite3.Database,
});
await createDocsTable(db);
const db = await getDBDocs();
const doc = await db.get(`SELECT title FROM docs WHERE baseUrl =?`, baseUrl);
return!!doc;
}