0
votes

I'm trying to add a Person to my NestJS app using TypeORM. I have declared a Person entity and an Address entity, with a One Person to Many Address relation. I am able to add the person and their address(es), but then when I try to access a person (or all of them) I get an error:

TypeError: Cannot read property 'joinColumns' of undefined

I'm not sure what is going on, as I followed this example from the TypeORM docs for how to set up the ManyToOne and OneToMany relationship. I do notice, though, that the address table has the row in there, but the personId column is still null. You can see the person.entity.ts and address.entity.ts files, as well as the service that adds these items to the database, in this gist.

Any tips to figure this out would be greatly appreciated!

1

1 Answers

1
votes

I think the problem is in the line 30 of person.entity.ts, where
(address) => {address.person} (you're returning undefined here) should be
(address) => address.person