Files
Atlas/app/api/locations/route.ts
2025-11-12 20:21:32 +01:00

24 lines
503 B
TypeScript

import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
export async function GET() {
try {
const locations = await prisma.location.findMany({
where: {
active: true,
},
orderBy: {
name: 'asc',
},
});
return NextResponse.json({ locations });
} catch (error) {
console.error('Locations fetch error:', error);
return NextResponse.json(
{ error: 'Internal server error' },
{ status: 500 }
);
}
}