feat: implement home page, business directory, and administrative management features with updated schema and API routes
Some checks failed
Build and Push App / build (push) Failing after 51s
Some checks failed
Build and Push App / build (push) Failing after 51s
This commit is contained in:
14
app/api/categories/route.ts
Normal file
14
app/api/categories/route.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const categories = await prisma.businessCategory.findMany({
|
||||
where: { isActive: true },
|
||||
orderBy: { name: 'asc' }
|
||||
});
|
||||
return NextResponse.json(categories);
|
||||
} catch (error) {
|
||||
return NextResponse.json({ error: 'Failed to fetch categories' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user