added vendors table

This commit is contained in:
2026-01-27 12:23:59 -05:00
parent ecd7182153
commit 3aa9b6f325
20 changed files with 1058 additions and 5 deletions

24
app/api/vendors/fetch/route.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
import { NextRequest, NextResponse } from 'next/server'
import { prisma } from '@/lib/prisma'
export async function GET(request: NextRequest) {
try {
const vendors = await prisma.vendor.findMany({
include: {
address: true,
},
orderBy: {
createdAt: 'desc',
},
})
return NextResponse.json(vendors)
} catch (error) {
console.error('Error fetching vendors:', error)
return NextResponse.json(
{ error: 'Failed to fetch vendors' },
{ status: 500 }
)
}
}