新增競賽前台呈現、刪除競賽、修改競賽狀態

This commit is contained in:
2025-09-16 14:57:40 +08:00
parent 1f2fb14bd0
commit b4386dc481
21 changed files with 1714 additions and 127 deletions

View File

@@ -323,7 +323,9 @@ class DatabaseFailover {
async query(sql, params) {
const connection = await this.getConnection();
try {
const [rows] = await connection.execute(sql, params);
// 將 undefined 值轉換為 null避免 MySQL 驅動錯誤
const sanitizedParams = params ? params.map(param => param === undefined ? null : param) : [];
const [rows] = await connection.execute(sql, sanitizedParams);
return rows;
}
finally {
@@ -345,7 +347,9 @@ class DatabaseFailover {
async insert(sql, params) {
const connection = await this.getConnection();
try {
const [result] = await connection.execute(sql, params);
// 將 undefined 值轉換為 null避免 MySQL 驅動錯誤
const sanitizedParams = params ? params.map(param => param === undefined ? null : param) : [];
const [result] = await connection.execute(sql, sanitizedParams);
return result;
}
finally {
@@ -356,7 +360,9 @@ class DatabaseFailover {
async update(sql, params) {
const connection = await this.getConnection();
try {
const [result] = await connection.execute(sql, params);
// 將 undefined 值轉換為 null避免 MySQL 驅動錯誤
const sanitizedParams = params ? params.map(param => param === undefined ? null : param) : [];
const [result] = await connection.execute(sql, sanitizedParams);
return result;
}
finally {
@@ -367,7 +373,9 @@ class DatabaseFailover {
async delete(sql, params) {
const connection = await this.getConnection();
try {
const [result] = await connection.execute(sql, params);
// 將 undefined 值轉換為 null避免 MySQL 驅動錯誤
const sanitizedParams = params ? params.map(param => param === undefined ? null : param) : [];
const [result] = await connection.execute(sql, sanitizedParams);
return result;
}
finally {