Spaces:
Sleeping
Sleeping
const db = require('../database'); | |
const ApiKey = { | |
create: (userId, key, callback) => { | |
const sql = `INSERT INTO api_keys (user_id, api_key) VALUES (?, ?)`; | |
db.query(sql, [userId, key], callback); | |
}, | |
findByUserId: (userId, callback) => { | |
db.query('SELECT * FROM api_keys WHERE user_id = ?', [userId], callback); | |
} | |
}; | |
module.exports = ApiKey; | |