-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathdebug-sql.js
More file actions
28 lines (26 loc) · 736 Bytes
/
debug-sql.js
File metadata and controls
28 lines (26 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const db = require('./src/utils/database');
const { createApiKey } = require('./src/models/apiKeys');
async function debug() {
try {
process.env.NODE_ENV = 'test'; // Ensure test env
await db.run('DELETE FROM api_keys');
const result = await createApiKey({
keyPrefix: 'test_',
name: 'Test Key',
role: 'admin',
createdBy: 'test_user',
metadata: { source: 'test' },
scopes: ['read', 'write'],
expiresAt: Date.now() + 86400000
});
console.log('SUCCESS:', result);
} catch (err) {
console.error('FAILURE ERROR:', err);
if (err.originalError) {
console.error('ORIGINAL SQL ERROR:', err.originalError);
}
} finally {
await db.close();
}
}
debug();