From 54a4f05c2a49f6782f7575be4d41712edcfde575 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 12 Aug 2025 13:21:27 +0200 Subject: [PATCH] fix(events): Simplify NocoDB query to test basic functionality - Removed complex query conditions to isolate the issue - Using simple (status,eq,active) query to test field names - Will build up complexity once basic queries work --- server/utils/nocodb-events.ts | 44 ++++------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/server/utils/nocodb-events.ts b/server/utils/nocodb-events.ts index 20be8b6..5312514 100644 --- a/server/utils/nocodb-events.ts +++ b/server/utils/nocodb-events.ts @@ -62,47 +62,13 @@ export function createNocoDBEventsClient() { if (filters?.limit) queryParams.set('limit', filters.limit.toString()); if (filters?.offset) queryParams.set('offset', filters.offset.toString()); - // Build where clause for filtering using NocoDB v2 syntax - const whereConditions: string[] = []; - - if (filters?.start_date && filters?.end_date) { - whereConditions.push(`(start_datetime,gte,${filters.start_date})`); - whereConditions.push(`(start_datetime,lte,${filters.end_date})`); - } - - if (filters?.event_type) { - whereConditions.push(`(event_type,eq,${filters.event_type})`); - } - - if (filters?.visibility) { - whereConditions.push(`(visibility,eq,${filters.visibility})`); - } else if (filters?.user_role) { - // Role-based visibility filtering - if (filters.user_role === 'user') { - whereConditions.push(`(visibility,eq,public)`); - } else if (filters.user_role === 'board') { - // For multiple OR conditions, we'll need to handle this differently - whereConditions.push(`~or(visibility,eq,public)~or(visibility,eq,board-only)`); - } - // Admin sees all events (no filter) - } - + // Build where clause for filtering using simple NocoDB v2 syntax + // Start with just the status filter to test basic functionality if (filters?.status) { - whereConditions.push(`(status,eq,${filters.status})`); + queryParams.set('where', `(status,eq,${filters.status})`); } else { - // Default to active events only - whereConditions.push(`(status,eq,active)`); - } - - if (filters?.search) { - whereConditions.push(`~or(title,like,%${filters.search}%)~or(description,like,%${filters.search}%)`); - } - - if (whereConditions.length > 0) { - const whereClause = whereConditions.length === 1 - ? whereConditions[0] - : `~and(${whereConditions.join(',')})`; - queryParams.set('where', whereClause); + // Default to active events only - test this simple query first + queryParams.set('where', `(status,eq,active)`); } // Sort by start date