2013-11-24 18:29:36 +04:00
|
|
|
var ghostBookshelf = require('./base'),
|
2014-02-19 17:57:26 +04:00
|
|
|
|
2013-11-24 18:29:36 +04:00
|
|
|
Session,
|
|
|
|
Sessions;
|
|
|
|
|
|
|
|
Session = ghostBookshelf.Model.extend({
|
|
|
|
|
2014-02-19 17:57:26 +04:00
|
|
|
tableName: 'sessions'
|
2013-11-24 18:29:36 +04:00
|
|
|
|
|
|
|
}, {
|
|
|
|
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
|
|
|
|
};
|