Skip to content
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.

Commit

Permalink
Make backend search to be partially compatible with client API
Browse files Browse the repository at this point in the history
  • Loading branch information
artkravchenko committed Mar 25, 2017
1 parent 84daa60 commit c32bd88
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/api/controller.js
Expand Up @@ -2712,9 +2712,9 @@ export default class ApiController {
grouped_result_objects[result_type] = await q.fetchAll();
}

ctx.body = _.mapKeys(grouped_result_objects, (value, key) => {
return `${key.toLowerCase()}s`;
});
ctx.body = _.transform(grouped_result_objects, (acc, value, key) => {
acc[key.toLowerCase().concat('s')] = { count: value.length, items: value };
}, {});
} else {
ctx.body = {};
return;
Expand Down

0 comments on commit c32bd88

Please sign in to comment.