major changes to docker and npm config

This commit is contained in:
2026-10-26 16:29:17 +01:00
parent 929ec5ef10
commit 9c17b2a495
85 changed files with 3146 additions and 2871 deletions
+32
View File
@@ -0,0 +1,32 @@
import mysql from "mysql2";
import dotenv from "dotenv";
dotenv.config();
const pool = mysql
.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: process.env.DB_NAME,
})
.promise();
export const verifyAPIKeyDB = async (apiKey) => {
const [result] = await pool.query(
"SELECT * FROM apiKeys WHERE api_key = ?;",
[apiKey]
);
if (result.length > 0) {
const [lastUsed] = await pool.query(
"UPDATE apiKeys SET last_used_at = NOW() WHERE api_key = ?;",
[apiKey]
);
if (lastUsed.affectedRows > 0) {
return { valid: true };
} else {
return { valid: false };
}
} else {
return { valid: false };
}
};