feat: add admin dashboard and core API routes with Docker configuration
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '../../../../../lib/prisma'
|
||||
import { getAuthUser } from '@/lib/auth-utils'
|
||||
|
||||
// POST /api/messages/[id]/report — Report a message for moderation
|
||||
export async function POST(
|
||||
@@ -7,14 +8,16 @@ export async function POST(
|
||||
context: { params: Promise<{ id: string }> }
|
||||
): Promise<Response> {
|
||||
try {
|
||||
const userId = request.headers.get('x-user-id')
|
||||
const authUser = await getAuthUser(request)
|
||||
const { id } = await context.params
|
||||
const { reason } = await request.json()
|
||||
|
||||
if (!userId) {
|
||||
if (!authUser) {
|
||||
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
|
||||
}
|
||||
|
||||
const userId = authUser.id
|
||||
|
||||
// Verify message exists
|
||||
const message = await prisma.message.findUnique({
|
||||
where: { id }
|
||||
|
||||
Reference in New Issue
Block a user