Есть две модели:
1.
@Entity('intranets')
export class Intranets {
@PrimaryGeneratedColumn({ unsigned: true })
id: number;
@Column('varchar', { length: 255, nullable: false, unique: true })
name: string;
@Column({ default: false })
isActive: boolean;
@Column({ default: false })
deleted: boolean;
@Column('text', { nullable: false })
description: string;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
@OneToMany(
() => IntranetProperties,
(intranetProperty) => intranetProperty.intranetId
)
@JoinColumn({ name: 'id', referencedColumnName: 'intranetId' })
intranetProperties: IntranetProperties[];
}
2.
@Entity('intranetProperties')
export class IntranetProperties {
@PrimaryGeneratedColumn({ unsigned: true })
id: number;
@Column('int', { unsigned: true, nullable: false })
intranetId: number;
@Column('int', { unsigned: true, nullable: false })
propertyId: number;
@Column('varchar', { length: 128, nullable: false })
value: string;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
updatedAt: Date;
@ManyToOne(() => Intranets, (intranet) => intranet.id)
@JoinColumn({ name: 'intranetId', referencedColumnName: 'id' })
intranet: Intranets;
}
Делаю такой запрос:
this.intranetsRepository.find({
where: {
id,
},
relations: {
intranetProperties: true,
},
});
и получаю ошибку:
TypeError: Cannot read properties of undefined (reading 'joinColumns')
Почему?
.