'use strict';

const apis = require('./apis');
const utils = require('./utils');

/*
 * Follow
 */
const follow = (query, rows, types, total, organize) => {
  const items = rows.map(row => {
    const type = types.find(model => {
      return model.id === row.type_slug;
    });

    return apis.one(query, row.id, type.attributes);
  });

  return Promise.all(items).then(all => {
    const formatted = {
      items: all,
      pages: utils.page('api', organize, total[0].count),
    };

    return formatted;
  });
};

module.exports = follow;

@@ -12,40 +12,8 @@
 ';%0A%0A
-const apis = require('./apis');%0A
 cons
@@ -224,18 +224,21 @@
  row
-.
+%5B'
 type
-_
+-
 slug
+'%5D
 ;%0A  
@@ -252,18 +252,126 @@
     
-return api
+if (typeof type === 'undefined') %7B%0A      return new Promise(res =%3E %7B%0A        res(%7B%7D);%0A      %7D);%0A    %7D%0A%0A    return util
 s.on

Fix undefined content type and type-slug