0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Merge pull request #2641 from alarobric/feature/2607TagParentRelation

Tag API response to use parent rather than parent_id
This commit is contained in:
Hannah Wolfe 2014-04-23 12:47:37 +01:00
commit 9bf02c9e8c
2 changed files with 10 additions and 1 deletions

View file

@ -27,6 +27,15 @@ Tag = ghostBookshelf.Model.extend({
posts: function () {
return this.belongsToMany(Posts);
},
toJSON: function (options) {
var attrs = ghostBookshelf.Model.prototype.toJSON.call(this, options);
attrs.parent = attrs.parent || attrs.parent_id;
delete attrs.parent_id;
return attrs;
}
});

View file

@ -14,7 +14,7 @@ var _ = require('lodash'),
settings: ['databaseVersion', 'dbHash', 'title', 'description', 'email', 'logo', 'cover', 'defaultLang',
"permalinks", 'postsPerPage', 'forceI18n', 'activeTheme', 'activeApps', 'installedApps',
'availableThemes', 'availableApps', 'nextUpdateCheck', 'displayUpdateNotification'],
tag: ['id', 'uuid', 'name', 'slug', 'description', 'parent_id',
tag: ['id', 'uuid', 'name', 'slug', 'description', 'parent',
'meta_title', 'meta_description', 'created_at', 'created_by', 'updated_at', 'updated_by'],
user: ['id', 'uuid', 'name', 'slug', 'email', 'image', 'cover', 'bio', 'website',
'location', 'accessibility', 'status', 'language', 'meta_title', 'meta_description',