mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
2fd4cbb93b
refs #10431 - added v2 endpoint with browse permissions - context.integration was never accessible in the model layer - why? https://github.com/TryGhost/Ghost/issues/10099
39 lines
929 B
JavaScript
39 lines
929 B
JavaScript
const models = require('../../models');
|
|
|
|
module.exports = {
|
|
docName: 'actions',
|
|
|
|
browse: {
|
|
options: [
|
|
'page',
|
|
'limit',
|
|
'fields'
|
|
],
|
|
data: [
|
|
'id',
|
|
'type'
|
|
],
|
|
validation: {
|
|
id: {
|
|
required: true
|
|
},
|
|
type: {
|
|
required: true,
|
|
values: ['resource', 'actor']
|
|
}
|
|
},
|
|
permissions: true,
|
|
query(frame) {
|
|
if (frame.data.type === 'resource') {
|
|
frame.options.withRelated = ['actor'];
|
|
frame.options.filter = `resource_id:${frame.data.id}`;
|
|
} else {
|
|
frame.options.withRelated = ['resource'];
|
|
frame.options.filter = `actor_id:${frame.data.id}`;
|
|
}
|
|
|
|
return models.Action.findPage(frame.options);
|
|
}
|
|
}
|
|
};
|