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:
@@ -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[]> => {
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user