feat: implement business and user CRUD API endpoints with authentication utilities and update feature documentation
All checks were successful
Build and Push App / build (push) Successful in 5m46s

This commit is contained in:
2026-04-30 23:05:04 +02:00
parent 81b068e5c9
commit 4e881bcbe6
5 changed files with 167 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '@/lib/prisma'
import { USER_SAFE_SELECT } from '@/lib/auth-utils'
type Params = { params: Promise<{ id: string }> }
@@ -17,7 +18,12 @@ export async function GET(
{ slug: id }
]
},
include: { owner: true, offers: true },
include: {
owner: {
select: USER_SAFE_SELECT
},
offers: true
},
})
if (!business) return NextResponse.json({ error: 'Non trouvé' }, { status: 404 })
return NextResponse.json(business)
@@ -38,7 +44,12 @@ export async function PATCH(
const business = await prisma.business.update({
where: { id },
data: body,
include: { owner: true, offers: true },
include: {
owner: {
select: USER_SAFE_SELECT
},
offers: true
},
})
return NextResponse.json(business)
} catch (error) {