First commit of the new Insider version on docker
This commit is contained in:
28
controllers/paramController.js
Normal file
28
controllers/paramController.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
};
|
||||
Reference in New Issue
Block a user