feat: add frontend document-vehicle API client and hooks (refs #31)
- Update DocumentRecord interface to include sharedVehicleIds array - Add optional sharedVehicleIds to Create/UpdateDocumentRequest types - Add documentsApi.listByVehicle() method for fetching by vehicle - Add documentsApi.addSharedVehicle() for linking vehicles - Add documentsApi.removeVehicleFromDocument() for unlinking - Add useDocumentsByVehicle() query hook with vehicle filter - Add useAddSharedVehicle() mutation with optimistic updates - Add useRemoveVehicleFromDocument() mutation with optimistic updates - Ensure query invalidation includes both documents and documents-by-vehicle keys - Update test mocks to include sharedVehicleIds field - Fix optimistic update in useCreateDocument to include new fields Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,7 @@ describe('DocumentPreview', () => {
|
||||
documentType: 'insurance',
|
||||
title: 'Insurance Document',
|
||||
contentType: 'application/pdf',
|
||||
sharedVehicleIds: [],
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
updatedAt: '2024-01-01T00:00:00Z',
|
||||
};
|
||||
@@ -41,6 +42,7 @@ describe('DocumentPreview', () => {
|
||||
documentType: 'registration',
|
||||
title: 'Registration Photo',
|
||||
contentType: 'image/jpeg',
|
||||
sharedVehicleIds: [],
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
updatedAt: '2024-01-01T00:00:00Z',
|
||||
};
|
||||
@@ -52,6 +54,7 @@ describe('DocumentPreview', () => {
|
||||
documentType: 'insurance',
|
||||
title: 'Text Document',
|
||||
contentType: 'text/plain',
|
||||
sharedVehicleIds: [],
|
||||
createdAt: '2024-01-01T00:00:00Z',
|
||||
updatedAt: '2024-01-01T00:00:00Z',
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user