feat(yachts): createYacht + getYachtById services with tests

This commit is contained in:
Matt Ciaccio
2026-04-23 23:40:56 +02:00
parent 27d438929b
commit 2f2ad4452f
3 changed files with 310 additions and 24 deletions

View File

@@ -1,9 +1,19 @@
// Server → Client events
export interface ServerToClientEvents {
// Berth events
'berth:statusChanged': (payload: { berthId: string; oldStatus?: string; newStatus: string; triggeredBy: string; trigger?: string }) => void;
'berth:statusChanged': (payload: {
berthId: string;
oldStatus?: string;
newStatus: string;
triggeredBy: string;
trigger?: string;
}) => void;
'berth:updated': (payload: { berthId: string; changedFields: string[] }) => void;
'berth:waitingListChanged': (payload: { berthId: string; action: string; entry: unknown }) => void;
'berth:waitingListChanged': (payload: {
berthId: string;
action: string;
entry: unknown;
}) => void;
'berth:maintenanceAdded': (payload: { berthId: string; logEntry: unknown }) => void;
// Client events
@@ -12,58 +22,159 @@ export interface ServerToClientEvents {
'client:archived': (payload: { clientId: string }) => void;
'client:restored': (payload: { clientId: string }) => void;
'client:merged': (payload: { survivingId: string; mergedId: string }) => void;
'client:noteAdded': (payload: { clientId: string; noteId: string; authorName: string; preview: string }) => void;
'client:duplicateDetected': (payload: { clientAId: string; clientBId: string; score: number; reason: string }) => void;
'client:noteAdded': (payload: {
clientId: string;
noteId: string;
authorName: string;
preview: string;
}) => void;
'client:duplicateDetected': (payload: {
clientAId: string;
clientBId: string;
score: number;
reason: string;
}) => void;
// Interest events
'interest:created': (payload: { interestId: string; clientId: string; berthId: string | null; source: string }) => void;
'interest:created': (payload: {
interestId: string;
clientId: string;
berthId: string | null;
source: string;
}) => void;
'interest:updated': (payload: { interestId: string; changedFields: string[] }) => void;
'interest:stageChanged': (payload: { interestId: string; oldStage: string; newStage: string; clientName: string; berthNumber: string }) => void;
'interest:stageChanged': (payload: {
interestId: string;
oldStage: string;
newStage: string;
clientName: string;
berthNumber: string;
}) => void;
'interest:berthLinked': (payload: { interestId: string; berthId: string }) => void;
'interest:berthUnlinked': (payload: { interestId: string; berthId: string }) => void;
'interest:archived': (payload: { interestId: string }) => void;
'interest:noteAdded': (payload: { interestId: string; noteId: string; authorName: string; preview: string }) => void;
'interest:recommendationsGenerated': (payload: { interestId: string; count: number; topBerthId: string }) => void;
'interest:recommendationAdded': (payload: { interestId: string; berthId: string; source: string; matchScore: number }) => void;
'interest:leadCategoryChanged': (payload: { interestId: string; oldCategory: string; newCategory: string; auto: boolean }) => void;
'interest:noteAdded': (payload: {
interestId: string;
noteId: string;
authorName: string;
preview: string;
}) => void;
'interest:recommendationsGenerated': (payload: {
interestId: string;
count: number;
topBerthId: string;
}) => void;
'interest:recommendationAdded': (payload: {
interestId: string;
berthId: string;
source: string;
matchScore: number;
}) => void;
'interest:leadCategoryChanged': (payload: {
interestId: string;
oldCategory: string;
newCategory: string;
auto: boolean;
}) => void;
// Yacht events
'yacht:created': (payload: { yachtId: string }) => void;
// Document events
'document:created': (payload: { documentId: string; type?: string; interestId?: string }) => void;
'document:updated': (payload: { documentId: string; changedFields?: string[] }) => void;
'document:deleted': (payload: { documentId: string }) => void;
'document:sent': (payload: { documentId: string; type?: string; signerCount?: number; documensoId?: string }) => void;
'document:signed': (payload: { documentId: string; signerName: string; signerRole: string; remainingSigners: number }) => void;
'document:signer:signed': (payload: { documentId: string; signerName?: string; signerEmail?: string; signerRole?: string; order?: number }) => void;
'document:completed': (payload: { documentId: string; type?: string; interestId?: string; clientName?: string }) => void;
'document:sent': (payload: {
documentId: string;
type?: string;
signerCount?: number;
documensoId?: string;
}) => void;
'document:signed': (payload: {
documentId: string;
signerName: string;
signerRole: string;
remainingSigners: number;
}) => void;
'document:signer:signed': (payload: {
documentId: string;
signerName?: string;
signerEmail?: string;
signerRole?: string;
order?: number;
}) => void;
'document:completed': (payload: {
documentId: string;
type?: string;
interestId?: string;
clientName?: string;
}) => void;
'document:expired': (payload: { documentId: string }) => void;
'document:reminderSent': (payload: { documentId: string; recipientEmail: string }) => void;
// Document template events
'documentTemplate:created': (payload: { templateId: string; name?: string; type?: string }) => void;
'documentTemplate:created': (payload: {
templateId: string;
name?: string;
type?: string;
}) => void;
'documentTemplate:updated': (payload: { templateId: string; changedFields?: string[] }) => void;
'documentTemplate:deleted': (payload: { templateId: string }) => void;
// Financial events
'expense:created': (payload: { expenseId: string; amount: number; currency: string; category: string }) => void;
'expense:created': (payload: {
expenseId: string;
amount: number;
currency: string;
category: string;
}) => void;
'expense:updated': (payload: { expenseId: string; changedFields: string[] }) => void;
'expense:archived': (payload: { expenseId: string }) => void;
'invoice:created': (payload: { invoiceId: string; invoiceNumber: string; total: number; clientName: string }) => void;
'invoice:created': (payload: {
invoiceId: string;
invoiceNumber: string;
total: number;
clientName: string;
}) => void;
'invoice:updated': (payload: { invoiceId: string; changedFields: string[] }) => void;
'invoice:sent': (payload: { invoiceId: string; invoiceNumber: string; recipientEmail: string }) => void;
'invoice:sent': (payload: {
invoiceId: string;
invoiceNumber: string;
recipientEmail: string;
}) => void;
'invoice:paid': (payload: { invoiceId: string; invoiceNumber: string; amount: number }) => void;
'invoice:overdue': (payload: { invoiceId: string; invoiceNumber: string; daysPastDue: number }) => void;
'invoice:overdue': (payload: {
invoiceId: string;
invoiceNumber: string;
daysPastDue: number;
}) => void;
// Reminder & Calendar events
'reminder:created': (payload: { reminderId: string; title: string; assignedTo: string; dueAt: string }) => void;
'reminder:created': (payload: {
reminderId: string;
title: string;
assignedTo: string;
dueAt: string;
}) => void;
'reminder:updated': (payload: { reminderId: string; changedFields: string[] }) => void;
'reminder:completed': (payload: { reminderId: string; title: string; completedBy: string }) => void;
'reminder:completed': (payload: {
reminderId: string;
title: string;
completedBy: string;
}) => void;
'reminder:overdue': (payload: { reminderId: string; title: string; dueAt: string }) => void;
'reminder:snoozed': (payload: { reminderId: string; snoozedUntil: string }) => void;
'calendar:synced': (payload: { eventCount: number; lastSyncAt: string }) => void;
'calendar:disconnected': (payload: { reason: string }) => void;
// Notification events
'notification:new': (payload: { notificationId: string; type: string; title: string; description: string; link: string }) => void;
'notification:new': (payload: {
notificationId: string;
type: string;
title: string;
description: string;
link: string;
}) => void;
'notification:unreadCount': (payload: { count: number }) => void;
// Report events
@@ -74,10 +185,20 @@ export interface ServerToClientEvents {
// System events
'system:alert': (payload: { alertType: string; message: string; severity: string }) => void;
'system:jobFailed': (payload: { queueName: string; jobId: string; error: string }) => void;
'registration:new': (payload: { clientId: string; interestId: string; clientName: string; berthNumber: string }) => void;
'registration:new': (payload: {
clientId: string;
interestId: string;
clientName: string;
berthNumber: string;
}) => void;
// File events
'file:uploaded': (payload: { fileId: string; filename: string; clientId?: string; category?: string }) => void;
'file:uploaded': (payload: {
fileId: string;
filename: string;
clientId?: string;
category?: string;
}) => void;
'file:updated': (payload: { fileId: string; changedFields?: string[] }) => void;
'file:deleted': (payload: { fileId: string; filename?: string }) => void;
}