From 7c6206f1a21641eabb4232db17c144c2e1a1e80c Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Fri, 29 Mar 2019 22:45:53 +0100 Subject: [PATCH] Remove old code --- .../strapi-hook-bookshelf/lib/buildQuery.js | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/packages/strapi-hook-bookshelf/lib/buildQuery.js b/packages/strapi-hook-bookshelf/lib/buildQuery.js index 78f5c407bf..00149cc817 100644 --- a/packages/strapi-hook-bookshelf/lib/buildQuery.js +++ b/packages/strapi-hook-bookshelf/lib/buildQuery.js @@ -113,43 +113,6 @@ const buildJoinsAndFilter = (qb, model, whereClauses) => { } }; - const buildSingleJoin = (qb, rootModel, assocModel, association) => { - const relationTable = assocModel.collectionName; - - qb.distinct(); - - if (association.nature === 'manyToMany') { - // Join on both ends - qb.innerJoin( - association.tableCollectionName, - `${association.tableCollectionName}.${pluralize.singular(rootModel.collectionName)}_${ - rootModel.primaryKey - }`, - `${rootModel.collectionName}.${rootModel.primaryKey}` - ); - - qb.innerJoin( - relationTable, - `${association.tableCollectionName}.${rootModel.attributes[association.alias].attribute}_${ - rootModel.attributes[association.alias].column - }`, - `${relationTable}.${assocModel.primaryKey}` - ); - } else { - const externalKey = - association.type === 'collection' - ? `${relationTable}.${association.via}` - : `${relationTable}.${assocModel.primaryKey}`; - - const internalKey = - association.type === 'collection' - ? `${rootModel.collectionName}.${rootModel.primaryKey}` - : `${rootModel.collectionName}.${association.alias}`; - - qb.innerJoin(relationTable, externalKey, internalKey); - } - }; - /** * Create a query tree node from a key an assoc and a model * @param {Object} model - Strapi model