mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
refs https://github.com/TryGhost/Team/issues/1463 - This enables listing, creating and editing newsletters - The tests are commented out as the permissions will be added in a follow-up commit
45 lines
947 B
JavaScript
45 lines
947 B
JavaScript
const models = require('../../models');
|
|
|
|
module.exports = {
|
|
docName: 'newsletters',
|
|
|
|
browse: {
|
|
options: [
|
|
'filter',
|
|
'fields',
|
|
'limit',
|
|
'order',
|
|
'page'
|
|
],
|
|
permissions: true,
|
|
query(frame) {
|
|
return models.Newsletter.findPage(frame.options);
|
|
}
|
|
},
|
|
|
|
add: {
|
|
statusCode: 201,
|
|
permissions: true,
|
|
async query(frame) {
|
|
return models.Newsletter.add(frame.data.newsletters[0], frame.options);
|
|
}
|
|
},
|
|
|
|
edit: {
|
|
headers: {},
|
|
options: [
|
|
'id'
|
|
],
|
|
validation: {
|
|
options: {
|
|
id: {
|
|
required: true
|
|
}
|
|
}
|
|
},
|
|
permissions: true,
|
|
async query(frame) {
|
|
return models.Newsletter.edit(frame.data.newsletters[0], frame.options);
|
|
}
|
|
}
|
|
};
|