Added computed "excerpt" field to Admin API v2

no issue
This commit is contained in:
kirrg001 2019-02-25 10:55:24 +01:00 committed by Katharina Irrgang
parent e65a82833c
commit 28a222703b
3 changed files with 13 additions and 6 deletions

View File

@ -32,9 +32,9 @@ const mapPost = (model, frame) => {
if (utils.isContentAPI(frame)) {
date.forPost(jsonModel);
members.forPost(jsonModel, frame);
extraAttrs.forPost(frame, model, jsonModel);
}
extraAttrs.forPost(frame, model, jsonModel);
clean.post(jsonModel, frame);
if (frame.options && frame.options.withRelated) {

View File

@ -72,7 +72,10 @@ describe('Pages API', function () {
.expect(201)
.then((res) => {
res.body.pages.length.should.eql(1);
localUtils.API.checkResponse(res.body.pages[0], 'page', null, ['primary_tag', 'primary_author']);
// @NOTE: we do not return "excerpt" if custom_excerpt or plaintext is empty
// @NOTE: we do not return primary_* if null
localUtils.API.checkResponse(res.body.pages[0], 'page', null, ['primary_tag', 'primary_author', 'excerpt']);
should.exist(res.headers['x-cache-invalidate']);
return models.Post.findOne({

View File

@ -29,8 +29,10 @@ const expectedProperties = {
.without('visibility')
.without('locale')
.without('page')
// always returns computed properties: url, comment_id, primary_tag, primary_author
.without('author_id').concat('url', 'primary_tag', 'primary_author')
// deprecated
.without('author_id')
// always returns computed properties
.concat('url', 'primary_tag', 'primary_author', 'excerpt')
,
page: _(schema.posts)
@ -40,8 +42,10 @@ const expectedProperties = {
.without('visibility')
.without('locale')
.without('page')
// always returns computed properties: url, comment_id, primary_tag, primary_author
.without('author_id').concat('url', 'primary_tag', 'primary_author')
// deprecated
.without('author_id')
// always returns computed properties
.concat('url', 'primary_tag', 'primary_author', 'excerpt')
,
user: _(schema.users)