From a15a45fa9b717e9fe3198454aa48cf87c2d9ab11 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Mon, 1 Oct 2018 20:30:37 +0200 Subject: [PATCH] Added notes about attribute serialization for tag parent and author author_id (#9932) refs #9866 - Added notes to tag/author model attributes that are not being touched during API introduction --- core/server/models/relations/authors.js | 1 + core/server/models/tag.js | 1 + 2 files changed, 2 insertions(+) diff --git a/core/server/models/relations/authors.js b/core/server/models/relations/authors.js index e209301ae5..4beb5a5888 100644 --- a/core/server/models/relations/authors.js +++ b/core/server/models/relations/authors.js @@ -177,6 +177,7 @@ module.exports.extendModel = function extendModel(Post, Posts, ghostBookshelf) { delete attrs.author_id; } else { // CASE: we return `post.author=id` with or without requested columns. + // @NOTE: this serialization should be moved into api layer, it's not being moved as it's not used if (!options.columns || (options.columns && options.columns.indexOf('author') !== -1)) { attrs.author = attrs.author_id; delete attrs.author_id; diff --git a/core/server/models/tag.js b/core/server/models/tag.js index 7f242f2451..83bf8267ae 100644 --- a/core/server/models/tag.js +++ b/core/server/models/tag.js @@ -65,6 +65,7 @@ Tag = ghostBookshelf.Model.extend({ var options = Tag.filterOptions(unfilteredOptions, 'toJSON'), attrs = ghostBookshelf.Model.prototype.toJSON.call(this, options); + // @NOTE: this serialization should be moved into api layer, it's not being moved as it's not used attrs.parent = attrs.parent || attrs.parent_id; delete attrs.parent_id;