mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Included subscription information when listing members
no-issue
This commit is contained in:
parent
2ce0c5a992
commit
19148dab4e
1 changed files with 24 additions and 1 deletions
|
@ -55,7 +55,30 @@ module.exports = function ({
|
|||
}
|
||||
|
||||
async function list(options) {
|
||||
return listMembers(options);
|
||||
const {meta, members} = await listMembers(options);
|
||||
|
||||
const membersWithSubscriptions = await Promise.all(members.map(async function (member) {
|
||||
if (!stripe) {
|
||||
return Object.assign(member, {
|
||||
stripe: {
|
||||
subscriptions: []
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const subscriptions = await stripe.getActiveSubscriptions(member);
|
||||
|
||||
return Object.assign(member, {
|
||||
stripe: {
|
||||
subscriptions
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
return {
|
||||
meta,
|
||||
members: membersWithSubscriptions
|
||||
};
|
||||
}
|
||||
|
||||
async function create(data, options = {}) {
|
||||
|
|
Loading…
Add table
Reference in a new issue