File size: 385 Bytes
61b383a
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;