-
-
Notifications
You must be signed in to change notification settings - Fork 108
Open
Description
Hello,
I noticed an issue in the documentation regarding the usage of the @beforePaginate()
hook.
The current example suggests that the hook receives two separate arguments:
@beforePaginate()
static ignoreDeleted (
countQuery: ModelQueryBuilderContract<typeof User>,
query: ModelQueryBuilderContract<typeof User>
) {
query.whereNull('is_deleted')
countQuery.whereNull('is_deleted')
}
However, in reality, the hook receives a single array of queries as its argument. The correct implementation should be:
@beforePaginate()
static ignoreDeleted([countQuery, query]: [
ModelQueryBuilderContract<typeof User>,
ModelQueryBuilderContract<typeof User>,
]) {
query.whereNull('is_deleted')
countQuery.whereNull('is_deleted')
}
This discrepancy might be confusing for new users trying to implement pagination hooks.
Thank you for your amazing work on AdonisJS!
Metadata
Metadata
Assignees
Labels
No labels