Fix library loading per base with new API views

- Use api_library_list_{base} views instead of generic query
- Add name_en and member_count to Library type
- Created PostgreSQL views for hst, flg, itm, loc, ply libraries

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
ARCHITECT
2026-01-13 00:54:18 +00:00
parent a7ab3bab7d
commit a0b20fc5db
2 changed files with 4 additions and 2 deletions

View File

@@ -9,8 +9,8 @@ export const fetchLibraries = (base: BaseType): Promise<Library[]> => {
if (!LIBRARY_BASES.has(base)) { if (!LIBRARY_BASES.has(base)) {
return Promise.resolve([]); return Promise.resolve([]);
} }
// Try base-specific endpoint, fallback to generic // Use base-specific view: api_library_list_hst, api_library_list_flg, etc.
return apiClientSafe<Library[]>(`/api_library_list?base=eq.${base}`, {}, []); return apiClientSafe<Library[]>(`/api_library_list_${base}`, {}, []);
}; };
export const fetchLibraryMembers = async (mrf: string, base: BaseType): Promise<string[]> => { export const fetchLibraryMembers = async (mrf: string, base: BaseType): Promise<string[]> => {

View File

@@ -23,9 +23,11 @@ export interface Library {
ref?: string; ref?: string;
name?: string; name?: string;
name_es?: string; name_es?: string;
name_en?: string;
alias?: string; alias?: string;
icon_url?: string; icon_url?: string;
img_thumb_url?: string; img_thumb_url?: string;
member_count?: number;
} }
export interface ChildTag { export interface ChildTag {