實作得獎資訊功能、完成作品預覽/文件上傳功能

This commit is contained in:
2025-09-25 23:48:37 +08:00
parent cc92540952
commit 9bed168238
3 changed files with 234 additions and 0 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: Promise<{ id: string }> }) {
try {
const { id: competitionId } = await params;
if (!competitionId) {
return NextResponse.json({
success: false,
message: '缺少競賽ID參數'
}, { status: 400 });
}
// 獲取競賽的參賽應用
const apps = await CompetitionService.getCompetitionApps(competitionId);
return NextResponse.json({
success: true,
message: '參賽應用獲取成功',
data: apps
});
} catch (error) {
console.error('獲取參賽應用失敗:', error);
return NextResponse.json({
success: false,
message: '獲取參賽應用失敗',
error: error instanceof Error ? error.message : '未知錯誤'
}, { status: 500 });
}
}