Add BMAD framework, authentication, and new features
This commit is contained in:
@@ -13,11 +13,12 @@ function parseNote(dbNote: any) {
|
||||
// GET /api/notes/[id] - Get a single note
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
const { id } = await params
|
||||
const note = await prisma.note.findUnique({
|
||||
where: { id: params.id }
|
||||
where: { id }
|
||||
})
|
||||
|
||||
if (!note) {
|
||||
@@ -43,9 +44,10 @@ export async function GET(
|
||||
// PUT /api/notes/[id] - Update a note
|
||||
export async function PUT(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
const { id } = await params
|
||||
const body = await request.json()
|
||||
const updateData: any = { ...body }
|
||||
|
||||
@@ -59,7 +61,7 @@ export async function PUT(
|
||||
updateData.updatedAt = new Date()
|
||||
|
||||
const note = await prisma.note.update({
|
||||
where: { id: params.id },
|
||||
where: { id },
|
||||
data: updateData
|
||||
})
|
||||
|
||||
@@ -79,11 +81,12 @@ export async function PUT(
|
||||
// DELETE /api/notes/[id] - Delete a note
|
||||
export async function DELETE(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { id: string } }
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
try {
|
||||
const { id } = await params
|
||||
await prisma.note.delete({
|
||||
where: { id: params.id }
|
||||
where: { id }
|
||||
})
|
||||
|
||||
return NextResponse.json({
|
||||
|
||||
Reference in New Issue
Block a user