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

Updated getMemberMetadata to use findAll method

no-issue

This means we go via our version of the bookshelf model
This commit is contained in:
Fabien O'Carroll 2019-10-08 13:12:01 +07:00
parent ee0449245a
commit 4c07d86086

View file

@ -53,14 +53,14 @@ async function getMemberMetadata(member, module) {
return;
}
const customers = (await models.MemberStripeCustomer.where({
member_id: member.id
}).fetchAll()).toJSON();
const customers = (await models.MemberStripeCustomer.findAll({
filter: `member_id:${member.id}`
})).toJSON();
const subscriptions = await customers.reduce(async (subscriptionsPromise, customer) => {
const customerSubscriptions = await models.StripeCustomerSubscription.where({
customer_id: customer.customer_id
}).fetchAll();
const customerSubscriptions = await models.StripeCustomerSubscription.findAll({
filter: `customer_id:${customer.customer_id}`
});
return (await subscriptionsPromise).concat(customerSubscriptions.toJSON());
}, []);