修復 too many connection 問題

This commit is contained in:
2025-09-21 02:46:16 +08:00
parent a36ab3c98d
commit 808d5bb52c
36 changed files with 5582 additions and 249 deletions

View File

@@ -0,0 +1,37 @@
// =====================================================
// 獲取競賽詳情 API
// =====================================================
import { NextRequest, NextResponse } from 'next/server';
import { CompetitionService } from '@/lib/services/database-service';
export async function GET(request: NextRequest, { params }: { params: { id: string } }) {
try {
const { id } = await params;
// 獲取競賽詳情
const competition = await CompetitionService.getCompetitionById(id);
if (!competition) {
return NextResponse.json({
success: false,
message: '競賽不存在',
error: '找不到指定的競賽'
}, { status: 404 });
}
return NextResponse.json({
success: true,
message: '競賽詳情獲取成功',
data: competition
});
} catch (error) {
console.error('獲取競賽詳情失敗:', error);
return NextResponse.json({
success: false,
message: '獲取競賽詳情失敗',
error: error instanceof Error ? error.message : '未知錯誤'
}, { status: 500 });
}
}