29 lines
586 B
JavaScript
29 lines
586 B
JavaScript
const mysql = require('mysql2/promise');
|
|
const pool = require('../config/database');
|
|
|
|
async function getParams() {
|
|
const connection = await pool.getConnection();
|
|
try {
|
|
const [rows] = await connection.execute('SELECT * FROM cdn');
|
|
return {
|
|
users: rows[0].users,
|
|
};
|
|
} finally {
|
|
connection.release();
|
|
}
|
|
}
|
|
|
|
async function updateParams(params) {
|
|
const connection = await pool.getConnection();
|
|
try {
|
|
await connection.execute('UPDATE cdn SET ?', [params]);
|
|
} finally {
|
|
connection.release();
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
getParams,
|
|
updateParams
|
|
};
|