16 lines
500 B
TypeScript
16 lines
500 B
TypeScript
|
|
import { NextResponse } from 'next/server';
|
||
|
|
|
||
|
|
import { withAuth } from '@/lib/api/helpers';
|
||
|
|
import { getBerthOptions } from '@/lib/services/berths.service';
|
||
|
|
import { errorResponse } from '@/lib/errors';
|
||
|
|
|
||
|
|
// GET /api/v1/berths/options — lightweight list for selects/comboboxes
|
||
|
|
export const GET = withAuth(async (req, ctx) => {
|
||
|
|
try {
|
||
|
|
const options = await getBerthOptions(ctx.portId);
|
||
|
|
return NextResponse.json({ data: options });
|
||
|
|
} catch (error) {
|
||
|
|
return errorResponse(error);
|
||
|
|
}
|
||
|
|
});
|