-
Notifications
You must be signed in to change notification settings - Fork 121
Description
I have to Entities joined OneToOne:
Base.entity.ts:
@Entity({ name: 'base' })
export class Base {
@OneToOne(() => Details, (details) => details.base, {
onDelete: 'CASCADE'
})
details: Relation<Details> | null;Detail.entity.ts
@Entity({ name: 'detail' })
export class Details {
@Column({ nullable: false, name: 'important_id' })
@Index()
importantId: string
@Column({ nullable: false, name: 'some_other_id' })
@Index()
someOtherId: string;
@OneToOne(() => Base, (base) => base.details, {
onDelete: 'CASCADE',
cascade: true,
eager: true
})
@JoinColumn({ name: 'base_id' })
base: Relation<Base>;
}Now I try to have a paginate Query like this:
await this.baseRepo.paginate(paginateQuery, {
relations: { details: true },
relativePath: false,
maxLimit: 1000,
origin: process.env.API_HOST,
defaultLimit: 100,
defaultSortBy: [['created', 'DESC']]
where: {
details: [{ importantId: inputId) }, {someOtherId: string}]
}
});Now when trying to run this pagination query I get the following error:
TypeORMError: Relation with property path 0 in entity was not found.
Stack Trace:
at JoinAttribute.getValue (/Documents/repos/grs/src/query-builder/JoinAttribute.ts:187:23)/Documents/repos/grs/src/query-builder/JoinAttribute.ts:191:53)
at JoinAttribute.get relation [as relation] (
at JoinAttribute.get metadata [as metadata] (/Documents/repos/grs/src/query-builder/JoinAttribute.ts:203:18)/Documents/repos/grs/src/query-builder/SelectQueryBuilder.ts:2100:53)
at SelectQueryBuilder.join (
at SelectQueryBuilder.leftJoin (~/Documents/repos/grs/src/query-builder/SelectQueryBuilder.ts:468:14)
at ~/Documents/repos/grs/node_modules/nestjs-paginate/src/paginate.ts:185:38
at Array.forEach ()
at /Documents/repos/grs/node_modules/nestjs-paginate/src/paginate.ts:167:30/Documents/repos/grs/node_modules/nestjs-paginate/src/paginate.ts:128:32)
at Array.flatMap ()
at flattenWhereAndTransform (