完成評審評分機制
This commit is contained in:
34
app/api/admin/scoring/summary/route.ts
Normal file
34
app/api/admin/scoring/summary/route.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { ScoringService } from '@/lib/services/database-service';
|
||||
|
||||
// 獲取評分完成度匯總
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const competitionId = searchParams.get('competitionId');
|
||||
|
||||
if (!competitionId) {
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: '缺少競賽ID參數'
|
||||
}, { status: 400 });
|
||||
}
|
||||
|
||||
// 獲取評分完成度匯總數據
|
||||
const summary = await ScoringService.getScoringSummary(competitionId);
|
||||
|
||||
return NextResponse.json({
|
||||
success: true,
|
||||
message: '評分完成度匯總獲取成功',
|
||||
data: summary
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('獲取評分完成度匯總失敗:', error);
|
||||
return NextResponse.json({
|
||||
success: false,
|
||||
message: '獲取評分完成度匯總失敗',
|
||||
error: error instanceof Error ? error.message : '未知錯誤'
|
||||
}, { status: 500 });
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user