mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
5c12c78d00
closes #528 - adds method (isPost)to models index.js that returns true if content, content_raw, title and slug are valid properties - adds url helper which checks context is post using isPost method - adds unit test to check a url is prefixed with / -adds unit test which checks for empty string if either of the 4 properties above are not present.
21 lines
686 B
JavaScript
21 lines
686 B
JavaScript
var migrations = require('../data/migration');
|
|
|
|
module.exports = {
|
|
Post: require('./post').Post,
|
|
User: require('./user').User,
|
|
Role: require('./role').Role,
|
|
Permission: require('./permission').Permission,
|
|
Settings: require('./settings').Settings,
|
|
init: function () {
|
|
return migrations.init();
|
|
},
|
|
reset: function () {
|
|
return migrations.reset().then(function () {
|
|
return migrations.init();
|
|
});
|
|
},
|
|
isPost: function (jsonData) {
|
|
return jsonData.hasOwnProperty("content") && jsonData.hasOwnProperty("content_raw")
|
|
&& jsonData.hasOwnProperty("title") && jsonData.hasOwnProperty("slug");
|
|
}
|
|
};
|