|
|
|
@ -177,9 +177,13 @@ function constructQuery(knex: Knex, queryFor: ObjectType, queryElem: api.QueryEl |
|
|
|
|
joinObjects.delete(queryFor); // We are already querying this object in the base query.
|
|
|
|
|
|
|
|
|
|
// Figure out what data we want to select from the results.
|
|
|
|
|
var columns: any[] = []; |
|
|
|
|
joinObjects.forEach((obj: ObjectType) => columns.push(...objectColumns[obj])); |
|
|
|
|
columns.push(...objectColumns[queryFor]); |
|
|
|
|
var columns: any[] = objectColumns[queryFor]; |
|
|
|
|
|
|
|
|
|
// TODO: there was a line here to add columns for the joined objects.
|
|
|
|
|
// Could not get it to work with Postgres, which wants aggregate functions
|
|
|
|
|
// to specify exactly how duplicates should be aggregated.
|
|
|
|
|
// Not sure whether we need these columns in the first place.
|
|
|
|
|
// joinObjects.forEach((obj: ObjectType) => columns.push(...objectColumns[obj]));
|
|
|
|
|
|
|
|
|
|
// First, we create a base query for the type of object we need to yield.
|
|
|
|
|
var q = knex.select(columns) |
|
|
|
|