Corrected type and fixed build errors

This commit is contained in:
Ben Borla
2024-12-09 14:51:07 +08:00
parent c5a2c0f446
commit ef0123d889
2 changed files with 5 additions and 4 deletions

View File

@@ -44,7 +44,7 @@ const MYSQL_DB = process.env.MYSQL_DB || "";
const pool = mysql.createPool({
connectionLimit: 10,
host: MYSQL_HOST,
port: MYSQL_PORT,
port: Number(MYSQL_PORT),
user: MYSQL_USER,
password: MYSQL_PASS,
database: MYSQL_DB,
@@ -54,7 +54,7 @@ const SCHEMA_PATH = "schema";
server.setRequestHandler(ListResourcesRequestSchema, async () => {
return new Promise((resolve, reject) => {
pool.query<TableRow[]>(
pool.query(
"SELECT table_name FROM information_schema.tables WHERE table_schema = DATABASE()",
(error: MySQLErrorType, results: TableRow[]) => {
if (error) reject(error);
@@ -85,7 +85,7 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
}
return new Promise((resolve, reject) => {
pool.query<ColumnRow[]>(
pool.query(
"SELECT column_name, data_type FROM information_schema.columns WHERE table_name = ?",
[tableName],
(error: MySQLErrorType, results: ColumnRow[]) => {

View File

@@ -23,7 +23,8 @@
"mysql": "^2.18.1"
},
"devDependencies": {
"@types/pg": "^8.11.10",
"@types/node": "^20.10.0",
"@types/mysql": "^2.15.26",
"shx": "^0.3.4",
"typescript": "^5.6.2"
}