Friday 9 February 2018

objection.js - relationships

Hi folks, i'm having hard times understanding how I should model many-to-many relationships in objections.js.The documentation on relations is not clear to me.Basically I have an app with an Account, Post and Like tables. A account can have posts and people can like it.Tables are like this:Account tableKeyFieldPKidusernamepasswordPost tableKeyFieldPKidFKaccount_idcontentLike tableKeyFieldPKidFKaccount_idFKnickname_idI have modeled the relationship between Account and posts using HasManyRelation on the Account model and a BelongsToOneRelation on the Post model.Now I can't figure out how to model the relationship between the Account and the Post through the Like table.Any help is appreciated

Submitted February 09, 2018 at 03:12PM by honestserpent

No comments:

Post a Comment