brikteknologier / seraph-model

thin model layer for seraph/neo4j (node.js)
MIT License
111 stars 28 forks source link

Incorrect mapping for multiple objects mapped to same relationtype #136

Open mindbogglegames opened 5 years ago

mindbogglegames commented 5 years ago

I have set up the following composition for the Person model

Person.compose(Skill, 'likes_skill', 'LIKES'); Person.compose(Perk, 'likes_perk', 'LIKES');

In the neo4j database the person has a relation of 'LIKES' to a 'Skill'

When I fetch the Person via (read or where) it maps the specific 'Skill' to a 'Perk' instead so I incorrectly get this object { "likes_perk": [ "programming" ] } when what I would expect is { "likes_skill": [ "programming" ] } I assume this has something to both compositions mapping to the same relation? But I would assume the Seraph model would check the type also before mapping to it "likes_skill" or "likes_perk"