Fix getLibraries to query library tables directly
Instead of depending on non-existent api_library_list_* views,
now queries library_${base} for unique mrf_library values and
fetches tag info from main table.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>DECK - TZZR</title>
|
||||
<title>deck</title>
|
||||
<meta name="description" content="DECK Tag Management System">
|
||||
|
||||
<!--
|
||||
@@ -933,10 +933,16 @@ const API = {
|
||||
getHstTags() { return this.fetch("/hst?select=mrf,ref,name_es,name_en,alias", "tzzr_core_hst", { fallback: [] }); },
|
||||
getGroups() { return this.fetch("/api_groups", "public", { fallback: [] }); },
|
||||
|
||||
getLibraries(base) {
|
||||
async getLibraries(base) {
|
||||
const config = CONFIG.BASES[base];
|
||||
if (!config?.hasLibraries) return Promise.resolve([]);
|
||||
return this.fetch(`/api_library_list_${base}`, "public", { fallback: [] });
|
||||
if (!config?.hasLibraries) return [];
|
||||
// Get unique library MRFs from library_${base}
|
||||
const relations = await this.fetch(`/library_${base}?select=mrf_library`, config.schema, { fallback: [] });
|
||||
const uniqueMrfs = [...new Set(relations.map(r => r.mrf_library))];
|
||||
if (uniqueMrfs.length === 0) return [];
|
||||
// Fetch tag info for those MRFs
|
||||
const mrfFilter = uniqueMrfs.map(m => `"${m}"`).join(',');
|
||||
return this.fetch(`/${config.table}?mrf=in.(${mrfFilter})&select=mrf,alias,name_es,name_en,img_thumb_url`, config.schema, { fallback: [] });
|
||||
},
|
||||
|
||||
async getLibraryMembers(base, libraryMrf) {
|
||||
|
||||
Reference in New Issue
Block a user