fix(events): Simplify NocoDB query to test basic functionality
Build And Push Image / docker (push) Has been cancelled
Details
Build And Push Image / docker (push) Has been cancelled
Details
- 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
This commit is contained in:
parent
0688c23093
commit
54a4f05c2a
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue