Skip to content

onBeforePatch()

This hook/event is called the before patching a new record.

It can be used in the PATCH handler.

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

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

IBeforePatchContext

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.
formDataThe data has been sent by HTTP client to create or update row.

Released under the MIT License.