diff --git a/deck-frontend/index.html b/deck-frontend/index.html
index 108aa04..8d66720 100644
--- a/deck-frontend/index.html
+++ b/deck-frontend/index.html
@@ -22,6 +22,7 @@
+
@@ -29,6 +30,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/deck-frontend/src/api/client.ts b/deck-frontend/src/api/client.ts
index 3245d67..03f0f69 100644
--- a/deck-frontend/src/api/client.ts
+++ b/deck-frontend/src/api/client.ts
@@ -3,17 +3,22 @@ import { API_BASE } from '@/config/index.ts';
interface FetchOptions {
method?: 'GET' | 'POST';
body?: Record
;
+ schema?: string; // PostgREST Accept-Profile header
}
export async function apiClient(
endpoint: string,
options: FetchOptions = {}
): Promise {
- const { method = 'GET', body } = options;
+ const { method = 'GET', body, schema } = options;
+
+ const headers: Record = {};
+ if (body) headers['Content-Type'] = 'application/json';
+ if (schema) headers['Accept-Profile'] = schema;
const config: RequestInit = {
method,
- headers: body ? { 'Content-Type': 'application/json' } : undefined,
+ headers: Object.keys(headers).length > 0 ? headers : undefined,
body: body ? JSON.stringify(body) : undefined,
};
diff --git a/deck-frontend/src/api/libraries.ts b/deck-frontend/src/api/libraries.ts
index 29d3c05..3884733 100644
--- a/deck-frontend/src/api/libraries.ts
+++ b/deck-frontend/src/api/libraries.ts
@@ -1,12 +1,24 @@
import { apiClientSafe } from './client.ts';
-import type { Library } from '@/types/index.ts';
+import type { Library, BaseType } from '@/types/index.ts';
-export const fetchLibraries = (): Promise =>
- apiClientSafe('/api_library_list', {}, []);
+// Base types that have library tables (public schema taxonomy tables)
+const LIBRARY_BASES = new Set(['hst', 'flg', 'itm', 'loc', 'ply']);
-export const fetchLibraryMembers = async (mrf: string): Promise => {
+export const fetchLibraries = (base: BaseType): Promise => {
+ // Only public schema taxonomy tables have libraries
+ if (!LIBRARY_BASES.has(base)) {
+ return Promise.resolve([]);
+ }
+ // Try base-specific endpoint, fallback to generic
+ return apiClientSafe(`/api_library_list?base=eq.${base}`, {}, []);
+};
+
+export const fetchLibraryMembers = async (mrf: string, base: BaseType): Promise => {
+ if (!LIBRARY_BASES.has(base)) {
+ return [];
+ }
const data = await apiClientSafe>(
- `/library_hst?mrf_library=eq.${mrf}`,
+ `/library_${base}?mrf_library=eq.${mrf}`,
{},
[]
);
diff --git a/deck-frontend/src/api/tags.ts b/deck-frontend/src/api/tags.ts
index 34c2d83..cba9f0b 100644
--- a/deck-frontend/src/api/tags.ts
+++ b/deck-frontend/src/api/tags.ts
@@ -1,8 +1,52 @@
import { apiClientSafe } from './client.ts';
import type { Tag, ChildTag, RelatedTag, BaseType } from '@/types/index.ts';
-export const fetchTags = (base: BaseType): Promise =>
- apiClientSafe(`/${base}?order=ref.asc`, {}, []);
+// Schema mapping by base type
+// - public (default): hst, flg, itm, loc, ply
+// - secretaria_clara: atc, mst, bck
+// - production_alfred: mth
+// - mail_manager: mail (table: clara_registros)
+// - context_manager: chat (table: messages)
+
+interface SchemaTableConfig {
+ schema: string | null;
+ table: string;
+}
+
+const getSchemaAndTable = (base: BaseType): SchemaTableConfig => {
+ switch (base) {
+ // secretaria_clara schema
+ case 'atc':
+ case 'mst':
+ case 'bck':
+ return { schema: 'secretaria_clara', table: base };
+
+ // production_alfred schema
+ case 'mth':
+ return { schema: 'production_alfred', table: base };
+
+ // mail_manager schema
+ case 'mail':
+ return { schema: 'mail_manager', table: 'clara_registros' };
+
+ // context_manager schema
+ case 'chat':
+ return { schema: 'context_manager', table: 'messages' };
+
+ // public schema (default) - hst, flg, itm, loc, ply
+ default:
+ return { schema: null, table: base };
+ }
+};
+
+export const fetchTags = (base: BaseType): Promise => {
+ const { schema, table } = getSchemaAndTable(base);
+ return apiClientSafe(
+ `/${table}?order=ref.asc`,
+ schema ? { schema } : {},
+ []
+ );
+};
// Fetch HST tags for group name resolution (set_hst points to hst tags)
export const fetchHstTags = (): Promise =>
diff --git a/deck-frontend/src/main.ts b/deck-frontend/src/main.ts
index a9baba3..45c4f6a 100644
--- a/deck-frontend/src/main.ts
+++ b/deck-frontend/src/main.ts
@@ -39,7 +39,7 @@ class App {
fetchTags(state.base),
fetchHstTags(), // Always load HST for group name resolution
fetchGroups(),
- fetchLibraries()
+ fetchLibraries(state.base) // Load libraries for current base
]);
store.setState({ tags, hstTags, groups, libraries });
@@ -153,11 +153,12 @@ class App {
delegateEvent(container, '.lib-icon', 'click', async (_, target) => {
const library = target.dataset.lib || 'all';
+ const currentBase = store.getState().base;
if (library === 'all') {
store.setState({ library: 'all', libraryMembers: new Set() });
} else {
- const members = await fetchLibraryMembers(library);
+ const members = await fetchLibraryMembers(library, currentBase);
store.setState({ library, libraryMembers: new Set(members) });
}
diff --git a/deck-frontend/src/styles/main.css b/deck-frontend/src/styles/main.css
index 792fa24..9d41657 100644
--- a/deck-frontend/src/styles/main.css
+++ b/deck-frontend/src/styles/main.css
@@ -39,7 +39,7 @@ body {
gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
-.topbar-center { flex: 1; display: flex; justify-content: center; }
+.topbar-center { flex: 1; display: flex; justify-content: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.logo { font-weight: 700; font-size: 1.2em; color: var(--accent); letter-spacing: 1px; }
diff --git a/deck-frontend/src/types/state.ts b/deck-frontend/src/types/state.ts
index 6160185..0fc8a07 100644
--- a/deck-frontend/src/types/state.ts
+++ b/deck-frontend/src/types/state.ts
@@ -2,7 +2,12 @@ import type { Tag, Group, Library } from './tag.ts';
import type { GraphEdge, TreeEdge, CategoryKey, EdgeType } from './graph.ts';
export type ViewType = 'grid' | 'tree' | 'graph';
-export type BaseType = 'hst' | 'flg' | 'itm' | 'loc' | 'ply';
+export type BaseType =
+ | 'hst' | 'flg' | 'itm' | 'loc' | 'ply' // Taxonomía (public)
+ | 'mth' | 'atc' // Registro (secretaria_clara, production_alfred)
+ | 'mst' | 'bck' // Maestros (secretaria_clara)
+ | 'mail' | 'chat' // Comunicación (mail_manager, context_manager)
+ | 'key' | 'mindlink'; // Servicios
export type LangType = 'es' | 'en' | 'ch';
export interface GraphFilters {