修正資料即時呈現

This commit is contained in:
2025-10-07 11:46:05 +08:00
parent 01bc5e57f6
commit 4482f6c3c7
13 changed files with 573 additions and 283 deletions

View File

@@ -1,6 +1,5 @@
import { NextRequest, NextResponse } from 'next/server'
import { PrismaClient } from '@prisma/client'
import { execSync } from 'child_process'
const prisma = new PrismaClient()
@@ -48,16 +47,6 @@ export async function POST(request: NextRequest) {
updated_at: wish.updatedAt.toISOString()
}
// 創建成功後,更新數據文件
try {
console.log('🔄 更新數據文件...')
execSync('node scripts/get-real-data.js', { stdio: 'pipe' })
console.log('✅ 數據文件更新完成')
} catch (updateError) {
console.warn('⚠️ 數據文件更新失敗:', updateError)
// 不影響創建結果,只是警告
}
return NextResponse.json({ success: true, data: formattedWish })
} catch (error) {
console.error('API Error:', error)