Skip to content

onAfterForceDeleteQuery()

This hook/event is called after the delete query is executed by Axe API.

For example; let's assume that you try to delete a user by a user id. This hook/event is called after the Axe API fetches the record to be deleted.

It can be used in the FORCE_DELETE handler.

ts
import { IAfterForceDeleteQueryContext } from "axe-api";

export default async (parameters: IAfterForceDeleteQueryContext) => {
  // do something in here
};

IAfterForceDeleteQueryContext

The following parameters can be used in the hook/event function;

ParameterDescription
reqAxeRequest
resAxeResponse
modelCurrent model instance. For example; User
databaseDatabase connection instance. For example Knex.js
relationThe relation definition if the route is a related route (For example api/v1/users/:userId/posts).
parentModelThe parent model instance if the route is a related route (For example api/v1/users/:userId/posts).
queryThe Knex.js' query instance.
itemThe current record.

Released under the MIT License.