typeorm-polymorphic icon indicating copy to clipboard operation
typeorm-polymorphic copied to clipboard

Property "media" was not found in "User". Make sure your query is correct.

Open bamalik1996 opened this issue 1 year ago • 0 comments

user.entity.ts

@PolymorphicChildren(() => Media, {
        eager: true,
    })
    media: Media[];

media.entity.ts

@PolymorphicParent(() => [User])
    owner: User;
    
    @Column({ length: 191, nullable: true })
    entityType: string;

    @Column({ nullable: true })
    entityId: number;

user.service.ts

return this.usersRepository.findOne({
            where: {
                email: email,
            },
            relations: ['media']
        });

error [Nest] 9960 - 05/11/2024, 4:26:31 PM ERROR [ExceptionsHandler] Property "media" was not found in "User". Make sure your query is correct. EntityPropertyNotFoundError: Property "media" was not found in "User". Make sure your query is correct. at L:\node-js\bloom-apis\src\query-builder\SelectQueryBuilder.ts:3932:23

bamalik1996 avatar May 11 '24 11:05 bamalik1996