vasuzex 2.3.3 → 2.3.5
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.
|
@@ -139,6 +139,11 @@ export class BaseApp extends Application {
|
|
|
139
139
|
* Core middleware for parsing JSON and URL-encoded request bodies
|
|
140
140
|
*/
|
|
141
141
|
setupBodyParsing() {
|
|
142
|
+
// Configure query parser to support nested bracket notation (e.g. filters[name]=value)
|
|
143
|
+
// Express 5 defaults to 'simple' (Node's querystring) which does not parse brackets
|
|
144
|
+
// 'extended' uses qs.parse which correctly handles nested objects
|
|
145
|
+
this.express.set('query parser', 'extended');
|
|
146
|
+
|
|
142
147
|
// Parse JSON request bodies
|
|
143
148
|
this.express.use(express.json());
|
|
144
149
|
|
|
@@ -201,10 +201,15 @@ export class BaseService {
|
|
|
201
201
|
relationJoins = {}, // Relations to join for sorting: { 'user.name': { relation: 'user', foreignKey: 'user_id', table: 'users' } }
|
|
202
202
|
filters = null, // Custom filters function
|
|
203
203
|
relations = [], // Relations to load
|
|
204
|
-
withAggregates = {}
|
|
204
|
+
withAggregates = {}, // Relationship aggregates: { avg: [['ratings', 'rating']], count: ['orders'], sum: [['sales', 'amount']] }
|
|
205
|
+
trashed = 'without' // 'without' = default (exclude deleted), 'with' = include deleted, 'only' = only deleted
|
|
205
206
|
} = options;
|
|
206
207
|
|
|
207
|
-
let query =
|
|
208
|
+
let query = trashed === 'with'
|
|
209
|
+
? Model.withTrashed()
|
|
210
|
+
: trashed === 'only'
|
|
211
|
+
? Model.onlyTrashed()
|
|
212
|
+
: Model.query();
|
|
208
213
|
const modelTable = Model.table;
|
|
209
214
|
const hasRelationJoin = !!relationJoins[sortBy];
|
|
210
215
|
|
|
@@ -186,10 +186,10 @@ export function DataTable(props) {
|
|
|
186
186
|
// Only add non-default values to keep URL clean
|
|
187
187
|
if (state.page !== 1) params.set('page', state.page);
|
|
188
188
|
if (state.sortBy) params.set('sortBy', state.sortBy);
|
|
189
|
-
if (state.sortOrder !==
|
|
189
|
+
if (state.sortOrder !== initialSortOrder) params.set('sortOrder', state.sortOrder);
|
|
190
190
|
if (state.search) params.set('search', state.search);
|
|
191
191
|
if (state.statusFilter !== 'all') params.set('statusFilter', state.statusFilter);
|
|
192
|
-
if (state.limit !== 10) params.set('limit', state.limit);
|
|
192
|
+
if (state.limit !== (initialLimit || 10)) params.set('limit', state.limit);
|
|
193
193
|
|
|
194
194
|
// Add column search params
|
|
195
195
|
Object.entries(state.columnSearch || {}).forEach(([field, value]) => {
|