19 lines
638 B
TypeScript
19 lines
638 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
import { kpiService } from '@/lib/database'
|
|
|
|
// POST - 更新 KPI 進度
|
|
export async function POST(
|
|
request: NextRequest,
|
|
{ params }: { params: { id: string } }
|
|
) {
|
|
try {
|
|
const body = await request.json()
|
|
const { progress, comment, blockers, userId } = body
|
|
|
|
await kpiService.updateKPIProgress(params.id, progress, comment, blockers, userId)
|
|
return NextResponse.json({ message: '進度更新成功' })
|
|
} catch (error) {
|
|
console.error('更新進度失敗:', error)
|
|
return NextResponse.json({ error: '更新進度失敗' }, { status: 500 })
|
|
}
|
|
}
|