You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a NestJS project where I'm using nestjs-paginate with TypeORM. I have a Customer entity that has PhoneNumber and Dealer as related entities, and I’m trying to paginate Customer records along with these relations.
Here's my Customer entity:
`@Entity()
export class Customer extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm working on a NestJS project where I'm using nestjs-paginate with TypeORM. I have a Customer entity that has PhoneNumber and Dealer as related entities, and I’m trying to paginate Customer records along with these relations.
Here's my Customer entity:
`@Entity()
export class Customer extends BaseEntity {
@PrimaryGeneratedColumn('uuid')
id: string;
}`
In the CustomerService, I have the following findAll function for pagination:
async findAll(query: PaginateQuery): Promise<Paginated<Customer>> { return paginate(query, this.customerRepository, { sortableColumns: ['id', 'name', 'tc_no', 'email'], relations: ['dealer', 'phoneNumber'], nullSort: 'last', defaultSortBy: [['id', 'DESC']], searchableColumns: ['name', 'tc_no', 'email', 'address'], select: [ 'id', 'name', 'tc_no', 'phoneNumber', 'address', 'email', 'dealer', 'created', 'updated', 'deleted' ], filterableColumns: { name: [FilterOperator.EQ, FilterSuffix.NOT], email: [FilterOperator.EQ], tc_no: [FilterOperator.EQ], deleted: [FilterOperator.EQ], }, }); }
When running this code, I'm encountering the following error:
[Nest] ERROR [ExceptionsHandler] Cannot read properties of undefined (reading 'databaseName') TypeError: Cannot read properties of undefined (reading 'databaseName') at /typeorm/query-builder/SelectQueryBuilder.ts:3685:41
Beta Was this translation helpful? Give feedback.
All reactions