adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.08k stars 195 forks source link

Global pagination serialization naming strategy from example is not working #1046

Open m-i-c-h-a-l opened 3 months ago

m-i-c-h-a-l commented 3 months ago

Package version

21.1.0

Describe the bug

I followed instructions on https://lucid.adonisjs.com/docs/pagination#serializing-to-json which is not working. Code:

import db from '@adonisjs/lucid/services/db'
import type { ApplicationService } from '@adonisjs/core/types'

export default class AppProvider {
  constructor(protected app: ApplicationService) {}

  async ready() {
    db.SimplePaginator.namingStrategy = {
      paginationMetaKeys() {
        return {
          // ... same as above
        }
      },
    }
  }
}

Causes compilation error: Property SimplePaginator does not exist on type Database

Removing db. and using SimplePaginator.namingStrategy = { ... compiles, but has no effect.

Reproduction repo

No response