Skip to main content

Mutation hooks

Decorate the create or update DTO when a value should be derived from the HTTP request rather than accepted from the client. todo-item-input.dto.ts
The function must return the complete wrapper ({ input } for create and { update } for update), not only the inner DTO. todo-item-update.dto.ts

Query hooks

BeforeQueryMany receives the built core query and can add filters, sorting, or other query properties. It is also the place to interpret the optional search term enabled by enableSearch. todo-item.dto.ts
The same query hook runs for collection and CSV export requests.

Injectable hooks

Use a class when a hook needs injected services:
When DTOs are listed in endpoints or dtos, NestjsQueryRestModule discovers and registers their hook providers automatically. Edit this page