Add guest support for events and RSVP system
All checks were successful
Build And Push Image / docker (push) Successful in 3m52s

- Add guest settings to event creation with configurable max guests per person
- Implement guest selection in RSVP form when guests are permitted
- Update API endpoints to handle guest count in RSVP requests
- Extend event and RSVP types to support guest-related fields
This commit is contained in:
2025-08-13 15:14:43 +02:00
parent 234c939dcd
commit 62fb84d25e
6 changed files with 306 additions and 64 deletions

View File

@@ -30,25 +30,49 @@ export const getEventTableId = (tableName: 'Events' | 'EventRSVPs'): string => {
// Try to get effective configuration from admin config system first
const effectiveConfig = getEffectiveNocoDBConfig();
if (effectiveConfig?.tables) {
const tableKey = tableName === 'Events' ? 'events' : 'event_rsvps';
const tableId = effectiveConfig.tables[tableKey] || effectiveConfig.tables[tableName];
if (tableId) {
console.log(`[nocodb-events] Using admin config table ID for ${tableName}:`, tableId);
return tableId;
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);
return eventsTableId;
}
} else if (tableName === 'EventRSVPs') {
// Check multiple possible keys for RSVP table
const rsvpTableId = effectiveConfig.tables['rsvps'] ||
effectiveConfig.tables['event_rsvps'] ||
effectiveConfig.tables['EventRSVPs'] ||
effectiveConfig.tables['rsvp_table'] ||
effectiveConfig.tables['RSVPs'];
if (rsvpTableId) {
console.log(`[nocodb-events] Using admin config table ID for ${tableName}:`, rsvpTableId);
return rsvpTableId;
}
}
}
} catch (error) {
console.log(`[nocodb-events] Admin config not available, trying fallback for ${tableName}`);
console.log(`[nocodb-events] Admin config not available, trying fallback for ${tableName}:`, error);
}
// Try to get table ID from global configuration
const globalConfig = (global as any).globalNocoDBConfig;
if (globalConfig?.tables) {
const tableKey = tableName === 'Events' ? 'events' : 'event_rsvps';
const tableId = globalConfig.tables[tableKey] || globalConfig.tables[tableName];
if (tableId) {
console.log(`[nocodb-events] Using global table ID for ${tableName}:`, tableId);
return tableId;
if (tableName === 'Events') {
const eventsTableId = globalConfig.tables['events'] || globalConfig.tables['Events'];
if (eventsTableId) {
console.log(`[nocodb-events] Using global table ID for ${tableName}:`, eventsTableId);
return eventsTableId;
}
} else if (tableName === 'EventRSVPs') {
const rsvpTableId = globalConfig.tables['rsvps'] ||
globalConfig.tables['event_rsvps'] ||
globalConfig.tables['EventRSVPs'];
if (rsvpTableId) {
console.log(`[nocodb-events] Using global table ID for ${tableName}:`, rsvpTableId);
return rsvpTableId;
}
}
}
@@ -60,7 +84,7 @@ export const getEventTableId = (tableName: 'Events' | 'EventRSVPs'): string => {
}
// Final fallback to default
const defaultTableId = tableName === 'Events' ? 'mt1mx3vkcw0vbmh' : 'rsvps-table-id';
const defaultTableId = tableName === 'Events' ? 'mp3wigub1fzdo1b' : 'mt1mx3vkcw0vbmh';
console.log(`[nocodb-events] Using fallback table ID for ${tableName}:`, defaultTableId);
return defaultTableId;
};
@@ -276,6 +300,7 @@ export function createNocoDBEventsClient() {
"title", "description", "event_type", "event_id", "start_datetime", "end_datetime",
"location", "is_recurring", "recurrence_pattern", "max_attendees",
"is_paid", "cost_members", "cost_non_members", "member_pricing_enabled",
"guests_permitted", "max_guests_permitted",
"visibility", "status", "creator", "current_attendees"
];