Ghost/core/server/data/schema/checks.js
Hannah Wolfe ef98c65040
Clean v2 Content API (#10329)
* Removed unused fields from v2 Content API

- We want to ship the v2 Content API as clean and lean as we can
- Many fields in the DB aren't actually used, we shouldn't return these values
- Other values aren't useful outside of Admin clients, and shouldn't be returned either

Fields removed:
- tags: created_at, updated_at, parent
- authors: locale, accessibility, tour
- posts: locale, author status, page
2019-01-04 11:21:21 +00:00

27 lines
847 B
JavaScript

function isPost(jsonData) {
return jsonData.hasOwnProperty('html') &&
jsonData.hasOwnProperty('title') && jsonData.hasOwnProperty('slug');
}
function isTag(jsonData) {
return jsonData.hasOwnProperty('name') && jsonData.hasOwnProperty('slug') &&
jsonData.hasOwnProperty('description') && jsonData.hasOwnProperty('feature_image');
}
function isUser(jsonData) {
return jsonData.hasOwnProperty('bio') && jsonData.hasOwnProperty('website') &&
jsonData.hasOwnProperty('profile_image') && jsonData.hasOwnProperty('location');
}
function isNav(jsonData) {
return jsonData.hasOwnProperty('label') && jsonData.hasOwnProperty('url') &&
jsonData.hasOwnProperty('slug') && jsonData.hasOwnProperty('current');
}
module.exports = {
isPost: isPost,
isTag: isTag,
isUser: isUser,
isNav: isNav
};