15 lines
481 B
TypeScript
15 lines
481 B
TypeScript
|
|
import { NextResponse } from 'next/server';
|
||
|
|
|
||
|
|
import { type RouteHandler } from '@/lib/api/helpers';
|
||
|
|
import { errorResponse } from '@/lib/errors';
|
||
|
|
import { listOwnershipHistory } from '@/lib/services/yachts.service';
|
||
|
|
|
||
|
|
export const historyHandler: RouteHandler = async (_req, ctx, params) => {
|
||
|
|
try {
|
||
|
|
const history = await listOwnershipHistory(params.id!, ctx.portId);
|
||
|
|
return NextResponse.json({ data: history });
|
||
|
|
} catch (error) {
|
||
|
|
return errorResponse(error);
|
||
|
|
}
|
||
|
|
};
|