實作題目管理與資料庫整合

This commit is contained in:
2025-09-29 18:44:29 +08:00
parent 29b3c97e6b
commit ac03ff36be
6 changed files with 644 additions and 51 deletions

View File

@@ -0,0 +1,19 @@
import { NextResponse } from "next/server"
import { getAllCreativeQuestions } from "@/lib/database/models/creative_question"
export async function GET() {
try {
const questions = await getAllCreativeQuestions()
return NextResponse.json({
success: true,
data: questions
})
} catch (error) {
console.error("獲取創意題目失敗:", error)
return NextResponse.json(
{ success: false, message: "獲取創意題目失敗" },
{ status: 500 }
)
}
}

View File

@@ -0,0 +1,19 @@
import { NextResponse } from "next/server"
import { getAllLogicQuestions } from "@/lib/database/models/logic_question"
export async function GET() {
try {
const questions = await getAllLogicQuestions()
return NextResponse.json({
success: true,
data: questions
})
} catch (error) {
console.error("獲取邏輯題目失敗:", error)
return NextResponse.json(
{ success: false, message: "獲取邏輯題目失敗" },
{ status: 500 }
)
}
}