Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'databaseName') #1023

Open
williamaditama opened this issue Nov 5, 2024 · 1 comment
Open

Comments

@williamaditama
Copy link

williamaditama commented Nov 5, 2024

package.json

{
    "@nestjs/common": "^9.0.0",
    "typeorm": "^0.3.17",
    "nestjs-paginate": "^9.0.0",
}

customer.entity.ts

@Entity()
export class Customer {
...

  @Column({ type: 'json', default: {} })
  customFields: any;
...
}

service:

  async findPaginated(company: Company, paginateQuery: PaginateQuery, entityType: string, relations: string[]) {
...
    return paginate(
      paginateQuery,
      repo,
      {
        // @ts-ignore
        sortableColumns: ['id'],
        // @ts-ignore
        defaultSortBy: [['id', 'ASC'], ['customFields.scoring', 'DESC']], // Issue with this line
        where: {
          company: { id: company.id }
        }
      }
    )
  }

When calling the service, it's giving me this error:

TypeError: Cannot read properties of undefined (reading 'databaseName')
@Helveg
Copy link
Collaborator

Helveg commented Nov 6, 2024

Hi! :) Could you put this in a little repository by any chance so that I can clone it and debug it from there? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants