feat: add admin dashboard and core API routes with Docker configuration
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import prisma from '@/lib/prisma'
|
||||
import { getAuthUser } from '@/lib/auth-utils'
|
||||
|
||||
// GET /api/businesses/me — Fetch business for the current user
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
const userId = request.headers.get('x-user-id')
|
||||
const authUser = await getAuthUser(request)
|
||||
|
||||
if (!userId) {
|
||||
if (!authUser) {
|
||||
return NextResponse.json({ error: 'Utilisateur non identifié' }, { status: 401 })
|
||||
}
|
||||
|
||||
const business = await prisma.business.findFirst({
|
||||
where: { ownerId: userId },
|
||||
where: { ownerId: authUser.id },
|
||||
include: { offers: true }
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user