debug(events): Remove ALL filtering and sorting to test basic NocoDB API
Build And Push Image / docker (push) Has been cancelled
Details
Build And Push Image / docker (push) Has been cancelled
Details
- Completely stripped down query to test if basic API call works - No where clauses, no sorting, just limit/offset - Added debug logging to identify the root cause - This will help determine if issue is with query syntax or basic connectivity
This commit is contained in:
parent
2c3c64e7e3
commit
d01758b947
|
|
@ -62,53 +62,9 @@ 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 correct NocoDB v2 syntax
|
||||
const whereConditions: string[] = [];
|
||||
|
||||
if (filters?.start_date && filters?.end_date) {
|
||||
// Date range filtering using btw (between) operator
|
||||
whereConditions.push(`(start_datetime,btw,${filters.start_date},${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)
|
||||
}
|
||||
|
||||
if (filters?.status) {
|
||||
whereConditions.push(`(status,eq,${filters.status})`);
|
||||
} else {
|
||||
// Default to active events only
|
||||
whereConditions.push(`(status,eq,active)`);
|
||||
}
|
||||
|
||||
if (filters?.search) {
|
||||
// Search in title or description using like operator
|
||||
whereConditions.push(`~or((title,like,%${filters.search}%),(description,like,%${filters.search}%))`);
|
||||
}
|
||||
|
||||
// Combine conditions with ~and if multiple conditions exist
|
||||
if (whereConditions.length > 0) {
|
||||
const whereClause = whereConditions.length === 1
|
||||
? whereConditions[0]
|
||||
: `~and(${whereConditions.join(',')})`;
|
||||
queryParams.set('where', whereClause);
|
||||
}
|
||||
|
||||
// Sort by start date
|
||||
queryParams.set('sort', 'start_datetime');
|
||||
// TEMPORARILY: Remove ALL filtering AND sorting to test basic functionality
|
||||
// Just get all records to see if the table/API works at all
|
||||
console.log('[nocodb-events] DEBUG: Testing with no filters or sorting at all');
|
||||
|
||||
const url = `${baseUrl}/api/v2/tables/${eventsTableId}/records?${queryParams.toString()}`;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue