axe-api 1.5.0-rc-3 → 1.5.0-rc-4

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.
@@ -227,6 +227,11 @@ const getRelatedData = (version, data, withArray, model, modelList, database, ha
227
227
  }
228
228
  selectColumns = uniqueByMap(selectColumns);
229
229
  const foreignModelQuery = database(foreignModel.instance.table).select(selectColumns);
230
+ // Call the onBeforeQuery function if there is a defined one!
231
+ console.log("QUERRRRY", foreignModel.instance.table, definedRelation.options);
232
+ if (definedRelation.options.onBeforeQuery) {
233
+ yield definedRelation.options.onBeforeQuery(request, foreignModelQuery);
234
+ }
230
235
  // If the model is supported soft-delete we should check the data.
231
236
  if (foreignModel.instance.deletedAtColumn) {
232
237
  foreignModelQuery.whereNull(foreignModel.instance.deletedAtColumn);
@@ -402,6 +402,7 @@ export interface IElasticSearchParameters {
402
402
  }
403
403
  export interface IHasManyOptions {
404
404
  autoRouting: boolean;
405
+ onBeforeQuery?: (req: AxeRequest, query: Knex.QueryBuilder) => Promise<void>;
405
406
  }
406
407
  export interface IValidator {
407
408
  validate: (req: AxeRequest, model: IModelService, formData: any) => Promise<null | IValidationError>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axe-api",
3
- "version": "1.5.0-rc-3",
3
+ "version": "1.5.0-rc-4",
4
4
  "description": "AXE API is a simple tool to create Rest APIs quickly.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",