Ghost/core/server/services/members/utils.js
Rishabh Garg fe3eab1836
Added member update endpoint with session auth (#11824)
- Allows member logged in with valid session to update their profile info - name, email, subscribed(newsletter subscription status)
- Adds new util method for formatted member response on the endpoints
- Adds common middlewares for body/bool parser and maintenance
- Adds `subscribed` status to member response
2020-05-20 14:37:58 +05:30

16 lines
533 B
JavaScript

module.exports.formattedMemberResponse = function formattedMemberResponse(member) {
if (!member) {
return null;
}
return {
uuid: member.uuid,
email: member.email,
name: member.name,
firstname: member.name && member.name.split(' ')[0],
avatar_image: member.avatar_image,
subscribed: !!member.subscribed,
subscriptions: member.stripe ? member.stripe.subscriptions : [],
paid: member.stripe ? member.stripe.subscriptions.length !== 0 : false
};
};