Skip to content

Commit

Permalink
chore: refactor .prepare to .exec where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-shuman committed Sep 6, 2024
1 parent a4c09b6 commit 8251a36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/lib/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function recreateDb(): BetterSqlite3.Database {

const db = BetterSqlite3('data/local.sqlite');

db.prepare(
return db.exec(
`
CREATE TABLE IF NOT EXISTS articles (
id INTEGER PRIMARY KEY AUTOINCREMENT,
Expand All @@ -35,9 +35,7 @@ export function recreateDb(): BetterSqlite3.Database {
favicon TEXT
)
`
).run();

return db;
);
}

export function generateFeed(items: FeedItem[]): Feed {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/articles/clear/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const POST: RequestHandler = async ({ request }) => {
return new Response(undefined, { status: 401, statusText: 'Missing bearer token' });
}

recreateDb().prepare('DROP TABLE articles').run();
recreateDb().exec('DROP TABLE articles');
recreateDb();

return new Response(undefined, {
Expand Down

0 comments on commit 8251a36

Please sign in to comment.