mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 04:43:12 +03:00
32 lines
772 B
JavaScript
32 lines
772 B
JavaScript
|
var ghostBookshelf = require('./base'),
|
||
|
Session,
|
||
|
Sessions;
|
||
|
|
||
|
Session = ghostBookshelf.Model.extend({
|
||
|
|
||
|
tableName: 'sessions',
|
||
|
|
||
|
permittedAttributes: ['id', 'expires', 'sess'],
|
||
|
|
||
|
saving: function () {
|
||
|
// Remove any properties which don't belong on the session model
|
||
|
this.attributes = this.pick(this.permittedAttributes);
|
||
|
}
|
||
|
}, {
|
||
|
destroyAll: function (options) {
|
||
|
options = options || {};
|
||
|
return ghostBookshelf.Collection.forge([], {model: this}).fetch().
|
||
|
then(function (collection) {
|
||
|
collection.invokeThen('destroy', options);
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
Sessions = ghostBookshelf.Collection.extend({
|
||
|
model: Session
|
||
|
});
|
||
|
|
||
|
module.exports = {
|
||
|
Session: Session,
|
||
|
Sessions: Sessions
|
||
|
};
|