mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Supported products include for Members Admin API
refs https://github.com/TryGhost/Team/issues/616 This allows us to check which products a Member has access to, without having to check the subscriptions array.
This commit is contained in:
parent
d7b6a48226
commit
050580e5ab
2 changed files with 16 additions and 2 deletions
|
@ -10,7 +10,7 @@ const settingsCache = require('../../services/settings/cache');
|
|||
const {i18n} = require('../../lib/common');
|
||||
const _ = require('lodash');
|
||||
|
||||
const allowedIncludes = ['email_recipients'];
|
||||
const allowedIncludes = ['email_recipients', 'products'];
|
||||
|
||||
module.exports = {
|
||||
docName: 'members',
|
||||
|
|
|
@ -94,7 +94,7 @@ function serializeMember(member, options) {
|
|||
}
|
||||
const subscriptions = json.subscriptions || [];
|
||||
|
||||
return {
|
||||
const serialized = {
|
||||
id: json.id,
|
||||
uuid: json.uuid,
|
||||
email: json.email,
|
||||
|
@ -114,6 +114,12 @@ function serializeMember(member, options) {
|
|||
email_recipients: json.email_recipients,
|
||||
status: json.status
|
||||
};
|
||||
|
||||
if (json.products) {
|
||||
serialized.products = json.products;
|
||||
}
|
||||
|
||||
return serialized;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -154,6 +160,7 @@ function createSerializer(debugString, serialize) {
|
|||
* @prop {string} updated_at
|
||||
* @prop {string[]} labels
|
||||
* @prop {SerializedMemberStripeSubscription[]} subscriptions
|
||||
* @prop {SerializedMemberProduct[]=} products
|
||||
* @prop {string} avatar_image
|
||||
* @prop {boolean} comped
|
||||
* @prop {number} email_count
|
||||
|
@ -163,6 +170,13 @@ function createSerializer(debugString, serialize) {
|
|||
* @prop {'free'|'paid'} status
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} SerializedMemberProduct
|
||||
* @prop {string} id
|
||||
* @prop {string} name
|
||||
* @prop {string} slug
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Object} SerializedMemberStripeData
|
||||
* @prop {SerializedMemberStripeSubscription[]} subscriptions
|
||||
|
|
Loading…
Add table
Reference in a new issue