This commit is contained in:
@@ -26,18 +26,26 @@ export enum EventTable {
|
||||
|
||||
// Dynamic table ID getter - will use configured table ID from admin panel
|
||||
export const getEventTableId = (tableName: 'Events' | 'EventRSVPs'): string => {
|
||||
console.log(`[nocodb-events] 🔍 DEBUG: Getting table ID for ${tableName}...`);
|
||||
|
||||
try {
|
||||
// Try to get effective configuration from admin config system first
|
||||
const effectiveConfig = getEffectiveNocoDBConfig();
|
||||
console.log(`[nocodb-events] 🔍 DEBUG: Effective config:`, JSON.stringify(effectiveConfig, null, 2));
|
||||
|
||||
if (effectiveConfig?.tables) {
|
||||
console.log(`[nocodb-events] 🔍 DEBUG: Available table keys:`, Object.keys(effectiveConfig.tables));
|
||||
|
||||
if (tableName === 'Events') {
|
||||
// Check multiple possible keys for Events table
|
||||
const eventsTableId = effectiveConfig.tables['events'] ||
|
||||
effectiveConfig.tables['Events'] ||
|
||||
effectiveConfig.tables['events_table'];
|
||||
if (eventsTableId) {
|
||||
console.log(`[nocodb-events] Using admin config table ID for ${tableName}:`, eventsTableId);
|
||||
console.log(`[nocodb-events] ✅ Using admin config table ID for ${tableName}:`, eventsTableId);
|
||||
return eventsTableId;
|
||||
} else {
|
||||
console.log(`[nocodb-events] ⚠️ No Events table ID found in config`);
|
||||
}
|
||||
} else if (tableName === 'EventRSVPs') {
|
||||
// Check multiple possible keys for RSVP table
|
||||
@@ -47,13 +55,20 @@ export const getEventTableId = (tableName: 'Events' | 'EventRSVPs'): string => {
|
||||
effectiveConfig.tables['rsvp_table'] ||
|
||||
effectiveConfig.tables['RSVPs'];
|
||||
if (rsvpTableId) {
|
||||
console.log(`[nocodb-events] Using admin config table ID for ${tableName}:`, rsvpTableId);
|
||||
console.log(`[nocodb-events] ✅ Using admin config table ID for ${tableName}:`, rsvpTableId);
|
||||
return rsvpTableId;
|
||||
} else {
|
||||
console.log(`[nocodb-events] ⚠️ No RSVP table ID found in config. Checking individual keys:`);
|
||||
console.log(`[nocodb-events] 🔍 rsvps:`, effectiveConfig.tables['rsvps']);
|
||||
console.log(`[nocodb-events] 🔍 event_rsvps:`, effectiveConfig.tables['event_rsvps']);
|
||||
console.log(`[nocodb-events] 🔍 EventRSVPs:`, effectiveConfig.tables['EventRSVPs']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(`[nocodb-events] ⚠️ No tables configuration found in effective config`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`[nocodb-events] Admin config not available, trying fallback for ${tableName}:`, error);
|
||||
console.log(`[nocodb-events] ❌ Admin config error for ${tableName}:`, error);
|
||||
}
|
||||
|
||||
// Try to get table ID from global configuration
|
||||
|
||||
Reference in New Issue
Block a user