078060abdc
* Installed @tryghost/members-ssr@0.2.1 refs https://github.com/TryGhost/Members/issues/38 This updates allows for dynamic access of the membersApi, which will be used in future when replacing the membersApi instance with a newly configured one. * Set the membersApiInstance logger to use common.logging refs https://github.com/TryGhost/Members/issues/38 Passes the Ghost logger to the members api, so that we can keep an eye on errors produced by the api. * Refactored memberService use to always use getter refs https://github.com/TryGhost/Members/issues/38 This will allow us to switch out the membersApi and the consumers of it to have the updated reference by going through a getter. * Installed @tryghost/members-api@0.3.0 refs https://github.com/TryGhost/Members/issues/38 Adds support for setting the logger * Uninstalled stripe@7.0.0 refs https://github.com/TryGhost/Members/issues/38 The stripe module is now a dep of members-api, as it should be * Updated members service to reconfigure settings refs https://github.com/TryGhost/Members/issues/38 Previously we were unable to stop an invalidly configured members api instance, now that we create a new instance, we can wait for the ready or error event and only switch it out then.
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
// NOTE: We must not cache references to membersService.api
|
|
// as it is a getter and may change during runtime.
|
|
const membersService = require('../../services/members');
|
|
|
|
const members = {
|
|
docName: 'members',
|
|
browse: {
|
|
options: [
|
|
'limit',
|
|
'fields',
|
|
'filter',
|
|
'order',
|
|
'debug',
|
|
'page'
|
|
],
|
|
permissions: true,
|
|
validation: {},
|
|
query(frame) {
|
|
return membersService.api.members.list(frame.options);
|
|
}
|
|
},
|
|
|
|
read: {
|
|
headers: {},
|
|
data: [
|
|
'id',
|
|
'email'
|
|
],
|
|
validation: {},
|
|
permissions: true,
|
|
query(frame) {
|
|
return membersService.api.members.get(frame.data, frame.options);
|
|
}
|
|
},
|
|
|
|
destroy: {
|
|
statusCode: 204,
|
|
headers: {},
|
|
options: [
|
|
'id'
|
|
],
|
|
validation: {
|
|
options: {
|
|
id: {
|
|
required: true
|
|
}
|
|
}
|
|
},
|
|
permissions: true,
|
|
query(frame) {
|
|
frame.options.require = true;
|
|
return membersService.api.members.destroy(frame.options).return(null);
|
|
}
|
|
}
|
|
};
|
|
|
|
module.exports = members;
|