debug(events): Strip down to minimal query to isolate 422 errors
Build And Push Image / docker (push) Successful in 3m22s
Details
Build And Push Image / docker (push) Successful in 3m22s
Details
- Removed ALL filtering (dates, status, search, role-based) - Removed ALL sorting - Added comprehensive debug logging - This will test if even basic field filtering causes 422 errors - Goal: Isolate exactly what NocoDB query syntax works vs fails
This commit is contained in:
parent
c4789ec9df
commit
1d5ecfddcd
|
|
@ -62,54 +62,25 @@ export function createNocoDBEventsClient() {
|
||||||
if (filters?.limit) queryParams.set('limit', filters.limit.toString());
|
if (filters?.limit) queryParams.set('limit', filters.limit.toString());
|
||||||
if (filters?.offset) queryParams.set('offset', filters.offset.toString());
|
if (filters?.offset) queryParams.set('offset', filters.offset.toString());
|
||||||
|
|
||||||
// Build where clause for filtering using correct field names from NocoDB
|
// TEMPORARILY: Try different query approach to isolate the issue
|
||||||
const whereConditions: string[] = [];
|
// Remove complex filtering until we can identify what works
|
||||||
|
|
||||||
if (filters?.start_date && filters?.end_date) {
|
console.log('[nocodb-events] 🔍 DEBUG: Filters received:', JSON.stringify(filters, null, 2));
|
||||||
// Date range filtering using gte and lte (btw didn't work)
|
|
||||||
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') {
|
|
||||||
// Board members can see public and board-only events
|
|
||||||
whereConditions.push(`~or((visibility,eq,public),(visibility,eq,board-only))`);
|
|
||||||
}
|
|
||||||
// Admin sees all events (no filter)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Try only status filter first (simplest case)
|
||||||
if (filters?.status) {
|
if (filters?.status) {
|
||||||
whereConditions.push(`(status,eq,${filters.status})`);
|
console.log('[nocodb-events] 🔍 Adding status filter:', filters.status);
|
||||||
|
queryParams.set('where', `(status,eq,${filters.status})`);
|
||||||
} else {
|
} else {
|
||||||
// Default to active events only
|
// Try no status filter at all to see if that works
|
||||||
whereConditions.push(`(status,eq,active)`);
|
console.log('[nocodb-events] 🔍 No status filter - fetching all records');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filters?.search) {
|
// Skip date filtering completely for now
|
||||||
// Search in title or description
|
console.log('[nocodb-events] ⚠️ Temporarily skipping date/role/search filtering to isolate issue');
|
||||||
whereConditions.push(`~or((title,like,%${filters.search}%),(description,like,%${filters.search}%))`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Combine conditions with ~and if multiple conditions exist
|
// ALSO temporarily skip sorting to see if that's the issue
|
||||||
if (whereConditions.length > 0) {
|
console.log('[nocodb-events] ⚠️ Also temporarily skipping sorting to isolate issue');
|
||||||
const whereClause = whereConditions.length === 1
|
|
||||||
? whereConditions[0]
|
|
||||||
: `~and(${whereConditions.join(',')})`;
|
|
||||||
queryParams.set('where', whereClause);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort by start date
|
|
||||||
queryParams.set('sort', 'start_datetime');
|
|
||||||
|
|
||||||
const url = `${baseUrl}/api/v2/tables/${eventsTableId}/records?${queryParams.toString()}`;
|
const url = `${baseUrl}/api/v2/tables/${eventsTableId}/records?${queryParams.toString()}`;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue