Initial commit

This commit is contained in:
2026-08-24 22:20:36 +02:00
commit 62f7b1278a
251 changed files with 16670 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
const logger = require("./winston");
const mysql = require("mysql2/promise");
require("dotenv").config({ path: ".env" });
db = mysql.createPool({
host: process.env.MYSQL_HOST,
port: process.env.MYSQL_PORT,
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
database: process.env.MYSQL_DATABASE,
enableKeepAlive: true,
waitForConnections: true,
connectionLimit: 20,
queueLimit: 0
});
async function query(sql, params = []) {
try {
const [rows] = await db.query(sql, params);
return {
success: true,
data: rows
};
} catch (error) {
logger.error(error);
return {
success: false,
error
};
};
};
async function execute(sql, params = []) {
try {
const [rows] = await db.execute(sql, params);
return {
success: true,
data: rows
};
} catch (error) {
logger.error(error);
return {
success: false,
error
};
};
};
global.query = query;
global.execute = execute;