mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
3ff9146d9e
- remove sessions - remove all references to csrf - create a shared base model for the 2 types of token
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
var _ = require('lodash'),
|
|
when = require('when'),
|
|
models;
|
|
|
|
models = {
|
|
Post: require('./post').Post,
|
|
User: require('./user').User,
|
|
Role: require('./role').Role,
|
|
Permission: require('./permission').Permission,
|
|
Permissions: require('./permission').Permissions,
|
|
Settings: require('./settings').Settings,
|
|
Tag: require('./tag').Tag,
|
|
Base: require('./base'),
|
|
App: require('./app').App,
|
|
AppField: require('./appField').AppField,
|
|
AppSetting: require('./appSetting').AppSetting,
|
|
Client: require('./client').Client,
|
|
Accesstoken: require('./accesstoken').Accesstoken,
|
|
Refreshtoken: require('./refreshtoken').Refreshtoken,
|
|
|
|
init: function () {
|
|
return true;
|
|
},
|
|
// ### deleteAllContent
|
|
// Delete all content from the database (posts, tags, tags_posts)
|
|
deleteAllContent: function () {
|
|
var self = this;
|
|
|
|
return self.Post.findAll().then(function (posts) {
|
|
return when.all(_.map(posts.toJSON(), function (post) {
|
|
return self.Post.destroy({id: post.id});
|
|
}));
|
|
}).then(function () {
|
|
return self.Tag.findAll().then(function (tags) {
|
|
return when.all(_.map(tags.toJSON(), function (tag) {
|
|
return self.Tag.destroy({id: tag.id});
|
|
}));
|
|
});
|
|
});
|
|
}
|
|
};
|
|
|
|
module.exports = models;
|