@@ -158,8 +158,14 @@ export const GET = withRouteHandler(async (request: NextRequest, context: TableR
158158 eq ( userTableRows . workspaceId , validated . workspaceId ) ,
159159 ]
160160
161+ const schema = table . schema as TableSchema
162+
161163 if ( validated . filter ) {
162- const filterClause = buildFilterClause ( validated . filter as Filter , USER_TABLE_ROWS_SQL_NAME )
164+ const filterClause = buildFilterClause (
165+ validated . filter as Filter ,
166+ USER_TABLE_ROWS_SQL_NAME ,
167+ schema . columns
168+ )
163169 if ( filterClause ) {
164170 baseConditions . push ( filterClause )
165171 }
@@ -177,7 +183,6 @@ export const GET = withRouteHandler(async (request: NextRequest, context: TableR
177183 . where ( and ( ...baseConditions ) )
178184
179185 if ( validated . sort ) {
180- const schema = table . schema as TableSchema
181186 const sortClause = buildSortClause ( validated . sort , USER_TABLE_ROWS_SQL_NAME , schema . columns )
182187 if ( sortClause ) {
183188 query = query . orderBy ( sortClause ) as typeof query
@@ -378,14 +383,14 @@ export const PUT = withRouteHandler(async (request: NextRequest, context: TableR
378383 }
379384
380385 const result = await updateRowsByFilter (
386+ table ,
381387 {
382388 tableId,
383389 filter : validated . filter as Filter ,
384390 data : validated . data as RowData ,
385391 limit : validated . limit ,
386392 workspaceId : validated . workspaceId ,
387393 } ,
388- table ,
389394 requestId
390395 )
391396
@@ -484,6 +489,7 @@ export const DELETE = withRouteHandler(
484489 }
485490
486491 const result = await deleteRowsByFilter (
492+ table ,
487493 {
488494 tableId,
489495 filter : validated . filter as Filter ,
0 commit comments