vasuzex 2.3.4 → 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.
|
@@ -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
|
|