I'm having some trouble modeling these relationships and getting the correct data in my app. I have users, links, and bookmarks. Where bookmarks is a join table so users can have many bookmarks, and links can have many bookmarks
<!-- user -->
export default DS.Model.extend({
username: DS.attr('string'),
bookmarks: DS.hasMany('bookmark', { async: true }),
});
<!-- link -->
export default DS.Model.extend({
title: DS.attr('string'),
url: DS.attr('string'),
bookmarks: DS.hasMany('bookmark', { async: true }),
});
<!-- bookmark -->
export default DS.Model.extend({
link: DS.belongsTo('link', { async:true }),
user: DS.belongsTo('user', { async:true })
});
In firebase this is what my data looks like:
user
- userkey
- bookmarks
- bookmarkkey : true
link
- linkkey
- bookmarks
- bookmarkkey : true
bookmark
- bookmarkkey
- link : linkkey
- user : userkey
In ember, when I pull a user model I'm able to access the related bookmarks, but not the link that is related to the bookmarks.
How can I fix this?
Aucun commentaire:
Enregistrer un commentaire