0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Added relation between Member & OfferRedemption

refs https://github.com/TryGhost/Team/issues/1135

This will allow us to fetch the OfferRedemptions for a Member so that we
can display them on the Member details page.
This commit is contained in:
Fabien O'Carroll 2021-10-20 11:02:23 +02:00
parent 8709da36e9
commit 03d4561a5f

View file

@ -94,6 +94,11 @@ const Member = ghostBookshelf.Model.extend({
});
},
offerRedemptions() {
return this.hasMany('OfferRedemption', 'member_id', 'id')
.query('orderBy', 'created_at', 'DESC');
},
labels: function labels() {
return this.belongsToMany('Label', 'members_labels', 'member_id', 'label_id')
.withPivot('sort_order')