Saturday 29 December 2018

New to typeorm: having a hard time setting up a relation

I'm new at using typeorm and I can't define the relation that I want.Some help would be appreciated.Context: I have a user and a conversation table.A user has many conversation, and a conversation has one sender (user) and one recipient (user).Here's my User entity: http://bit.ly/2VkNqNB entity: http://bit.ly/2QakZ1g problem is that I want to access a user conversations with user.conversations, but right now it only gets the conversations where the user is the sender, whereas I want conversations where the user is either the sender or the recipient. Hopefully it makes sense.

Submitted December 29, 2018 at 08:10PM by Oalei

No comments:

Post a Comment