feat(dashboard): implement Phase 6 TypeScript type definitions

Add TypeScript interfaces for Carousel-style dashboard to api.d.ts:

New Interfaces:
1. SectionData
   - Matches handlers.SectionData in collections.go (lines 73-81)
   - id: Collection name (string)
   - is_system: Boolean flag (true for system collections, false for user)
   - title: Display title
   - description: Collection description
   - icon: Emoji icon
   - items: Array of BookInfo objects
   - view_all_url: URL to view all items (system collections only)
   - priority: Display order (lower numbers first)

2. DashboardPreferences
   - Matches database.UserDashboardPreferences (models.go:381-390)
   - library_id: Library UUID
   - hidden_collections: Array of collection names to hide
   - collection_order: Array of collection names for custom ordering
   - items_per_section: Number of items per section

Existing Interface:
- BookInfo: Already defined (media_item_id, title, author, cover_image_path)
  - Reused by SectionData for items array
  - No duplicate definitions needed

Key Compliance:
- is_system: boolean matches database is_system_collection field
- media_item_id matches Go BookInfo.MediaItemID field
- Uses existing BookInfo struct (no duplicates)
- Added to existing api.d.ts file (follows established pattern)
This commit is contained in:
2026-02-19 21:05:59 -05:00
parent 190914c004
commit 9ef94efeb5
+25
View File
@@ -97,6 +97,31 @@ export interface BookInfo {
cover_image_path: string;
}
// Dashboard type definitions
// CRITICAL: Must match Go handler return types EXACTLY
// Source: handlers.SectionData in collections.go (lines 73-81)
// Used in: dashboard API responses, TypeScript dashboard components
export interface SectionData {
id: string;
is_system: boolean;
title: string;
description: string;
icon: string;
items: BookInfo[];
view_all_url: string;
priority: number;
}
// Matches database.UserDashboardPreferences and dashboard preferences API
// Source: internal/database/models.go:381-390
// Used in: dashboard preferences API
export interface DashboardPreferences {
library_id: string;
hidden_collections: string[];
collection_order: string[];
items_per_section: number;
}
// Matches handlers.UnlinkedBookData JSON response
// Used in: unlinked_books.ts, unlinked_books.templ
export interface UnlinkedBookData {