@opengis/fastify-table 1.3.16 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -120,8 +120,8 @@ export default async function dataAPI(req, reply, called) {
|
|
|
120
120
|
const [orderColumn, orderDir] = (query.order || loadTable?.order || '').split(/[- ]/);
|
|
121
121
|
|
|
122
122
|
const order = query.order && columnList.includes(orderColumn) && orderColumn?.length
|
|
123
|
-
? `order by ${orderColumn} ${query.desc || orderDir === 'desc' ? 'desc' : ''}`
|
|
124
|
-
: `order by ${(loadTable?.order || 'true::boolean')}`;
|
|
123
|
+
? `order by ${orderColumn} ${query.desc || orderDir === 'desc' ? 'desc' : ''} nulls last`
|
|
124
|
+
: `order by ${(loadTable?.order || 'true::boolean')} nulls last`;
|
|
125
125
|
const search = loadTable?.meta?.search && query.search
|
|
126
126
|
? `(${loadTable?.meta?.search?.split(',')?.map(el => `${el} ilike '%${query.search.replace(/%/g, '\\%').replace(/'/g, "''")}%'`).join(' or ')})`
|
|
127
127
|
: null;
|
|
@@ -142,7 +142,7 @@ export default async function dataAPI(req, reply, called) {
|
|
|
142
142
|
|
|
143
143
|
${params.id ? cardSqlTable : ''}
|
|
144
144
|
where ${where.join(' and ') || 'true'}
|
|
145
|
-
${order} ${offset}
|
|
145
|
+
${order} ${offset} limit ${limit}`
|
|
146
146
|
.replace(/{{uid}}/g, uid);
|
|
147
147
|
|
|
148
148
|
// if (user?.user_type === 'superadmin') console.log(q);
|