mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
36 lines
981 B
JavaScript
36 lines
981 B
JavaScript
|
const ghostBookshelf = require('./base');
|
||
|
|
||
|
const MobiledocRevision = ghostBookshelf.Model.extend({
|
||
|
tableName: 'mobiledoc_revisions'
|
||
|
}, {
|
||
|
permittedOptions(methodName) {
|
||
|
let options = ghostBookshelf.Model.permittedOptions.call(this, methodName);
|
||
|
const validOptions = {
|
||
|
findAll: ['filter', 'columns']
|
||
|
};
|
||
|
|
||
|
if (validOptions[methodName]) {
|
||
|
options = options.concat(validOptions[methodName]);
|
||
|
}
|
||
|
|
||
|
return options;
|
||
|
},
|
||
|
|
||
|
orderDefaultRaw() {
|
||
|
return 'created_at_ts DESC';
|
||
|
},
|
||
|
|
||
|
toJSON(unfilteredOptions) {
|
||
|
const options = MobiledocRevision.filterOptions(unfilteredOptions, 'toJSON');
|
||
|
const attrs = ghostBookshelf.Model.prototype.toJSON.call(this, options);
|
||
|
|
||
|
// CASE: only for internal accuracy
|
||
|
delete attrs.created_at_ts;
|
||
|
return attrs;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
module.exports = {
|
||
|
MobiledocRevision: ghostBookshelf.model('MobiledocRevision', MobiledocRevision)
|
||
|
};
|