feat(api): yacht detail, patch, archive, transfer, history, autocomplete

This commit is contained in:
Matt Ciaccio
2026-04-24 12:40:51 +02:00
parent a5036c6358
commit 90463269ce
6 changed files with 472 additions and 0 deletions

View File

@@ -318,6 +318,17 @@ export async function listYachtsForOwner(
});
}
// ─── Ownership history ────────────────────────────────────────────────────────
export async function listOwnershipHistory(yachtId: string, portId: string) {
// First scope-check the yacht (throws NotFoundError if cross-tenant)
await getYachtById(yachtId, portId);
return await db.query.yachtOwnershipHistory.findMany({
where: eq(yachtOwnershipHistory.yachtId, yachtId),
orderBy: (t, { desc }) => [desc(t.startDate)],
});
}
// ─── Autocomplete ─────────────────────────────────────────────────────────────
export async function autocomplete(portId: string, q: string) {