Skip to content

Commit cb4fd79

Browse files
authored
fix: replace getDatabase with better-sqlite3 db in getGithubTokenById (#501)
1 parent 3950c0e commit cb4fd79

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

server/routes/projects.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,11 @@ router.post('/create-workspace', async (req, res) => {
311311
* Helper function to get GitHub token from database
312312
*/
313313
async function getGithubTokenById(tokenId, userId) {
314-
const { getDatabase } = await import('../database/db.js');
315-
const db = await getDatabase();
314+
const { db } = await import('../database/db.js');
316315

317-
const credential = await db.get(
318-
'SELECT * FROM user_credentials WHERE id = ? AND user_id = ? AND credential_type = ? AND is_active = 1',
319-
[tokenId, userId, 'github_token']
320-
);
316+
const credential = db.prepare(
317+
'SELECT * FROM user_credentials WHERE id = ? AND user_id = ? AND credential_type = ? AND is_active = 1'
318+
).get(tokenId, userId, 'github_token');
321319

322320
// Return in the expected format (github_token field for compatibility)
323321
if (credential) {

0 commit comments

Comments
 (0)