| 1 | import { NextRequest, NextResponse } from 'next/server'; |
| 2 | import { listTasks, createTask } from '@/lib/db'; |
| 3 | |
| 4 | export const runtime = 'nodejs'; |
| 5 | export const dynamic = 'force-dynamic'; |
| 6 | |
| 7 | export async function GET() { |
| 8 | return NextResponse.json({ tasks: listTasks() }); |
| 9 | } |
| 10 | |
| 11 | export async function POST(req: NextRequest) { |
| 12 | const { title, status, assignedModel, channelId } = await req.json(); |
| 13 | if (!title) return NextResponse.json({ error: 'title required' }, { status: 400 }); |
| 14 | return NextResponse.json({ task: createTask(String(title), { status, assignedModel, channelId }) }); |
| 15 | } |